typst_types

class janim.items.svg.typst_types.TypstMatrix(matrix: Iterable[Iterable[str | float | Points]], delim: str | TypMatDelim | tuple[TypMatDelim, TypMatDelim] | None = None, *, align: TypMatAlignment | None = None, augment: int | str | None = None, gap: str | None = None, row_gap: str | None = None, column_gap: str | None = None, label: bool = False, **kwargs)

基类:TypstText

使用 Typst 进行矩阵布局

传参请参考 Typst 文档 https://typst.app/docs/reference/math/mat/ ,以下给出部分示例

TypstMatrix(
    [
        [1, 2, 3],
        [4, Arrow(ORIGIN, RIGHT), 6],
        [7, 8, 9]
    ],
).show()
TypstMatrix(
    [
        [1, 2, 3],
        [4, Arrow(ORIGIN, RIGHT), 6],
        [7, 8, 9]
    ],
    gap='2em',
).show()
TypstMatrix(
    [
        [1, 2, 3],
        [4, Arrow(ORIGIN, RIGHT), 6],
        [7, 8, 9]
    ],
    delim='[',
    align='right',
    augment=2,
    gap='0.5em',
)
TypstMatrix(
    [
        [1, 2, 3],
        [4, Circle(radius=0.25, fill_alpha=0.5), 6],
        [7, 8, 9]
    ],
    delim='[',
    augment=2,
    column_gap='0.7em',
    preamble='#set text(size: 3em)'
).show()
matrix_labels

按照子物件顺序排列的矩阵元素标签

get_inserted(index: int) Points

获取插入的第 index 个 JAnim 物件

index 从 0 开始计数

get_element(row: int, col: int) Group[SVGElemItem] | Points

根据行列索引元素

需要在构造 TypstMatrix 时传入 label=True 启用

get_elements() list[Group[SVGElemItem] | Points]

获取矩阵中所有元素

需要在构造 TypstMatrix 时传入 label=True 启用

get_left_brace() Group[SVGElemItem]

获取左大括号元素

需要在构造 TypstMatrix 时传入 label=True 启用

get_right_brace() Group[SVGElemItem]

获取右大括号元素

需要在构造 TypstMatrix 时传入 label=True 启用