跳转至

标注

影片代码
import manimgx as m


class AnnotationsHero(m.Scene):
    def construct(self) -> None:
        formula = m.MathTex(r"a^2 + b^2 = c^2", font_size=72).shift(1.5 * m.UP)
        brace = m.Brace(formula[0][:5], m.DOWN, color=m.YELLOW)
        note = brace.get_text("the legs")
        frame = m.SurroundingRectangle(formula[0][6:], color=m.BLUE)
        a, b, c = [-1.5, -3, 0], [1.5, -3, 0], [1.5, -0.8, 0]
        triangle = m.Polygon(a, b, c, color=m.WHITE)
        right = m.RightAngle(m.Line(b, a), m.Line(b, c), length=0.35, color=m.GREEN)
        angle = m.Angle(m.Line(a, b), m.Line(a, c), radius=0.8, color=m.RED)
        self.play(m.Write(formula))
        self.play(m.GrowFromCenter(brace), m.FadeIn(note), m.Create(frame))
        self.play(m.Create(triangle), m.Create(right), m.Create(angle))
        self.wait()

标注指向另一个 mobject,为其加框、贴标签或度量它。大多数标注在创建时接收该 mobject 并与之贴合:与其边等长的花括号、环绕其周围的边框、其下方的线条。此后 它们不会跟随该 mobject;若要使其跟随,需用 always_redraw 在每一帧重新绘制。

花括号

Brace

代码
import manimgx as m


class BraceExample(m.Scene):
    def construct(self) -> None:
        square = m.Square(side_length=3, color=m.BLUE, fill_opacity=0.5)
        self.add(square)
        self.play(
            m.GrowFromCenter(m.Brace(square)),
            m.GrowFromCenter(m.Brace(square, m.RIGHT, color=m.YELLOW)),
            m.GrowFromCenter(m.Brace(square, m.UP, buff=0.5, color=m.GREEN)),
        )

沿 mobject 某一边的花括号,长度与 mobject 在该方向的宽度相同: 填充白色,无轮廓线,除非另行设置样式。

花括号位于 mobject 包围盒以外 buff 处,在 direction 所指向的一侧, 横跨 mobject 在该方向上的范围,其尖端朝外;mobject 本身保持不变。 get_text 和 get_tex 可在其尖端处添加标签。

m.Brace(mobject, direction=DOWN, buff=0.2, sharpness=2, **kwargs)
mobject

要加花括号的 mobject。

direction

花括号所在的一侧,以方向表示(DOWN:下方)。

buff

mobject 与花括号之间的间距,以场景单位表示。

sharpness

花括号尖端和两端的尖锐程度:值越高,其卷曲越窄。

color

填充与描边共用的颜色(默认白色);None 表示该类的默认值。

fill_color

填充的颜色;未给出时为 color。多个颜色沿 sheen_direction 构成渐变。

fill_opacity

填充的不透明度,取值从 0 到 1(默认 0:无填充)。

stroke_color

描边的颜色;未给出时为 color。多个颜色构成渐变。

stroke_opacity

描边的不透明度,取值从 0 到 1(默认 1)。

stroke_width

描边的宽度,以场景单位的百分之一计(默认 4;0:无描边)。

background_stroke_color

绘制于填充之后的轮廓颜色(默认黑色)。

background_stroke_opacity

轮廓的不透明度,取值从 0 到 1(默认 1)。

background_stroke_width

轮廓的宽度,以场景单位的百分之一计(默认 0:无)。

sheen_factor

颜色朝 sheen_direction 变亮的程度,取值从 -1 到 1(默认 0); 负值变暗。

sheen_direction

颜色变亮的方向(默认 UL)。

joint_type

描边在路径转折处的连接方式:圆角、斜切或斜接,按二维场景的绘制方式 (参见 LineJointType;默认 AUTO:斜接)。

cap_style

描边在其显示的每一端的端点样式(开放路径的端点、虚线的端点):圆头、平头 或方头,按二维场景的绘制方式(参见 CapStyleType;默认 AUTO:平头)。

shade_in_3d

三维场景的光是否对该 mobject 着色。

material

其表面在三维场景中如何反射场景的光(参见 Material);None:Manim 的着色(默认)。

name

mobject 的名称;未给出时为其类名。

z_index

其在绘制顺序中的位置:索引较高者绘制于较低者之上 (默认 0)。

target

MoveToTarget 将 mobject 移动至的状态。

还接受 样式关键字。

源码

manimgx\mobjects\annotations.py

def __init__(
    self,
    mobject: Mobject,
    direction: Vector3DLike = DOWN,
    buff: float = 0.2,
    sharpness: float = 2,
    **kwargs: Unpack[Style],
):
    path_string_template = (
        "m0.01216 0c-0.01152 0-0.01216 6.103e-4 -0.01216 0.01311v0.007762c0.06776"
        " 0.122 0.1799 0.1455 0.2307 0.1455h{0}c0.03046 3.899e-4 0.07964 0.00449"
        " 0.1246 0.02636 0.0537 0.02695 0.07418 0.05816 0.08648 0.07769 0.001562"
        " 0.002538 0.004539 0.002563 0.01098 0.002563 0.006444-2e-8"
        " 0.009421-2.47e-5 0.01098-0.002563 0.0123-0.01953 0.03278-0.05074"
        " 0.08648-0.07769 0.04491-0.02187 0.09409-0.02597"
        " 0.1246-0.02636h{0}c0.05077 0 0.1629-0.02346"
        " 0.2307-0.1455v-0.007762c-1.78e-6 -0.0125-6.365e-4"
        " -0.01311-0.01216-0.01311-0.006444-3.919e-8 -0.009348 2.448e-5 -0.01091"
        " 0.002563-0.0123 0.01953-0.03278 0.05074-0.08648 0.07769-0.04491"
        " 0.02187-0.09416 0.02597-0.1246 0.02636h{1}c-0.04786 0-0.1502"
        " 0.02094-0.2185"
        " 0.1256-0.06833-0.1046-0.1706-0.1256-0.2185-0.1256h{1}c-0.03046-3.899e-4"
        " -0.07972-0.004491-0.1246-0.02636-0.0537-0.02695-0.07418-0.05816-0.08648-0.07769-0.001562-0.002538-0.004467-0.002563-0.01091-0.002563z"
    )
    default_min_width = 0.90552
    self.buff = buff
    dx, dy = np.asarray(direction, dtype=float)[:2]
    angle = -np.arctan2(dx, dy) + np.pi
    mobject.rotate(-angle, about_point=ORIGIN)
    left = mobject.get_corner(DOWN + LEFT)
    right = mobject.get_corner(DOWN + RIGHT)
    target_width = right[0] - left[0]
    linear_section_length = max(
        0, (target_width * sharpness - default_min_width) / 2
    )
    import svgelements as se

    path = se.Path(
        path_string_template.format(linear_section_length, -linear_section_length)
    )
    super().__init__(path_obj=path, **kwargs)
    self.flip(RIGHT)
    self.stretch_to_fit_width(target_width)
    self.shift(left - self.get_corner(UP + LEFT) + self.buff * DOWN)
    for mob in (mobject, self):
        mob.rotate(angle, about_point=ORIGIN)

put_at_tip

将一个 mobject 放在花括号的尖端处,在其外侧。

brace.put_at_tip(mob, use_next_to=True, **kwargs)
mob

要放置在该处的 mobject。

use_next_to

是否将其放在尖端旁边,位于花括号所指向的一侧 (其方向四舍五入到八个罗盘方向之一);若否,则其中心从尖端 沿花括号方向移动其宽度的一半加 buff 的距离。

buff

两者之间的间距,以场景单位表示(默认 0.25)。

aligned_edge

两个对象在它们相遇侧旁对齐所沿的边,以方向表示:当方向为 RIGHT 和 UP 时, 它们的顶部对齐(默认 ORIGIN:居中)。

submobject_to_align

要放在另一对象旁边的 mobject 的一部分,代替其位置;其余部分随其移动 (默认 None:整个 mobject)。

index_of_submobject_to_align

每个 mobject 中要对齐部分的索引:此对象的部分放在另一对象的部分旁边 (默认 None:各自的全部)。

coor_mask

哪些坐标可以改变:mobject 沿其移动的每个轴为 1,保持不变的轴为 0 (默认 (1, 1, 1))。

源码

manimgx\mobjects\annotations.py

def put_at_tip(
    self, mob: Mobject, use_next_to: bool = True, **kwargs: Unpack[Placement]
) -> Self:
    """将一个 mobject 放在花括号的尖端处,在其外侧。

    Args:
        mob: 要放置在该处的 mobject。
        use_next_to: 是否将其放在尖端旁边,位于花括号所指向的一侧
            (其方向四舍五入到八个罗盘方向之一);若否,则其中心从尖端
            沿花括号方向移动其宽度的一半加 `buff` 的距离。
        **kwargs: [Placement 关键字][manimgx.mobject.Placement]:`buff`,
            即间距,除非另行指定,默认为 0.25。
    """
    if use_next_to:
        mob.next_to(self.get_tip(), np.round(self.get_direction()), **kwargs)
    else:
        mob.move_to(self.get_tip())
        buff = kwargs.get("buff", DEFAULT_MOBJECT_TO_MOBJECT_BUFFER)
        shift_distance = mob.width / 2.0 + buff
        mob.shift(self.get_direction() * shift_distance)
    return self

get_text

代码
import manimgx as m


class BraceGetTextExample(m.Scene):
    def construct(self) -> None:
        line = m.Line([-3, -1.5, 0], [3, 1.5, 0], color=m.ORANGE)
        normal = line.copy().rotate(m.PI / 2).get_unit_vector()
        below, side = m.Brace(line), m.Brace(line, normal)
        self.add(line, below, side)
        self.play(
            m.Write(below.get_text("Horizontal distance")),
            m.Write(side.get_tex("x - x_1")),
        )

在花括号尖端处制作一个 LaTeX 文本标签,放置方式如同 put_at_tip。

brace.get_text(*text, **kwargs)
*text

标签,以 LaTeX 表示:每部分一个字符串(参见 Tex)。

buff

两者之间的间距,以场景单位表示(默认 0.25)。

aligned_edge

两个对象在它们相遇侧旁对齐所沿的边,以方向表示:当方向为 RIGHT 和 UP 时, 它们的顶部对齐(默认 ORIGIN:居中)。

submobject_to_align

要放在另一对象旁边的 mobject 的一部分,代替其位置;其余部分随其移动 (默认 None:整个 mobject)。

index_of_submobject_to_align

每个 mobject 中要对齐部分的索引:此对象的部分放在另一对象的部分旁边 (默认 None:各自的全部)。

coor_mask

哪些坐标可以改变:mobject 沿其移动的每个轴为 1,保持不变的轴为 0 (默认 (1, 1, 1))。

返回 一个新的 Tex,位于尖端处;需将其添加到场景中。

源码

manimgx\mobjects\annotations.py

def get_text(self, *text: str, **kwargs: Unpack[Placement]) -> Tex:
    """在花括号尖端处制作一个 LaTeX 文本标签,放置方式如同
    [put_at_tip][manimgx.Brace.put_at_tip]。

    Args:
        *text: 标签,以 LaTeX 表示:每部分一个字符串(参见 [Tex][manimgx.Tex])。
        **kwargs: [Placement 关键字][manimgx.mobject.Placement]。

    Returns:
        一个新的 [Tex][manimgx.Tex],位于尖端处;需将其添加到场景中。

    Examples:
        ```python
        import manimgx as m


        class BraceGetTextExample(m.Scene):
            def construct(self) -> None:
                line = m.Line([-3, -1.5, 0], [3, 1.5, 0], color=m.ORANGE)
                normal = line.copy().rotate(m.PI / 2).get_unit_vector()
                below, side = m.Brace(line), m.Brace(line, normal)
                self.add(line, below, side)
                self.play(
                    m.Write(below.get_text("Horizontal distance")),
                    m.Write(side.get_tex("x - x_1")),
                )
        ```
    """
    text_mob = Tex(*text)
    self.put_at_tip(text_mob, **kwargs)
    return text_mob

get_tex

在花括号尖端处制作一个 LaTeX 数学标签,放置方式如同 put_at_tip。

brace.get_tex(*tex, **kwargs)
*tex

标签,以 LaTeX 表示:每部分一个字符串(参见 MathTex)。

buff

两者之间的间距,以场景单位表示(默认 0.25)。

aligned_edge

两个对象在它们相遇侧旁对齐所沿的边,以方向表示:当方向为 RIGHT 和 UP 时, 它们的顶部对齐(默认 ORIGIN:居中)。

submobject_to_align

要放在另一对象旁边的 mobject 的一部分,代替其位置;其余部分随其移动 (默认 None:整个 mobject)。

index_of_submobject_to_align

每个 mobject 中要对齐部分的索引:此对象的部分放在另一对象的部分旁边 (默认 None:各自的全部)。

coor_mask

哪些坐标可以改变:mobject 沿其移动的每个轴为 1,保持不变的轴为 0 (默认 (1, 1, 1))。

返回 一个新的 MathTex,位于尖端处;需将其添加到场景中。

源码

manimgx\mobjects\annotations.py

def get_tex(self, *tex: str, **kwargs: Unpack[Placement]) -> MathTex:
    """在花括号尖端处制作一个 LaTeX 数学标签,放置方式如同
    [put_at_tip][manimgx.Brace.put_at_tip]。

    Args:
        *tex: 标签,以 LaTeX 表示:每部分一个字符串(参见
            [MathTex][manimgx.MathTex])。
        **kwargs: [Placement 关键字][manimgx.mobject.Placement]。

    Returns:
        一个新的 [MathTex][manimgx.MathTex],位于尖端处;需将其添加到场景中。
    """
    tex_mob = MathTex(*tex)
    self.put_at_tip(tex_mob, **kwargs)
    return tex_mob

get_tip

花括号的尖端:其中心尖点的位置。

brace.get_tip()

返回 该点,以场景坐标表示。

源码

manimgx\mobjects\annotations.py

def get_tip(self) -> Point3D:
    """花括号的尖端:其中心尖点的位置。

    Returns:
        该点,以场景坐标表示。
    """
    return self.points[28]

get_direction

花括号所指向的方向:从其中心到其尖端。

brace.get_direction()

返回 一个单位向量。

源码

manimgx\mobjects\annotations.py

def get_direction(  # pyright: ignore[reportIncompatibleMethodOverride]  # ty: ignore[invalid-method-override]  # CE's: a brace's direction is a vector, a path's a winding
    self,
) -> Vector3D:
    """花括号所指向的方向:从其中心到其尖端。

    Returns:
        一个单位向量。
    """
    vect = self.get_tip() - self.get_center()
    return vect / np.linalg.norm(vect)

BraceBetweenPoints

代码
import manimgx as m


class BraceBetweenPointsExample(m.Scene):
    def construct(self) -> None:
        a, b = [-3, -1, 0], [3, 2, 0]
        self.add(m.Line(a, b), m.Dot(a), m.Dot(b))
        brace = m.BraceBetweenPoints(a, b, color=m.YELLOW)
        self.play(m.GrowFromCenter(brace))

横跨两点之间线段的花括号。

m.BraceBetweenPoints(point_1, point_2, direction=ORIGIN, **kwargs)
point_1

一端。

point_2

另一端。

direction

花括号所在的一侧,以方向表示;ORIGIN(默认值)表示 从 point_1 到 point_2 行进方向的右侧(对于从左到右的两点, 即下方)。

buff

mobject 与花括号之间的间距,以场景单位表示(默认 0.2)。

sharpness

花括号尖端和两端的尖锐程度:值越高,其卷曲越窄 (默认 2)。

color

填充与描边共用的颜色(默认白色);None 表示该类的默认值。

fill_color

填充的颜色;未给出时为 color。多个颜色沿 sheen_direction 构成渐变。

fill_opacity

填充的不透明度,取值从 0 到 1(默认 0:无填充)。

stroke_color

描边的颜色;未给出时为 color。多个颜色构成渐变。

stroke_opacity

描边的不透明度,取值从 0 到 1(默认 1)。

stroke_width

描边的宽度,以场景单位的百分之一计(默认 4;0:无描边)。

background_stroke_color

绘制于填充之后的轮廓颜色(默认黑色)。

background_stroke_opacity

轮廓的不透明度,取值从 0 到 1(默认 1)。

background_stroke_width

轮廓的宽度,以场景单位的百分之一计(默认 0:无)。

sheen_factor

颜色朝 sheen_direction 变亮的程度,取值从 -1 到 1(默认 0); 负值变暗。

sheen_direction

颜色变亮的方向(默认 UL)。

joint_type

描边在路径转折处的连接方式:圆角、斜切或斜接,按二维场景的绘制方式 (参见 LineJointType;默认 AUTO:斜接)。

cap_style

描边在其显示的每一端的端点样式(开放路径的端点、虚线的端点):圆头、平头 或方头,按二维场景的绘制方式(参见 CapStyleType;默认 AUTO:平头)。

shade_in_3d

三维场景的光是否对该 mobject 着色。

material

其表面在三维场景中如何反射场景的光(参见 Material);None:Manim 的着色(默认)。

name

mobject 的名称;未给出时为其类名。

z_index

其在绘制顺序中的位置:索引较高者绘制于较低者之上 (默认 0)。

target

MoveToTarget 将 mobject 移动至的状态。

源码

manimgx\mobjects\annotations.py

def __init__(
    self,
    point_1: Point3DLike,
    point_2: Point3DLike,
    direction: Vector3DLike = ORIGIN,
    **kwargs: Unpack[BraceOptions],
):
    if not np.any(np.asarray(direction, dtype=float)):  # a side of the line
        line_vector = np.array(point_2, dtype=float) - np.array(
            point_1, dtype=float
        )
        direction = np.array([line_vector[1], -line_vector[0], 0])
    super().__init__(Line(point_1, point_2), direction=direction, **kwargs)

ArcBrace

代码
import manimgx as m


class ArcBraceExample(m.Scene):
    def construct(self) -> None:
        arc = m.Arc(radius=2.5, angle=2 * m.PI / 3, color=m.BLUE)
        arc.shift(1.5 * m.DOWN)
        self.add(arc)
        self.play(
            m.GrowFromCenter(m.ArcBrace(arc)),
            m.GrowFromCenter(m.ArcBrace(arc, m.LEFT, color=m.YELLOW)),
        )

沿圆弧弯曲的花括号,位于其外侧或内侧。

m.ArcBrace(arc=None, direction=RIGHT, **kwargs)
arc

要加花括号的圆弧;None 表示半径为 1、从 -1 到 1 弧度的圆弧。

direction

RIGHT 表示花括号在圆弧外侧,LEFT 表示在内侧。

buff

mobject 与花括号之间的间距,以场景单位表示(默认 0.2)。

sharpness

花括号尖端和两端的尖锐程度:值越高,其卷曲越窄 (默认 2)。

color

填充与描边共用的颜色(默认白色);None 表示该类的默认值。

fill_color

填充的颜色;未给出时为 color。多个颜色沿 sheen_direction 构成渐变。

fill_opacity

填充的不透明度,取值从 0 到 1(默认 0:无填充)。

stroke_color

描边的颜色;未给出时为 color。多个颜色构成渐变。

stroke_opacity

描边的不透明度,取值从 0 到 1(默认 1)。

stroke_width

描边的宽度,以场景单位的百分之一计(默认 4;0:无描边)。

background_stroke_color

绘制于填充之后的轮廓颜色(默认黑色)。

background_stroke_opacity

轮廓的不透明度,取值从 0 到 1(默认 1)。

background_stroke_width

轮廓的宽度,以场景单位的百分之一计(默认 0:无)。

sheen_factor

颜色朝 sheen_direction 变亮的程度,取值从 -1 到 1(默认 0); 负值变暗。

sheen_direction

颜色变亮的方向(默认 UL)。

joint_type

描边在路径转折处的连接方式:圆角、斜切或斜接,按二维场景的绘制方式 (参见 LineJointType;默认 AUTO:斜接)。

cap_style

描边在其显示的每一端的端点样式(开放路径的端点、虚线的端点):圆头、平头 或方头,按二维场景的绘制方式(参见 CapStyleType;默认 AUTO:平头)。

shade_in_3d

三维场景的光是否对该 mobject 着色。

material

其表面在三维场景中如何反射场景的光(参见 Material);None:Manim 的着色(默认)。

name

mobject 的名称;未给出时为其类名。

z_index

其在绘制顺序中的位置:索引较高者绘制于较低者之上 (默认 0)。

target

MoveToTarget 将 mobject 移动至的状态。

源码

manimgx\mobjects\annotations.py

def __init__(
    self,
    arc: Arc | None = None,
    direction: Vector3DLike = RIGHT,
    **kwargs: Unpack[BraceOptions],
):
    if arc is None:
        arc = Arc(start_angle=-1, angle=2, radius=1)
    arc_end_angle = arc.start_angle + arc.angle
    line = Line(UP * arc.start_angle, UP * arc_end_angle)
    scale_shift = RIGHT * np.log(arc.radius)
    if arc.radius >= 1:
        line.scale(arc.radius, about_point=ORIGIN)
        super().__init__(line, direction=direction, **kwargs)
        self.scale(1 / arc.radius, about_point=ORIGIN)
    else:
        super().__init__(line, direction=direction, **kwargs)
    if arc.radius >= 0.3:
        self.shift(scale_shift)
    else:
        self.shift(RIGHT * np.log(0.3))
    self.apply_complex_function(np.exp)
    self.shift(arc.get_arc_center())

BraceLabel

代码
import manimgx as m


class BraceLabelExample(m.Scene):
    def construct(self) -> None:
        square = m.Square(side_length=3, color=m.BLUE, fill_opacity=0.5)
        side = m.BraceLabel(square, "a", font_size=72)
        diagonal = m.BraceLabel(square, r"a\sqrt{2}", m.UR, font_size=72)
        self.add(square)
        self.play(m.Write(side), m.Write(diagonal))

沿 mobject 某一边的花括号,以及在其尖端处的标签:除非另行指定 标签类,否则为数学式。

其各部分为其 brace 和其 label。

m.BraceLabel(obj, text, brace_direction=DOWN, label_constructor=MathTex, font_size=DEFAULT_FONT_SIZE, buff=0.2, brace_config=None, **kwargs)
obj

要加花括号的 mobject。

text

标签:一个字符串,或多个(作为 MathTex 的 各部分)。

brace_direction

花括号所在的一侧,以方向表示。

label_constructor

标签的类:MathTex,或其他文本类。

font_size

标签的字号。

buff

mobject 与花括号之间的间距,以场景单位表示。

brace_config

花括号关键字,覆盖 buff。

color

填充与描边共用的颜色(默认白色);None 表示该类的默认值。

fill_color

填充的颜色;未给出时为 color。多个颜色沿 sheen_direction 构成渐变。

fill_opacity

填充的不透明度,取值从 0 到 1(默认 0:无填充)。

stroke_color

描边的颜色;未给出时为 color。多个颜色构成渐变。

stroke_opacity

描边的不透明度,取值从 0 到 1(默认 1)。

stroke_width

描边的宽度,以场景单位的百分之一计(默认 4;0:无描边)。

background_stroke_color

绘制于填充之后的轮廓颜色(默认黑色)。

background_stroke_opacity

轮廓的不透明度,取值从 0 到 1(默认 1)。

background_stroke_width

轮廓的宽度,以场景单位的百分之一计(默认 0:无)。

sheen_factor

颜色朝 sheen_direction 变亮的程度,取值从 -1 到 1(默认 0); 负值变暗。

sheen_direction

颜色变亮的方向(默认 UL)。

joint_type

描边在路径转折处的连接方式:圆角、斜切或斜接,按二维场景的绘制方式 (参见 LineJointType;默认 AUTO:斜接)。

cap_style

描边在其显示的每一端的端点样式(开放路径的端点、虚线的端点):圆头、平头 或方头,按二维场景的绘制方式(参见 CapStyleType;默认 AUTO:平头)。

shade_in_3d

三维场景的光是否对该 mobject 着色。

material

其表面在三维场景中如何反射场景的光(参见 Material);None:Manim 的着色(默认)。

name

mobject 的名称;未给出时为其类名。

z_index

其在绘制顺序中的位置:索引较高者绘制于较低者之上 (默认 0)。

target

MoveToTarget 将 mobject 移动至的状态。

还接受 样式关键字。

源码

manimgx\mobjects\annotations.py

def __init__(
    self,
    obj: Mobject,
    text: str | Sequence[str],
    brace_direction: Vector3DLike = DOWN,
    label_constructor: LabelMaker = MathTex,
    font_size: float = DEFAULT_FONT_SIZE,
    buff: float = 0.2,
    brace_config: BraceOptions | None = None,
    **kwargs: Unpack[Style],
):
    self.label_constructor = label_constructor
    super().__init__(**kwargs)
    self.brace_direction = brace_direction
    self.brace = Brace(
        obj,
        brace_direction,
        **(BraceOptions(buff=buff) | (brace_config or BraceOptions())),
    )
    """花括号,一个组成部分。"""
    if isinstance(text, str):
        self.label: ManimTextLabel = self.label_constructor(
            text, font_size=font_size
        )
        """位于花括号尖端处的标签:一个组成部分。"""
    else:
        self.label = self.label_constructor(*text, font_size=font_size, **kwargs)
    self.brace.put_at_tip(self.label)
    self.add(self.brace, self.label)

brace

花括号,一个组成部分。

label

位于花括号尖端处的标签:一个组成部分。

change_label

用由标签类以 text 生成的新标签替换原标签,放在花括号的 尖端处。

brace_label.change_label(*text, **kwargs)
*text

新标签的字符串。

font_size

文本的大小:一个 em 为 font_size / 96 场景单位,默认时为 0.5, 48(Text 按其大写字母确定大小:48 时高 0.449 单位)。

typst_preamble

在文档之前设置的 Typst 代码:#set 和 #show 规则、#let 定义、导入(默认为 "")。

font_paths

字体文件(.ttf、.otf、.ttc、.otc)的目录,在 manimgx 附带的字体之前 连同其子目录一起搜索;指向文件的路径不添加任何内容 (默认为 None)。

should_center

mobject 是否居中于原点(默认为 True)。

height

将 mobject 缩放至的高度,以场景单位计,而非按 font_size 确定大小 (默认为 None)。

width

将 mobject 缩放至的宽度,以场景单位计,而非按 font_size 确定大小; 若同时给出 height,则宽度最后设置(默认为 None)。

package_path

Typst 包导入的目录,将包存放为 namespace/name/version 目录: #import "@preview/name:1.0.0" 读取 preview/name/1.0.0(默认为 None: 除 mitex 外无任何包,mitex 由 manimgx 的引擎持有)。不下载任何内容。

background_stroke_color

绘制于填充之后的轮廓颜色(默认黑色)。

background_stroke_opacity

轮廓的不透明度,取值从 0 到 1(默认 1)。

background_stroke_width

轮廓的宽度,以场景单位的百分之一计(默认 0:无)。

sheen_factor

颜色朝 sheen_direction 变亮的程度,取值从 -1 到 1(默认 0); 负值变暗。

sheen_direction

颜色变亮的方向(默认 UL)。

joint_type

描边在路径转折处的连接方式:圆角、斜切或斜接,按二维场景的绘制方式 (参见 LineJointType;默认 AUTO:斜接)。

cap_style

描边在其显示的每一端的端点样式(开放路径的端点、虚线的端点):圆头、平头 或方头,按二维场景的绘制方式(参见 CapStyleType;默认 AUTO:平头)。

shade_in_3d

三维场景的光是否对该 mobject 着色。

material

其表面在三维场景中如何反射场景的光(参见 Material);None:Manim 的着色(默认)。

name

mobject 的名称;未给出时为其类名。

z_index

其在绘制顺序中的位置:索引较高者绘制于较低者之上 (默认 0)。

target

MoveToTarget 将 mobject 移动至的状态。

还接受 样式关键字。

源码

manimgx\mobjects\annotations.py

def change_label(self, *text: str, **kwargs: Unpack[TypstOptions]) -> Self:
    """用由标签类以 `text` 生成的新标签替换原标签,放在花括号的
    尖端处。

    Args:
        *text: 新标签的字符串。
        **kwargs: 针对其的 [Typst 关键字][manimgx.mobjects.text.TypstOptions]
            (除非另行指定,字号为 48)。
    """
    self.remove(self.label)
    self.label = self.label_constructor(*text, **kwargs)
    self.brace.put_at_tip(self.label)
    self.add(self.label)
    return self

BraceText

BraceTextExample
代码
import manimgx as m


class BraceTextExample(m.Scene):
    def construct(self) -> None:
        rectangle = m.Rectangle(width=6, height=3, color=m.BLUE)
        width = m.BraceText(rectangle, "width")
        height = m.BraceText(rectangle, "height", brace_direction=m.RIGHT)
        self.add(rectangle, width, height)

沿 mobject 某一边的花括号,以及在其尖端处的文本标签:一个 标签为 Text 的 BraceLabel。

m.BraceText(obj, text, label_constructor=Text, **kwargs)
obj

要加花括号的 mobject。

text

标签的文本。

label_constructor

标签的类。

brace_direction

花括号所在的一侧,以方向表示(默认 DOWN:下方)。

font_size

标签的字号(默认 48)。

buff

mobject 与花括号之间的间距,以场景单位表示(默认 0.2)。

brace_config

花括号关键字,覆盖 buff(默认 None)。

color

填充与描边共用的颜色(默认白色);None 表示该类的默认值。

fill_color

填充的颜色;未给出时为 color。多个颜色沿 sheen_direction 构成渐变。

fill_opacity

填充的不透明度,取值从 0 到 1(默认 0:无填充)。

stroke_color

描边的颜色;未给出时为 color。多个颜色构成渐变。

stroke_opacity

描边的不透明度,取值从 0 到 1(默认 1)。

stroke_width

描边的宽度,以场景单位的百分之一计(默认 4;0:无描边)。

background_stroke_color

绘制于填充之后的轮廓颜色(默认黑色)。

background_stroke_opacity

轮廓的不透明度,取值从 0 到 1(默认 1)。

background_stroke_width

轮廓的宽度,以场景单位的百分之一计(默认 0:无)。

sheen_factor

颜色朝 sheen_direction 变亮的程度,取值从 -1 到 1(默认 0); 负值变暗。

sheen_direction

颜色变亮的方向(默认 UL)。

joint_type

描边在路径转折处的连接方式:圆角、斜切或斜接,按二维场景的绘制方式 (参见 LineJointType;默认 AUTO:斜接)。

cap_style

描边在其显示的每一端的端点样式(开放路径的端点、虚线的端点):圆头、平头 或方头,按二维场景的绘制方式(参见 CapStyleType;默认 AUTO:平头)。

shade_in_3d

三维场景的光是否对该 mobject 着色。

material

其表面在三维场景中如何反射场景的光(参见 Material);None:Manim 的着色(默认)。

name

mobject 的名称;未给出时为其类名。

z_index

其在绘制顺序中的位置:索引较高者绘制于较低者之上 (默认 0)。

target

MoveToTarget 将 mobject 移动至的状态。

源码

manimgx\mobjects\annotations.py

def __init__(
    self,
    obj: Mobject,
    text: str | Sequence[str],
    label_constructor: LabelMaker = Text,
    **kwargs: Unpack[BraceLabelOptions],
):
    super().__init__(obj, text, label_constructor=label_constructor, **kwargs)

边框与标记

SurroundingRectangle

代码
import manimgx as m


class SurroundingRectangleExample(m.Scene):
    def construct(self) -> None:
        formula = m.MathTex(r"e^{i\pi} + 1 = 0", font_size=96)
        words = m.Text("Euler's identity").next_to(formula, m.DOWN, buff=1)
        self.add(formula, words)
        self.play(
            m.Create(m.SurroundingRectangle(formula, buff=0.3)),
            m.Create(
                m.SurroundingRectangle(words, corner_radius=0.2, color=m.BLUE)
            ),
        )

围绕 mobject 的矩形:围绕它们的包围盒,将它们全部包含在内, 带有边距;亮黄色(PURE_YELLOW),除非另行设置样式。

其尺寸和位置在创建时确定,之后不再跟随这些 mobject。

m.SurroundingRectangle(*mobjects, buff=SMALL_BUFF, corner_radius=0.0, **kwargs)
*mobjects

要环绕的 mobject。

buff

围绕它们的边距,以场景单位表示:一个值用于所有边,或 (水平, 垂直)。

corner_radius

其圆角的半径,以场景单位表示:0 表示直角。

color

填充与描边共用的颜色(默认白色);None 表示该类的默认值。

fill_color

填充的颜色;未给出时为 color。多个颜色沿 sheen_direction 构成渐变。

fill_opacity

填充的不透明度,取值从 0 到 1(默认 0:无填充)。

stroke_color

描边的颜色;未给出时为 color。多个颜色构成渐变。

stroke_opacity

描边的不透明度,取值从 0 到 1(默认 1)。

stroke_width

描边的宽度,以场景单位的百分之一计(默认 4;0:无描边)。

background_stroke_color

绘制于填充之后的轮廓颜色(默认黑色)。

background_stroke_opacity

轮廓的不透明度,取值从 0 到 1(默认 1)。

background_stroke_width

轮廓的宽度,以场景单位的百分之一计(默认 0:无)。

sheen_factor

颜色朝 sheen_direction 变亮的程度,取值从 -1 到 1(默认 0); 负值变暗。

sheen_direction

颜色变亮的方向(默认 UL)。

joint_type

描边在路径转折处的连接方式:圆角、斜切或斜接,按二维场景的绘制方式 (参见 LineJointType;默认 AUTO:斜接)。

cap_style

描边在其显示的每一端的端点样式(开放路径的端点、虚线的端点):圆头、平头 或方头,按二维场景的绘制方式(参见 CapStyleType;默认 AUTO:平头)。

shade_in_3d

三维场景的光是否对该 mobject 着色。

material

其表面在三维场景中如何反射场景的光(参见 Material);None:Manim 的着色(默认)。

name

mobject 的名称;未给出时为其类名。

z_index

其在绘制顺序中的位置:索引较高者绘制于较低者之上 (默认 0)。

target

MoveToTarget 将 mobject 移动至的状态。

还接受 样式关键字。

源码

manimgx\mobjects\annotations.py

def __init__(
    self,
    *mobjects: Mobject,
    buff: float | tuple[float, float] = SMALL_BUFF,
    corner_radius: float = 0.0,
    **kwargs: Unpack[Style],
) -> None:
    if not all(isinstance(mob, Mobject) for mob in mobjects):
        raise TypeError(
            "Expected all inputs for parameter mobjects to be a Mobjects"
        )
    if isinstance(buff, tuple):
        buff_x = buff[0]
        buff_y = buff[1]
    else:
        buff_x = buff_y = buff
    box = _family_box(_family(mobjects))
    if box is None:
        box = np.zeros((2, 3))
    super().__init__(
        width=float(box[1, 0] - box[0, 0]) + 2 * buff_x,
        height=float(box[1, 1] - box[0, 1]) + 2 * buff_y,
        corner_radius=corner_radius,
        **kwargs,
    )
    self.buff = buff
    self.move_to((box[0] + box[1]) / 2)

BackgroundRectangle

BackgroundRectangleExample
代码
import manimgx as m


class BackgroundRectangleExample(m.Scene):
    def construct(self) -> None:
        bare = m.Text("on the grid", font_size=60).shift(3.5 * m.LEFT)
        backed = m.Text("on a background", font_size=60).shift(3.2 * m.RIGHT)
        background = m.BackgroundRectangle(backed, buff=0.2)
        self.add(m.NumberPlane(), bare, background, backed)

位于 mobject 后面的矩形,使用背景颜色且四分之三不透明, 使它们从背后的内容中凸显出来;没有轮廓线。

其颜色在创建时取场景的背景色,除非另行指定。它位于 mobject 之后:在它们之前将其添加到场景中。

m.BackgroundRectangle(*mobjects, buff=0, corner_radius=0.0, **kwargs)
*mobjects

要位于其后的 mobject。

buff

围绕它们的边距,以场景单位表示:一个值用于所有边,或 (水平, 垂直)。

corner_radius

其圆角的半径,以场景单位表示:0 表示直角。

color

填充与描边共用的颜色(默认白色);None 表示该类的默认值。

fill_color

填充的颜色;未给出时为 color。多个颜色沿 sheen_direction 构成渐变。

fill_opacity

填充的不透明度,取值从 0 到 1(默认 0:无填充)。

stroke_color

描边的颜色;未给出时为 color。多个颜色构成渐变。

stroke_opacity

描边的不透明度,取值从 0 到 1(默认 1)。

stroke_width

描边的宽度,以场景单位的百分之一计(默认 4;0:无描边)。

background_stroke_color

绘制于填充之后的轮廓颜色(默认黑色)。

background_stroke_opacity

轮廓的不透明度,取值从 0 到 1(默认 1)。

background_stroke_width

轮廓的宽度,以场景单位的百分之一计(默认 0:无)。

sheen_factor

颜色朝 sheen_direction 变亮的程度,取值从 -1 到 1(默认 0); 负值变暗。

sheen_direction

颜色变亮的方向(默认 UL)。

joint_type

描边在路径转折处的连接方式:圆角、斜切或斜接,按二维场景的绘制方式 (参见 LineJointType;默认 AUTO:斜接)。

cap_style

描边在其显示的每一端的端点样式(开放路径的端点、虚线的端点):圆头、平头 或方头,按二维场景的绘制方式(参见 CapStyleType;默认 AUTO:平头)。

shade_in_3d

三维场景的光是否对该 mobject 着色。

material

其表面在三维场景中如何反射场景的光(参见 Material);None:Manim 的着色(默认)。

name

mobject 的名称;未给出时为其类名。

z_index

其在绘制顺序中的位置:索引较高者绘制于较低者之上 (默认 0)。

target

MoveToTarget 将 mobject 移动至的状态。

还接受 样式关键字。

源码

manimgx\mobjects\annotations.py

def __init__(
    self,
    *mobjects: Mobject,
    buff: float | tuple[float, float] = 0,
    corner_radius: float = 0.0,
    **kwargs: Unpack[Style],
) -> None:
    if kwargs.get("color") is None:  # not given (None too): the scene's, when made
        kwargs["color"] = config.background_color
    super().__init__(*mobjects, buff=buff, corner_radius=corner_radius, **kwargs)
    self.original_fill_opacity: float = self.fill_opacity

FrameOptions

围绕 mobject 制作的矩形的关键字,作为 SurroundingRectangle 或 BackgroundRectangle 的是:其边距和其圆角, 以及样式关键字(适用于会传递它们的类)。

buff

围绕 mobject 的边距,以场景单位表示:一个值用于所有边,或 (水平, 垂直)(默认为:环绕矩形周围 0.1,背景矩形后面 0)。

corner_radius

矩形圆角的半径,以场景单位表示(默认 0:直角)。

color

填充与描边共用的颜色(默认白色);None 表示该类的默认值。

fill_color

填充的颜色;未给出时为 color。多个颜色沿 sheen_direction 构成渐变。

fill_opacity

填充的不透明度,取值从 0 到 1(默认 0:无填充)。

stroke_color

描边的颜色;未给出时为 color。多个颜色构成渐变。

stroke_opacity

描边的不透明度,取值从 0 到 1(默认 1)。

stroke_width

描边的宽度,以场景单位的百分之一计(默认 4;0:无描边)。

background_stroke_color

绘制于填充之后的轮廓颜色(默认黑色)。

background_stroke_opacity

轮廓的不透明度,取值从 0 到 1(默认 1)。

background_stroke_width

轮廓的宽度,以场景单位的百分之一计(默认 0:无)。

sheen_factor

颜色朝 sheen_direction 变亮的程度,取值从 -1 到 1(默认 0); 负值变暗。

sheen_direction

颜色变亮的方向(默认 UL)。

joint_type

描边在路径转折处的连接方式:圆角、斜切或斜接,按二维场景的绘制方式 (参见 LineJointType;默认 AUTO:斜接)。

cap_style

描边在其显示的每一端的端点样式(开放路径的端点、虚线的端点):圆头、平头 或方头,按二维场景的绘制方式(参见 CapStyleType;默认 AUTO:平头)。

shade_in_3d

三维场景的光是否对该 mobject 着色。

material

其表面在三维场景中如何反射场景的光(参见 Material);None:Manim 的着色(默认)。

name

mobject 的名称;未给出时为其类名。

z_index

其在绘制顺序中的位置:索引较高者绘制于较低者之上 (默认 0)。

target

MoveToTarget 将 mobject 移动至的状态。

buff

围绕 mobject 的边距,以场景单位表示:一个值用于所有边,或 (水平, 垂直)(默认为:环绕矩形周围 0.1,背景矩形后面 0)。

corner_radius

矩形圆角的半径,以场景单位表示(默认 0:直角)。

Underline

代码
import manimgx as m


class UnderlineExample(m.Scene):
    def construct(self) -> None:
        word = m.Text("important", font_size=120)
        self.add(word)
        self.play(m.Create(m.Underline(word, buff=0.2, color=m.YELLOW)))

位于 mobject 下方的线:与其等宽,在其下方 buff 处;白色,除非另行设置样式。

其尺寸和位置在创建时确定,之后不再跟随该 mobject。

m.Underline(mobject, buff=SMALL_BUFF, **kwargs)
mobject

要加下划线的 mobject。

buff

mobject 与线之间的间距,以场景单位表示。

path_arc

直线所弯曲的角度,以弧度计:0 为直;否则为从起点到终点的弧, 为正时逆时针(行进时向右弯),为负时顺时针(默认 0)。

color

填充和描边共用的颜色(默认白色;Circle 的为 红色);None 表示类的默认值。

tip_length

add_tip 所生成尖端的长度,以场景单位计 (默认 0.35;Arrow 的可能更短)。

normal_vector

路径所在平面的法向量(默认 OUT)。为兼容 Manim 而接受;被忽略且不保留。

tip_style

路径所生成尖端的样式关键字(默认 None:无)。除非在此给出,否则尖端的 fill_color 和 stroke_color 取路径的颜色。

fill_color

填充的颜色;未给出时为 color。多个颜色沿 sheen_direction 构成渐变。

fill_opacity

填充的不透明度,取值从 0 到 1(默认 0:无填充)。

stroke_color

描边的颜色;未给出时为 color。多个颜色构成渐变。

stroke_opacity

描边的不透明度,取值从 0 到 1(默认 1)。

stroke_width

描边的宽度,以场景单位的百分之一计(默认 4;0:无描边)。

background_stroke_color

绘制于填充之后的轮廓颜色(默认黑色)。

background_stroke_opacity

轮廓的不透明度,取值从 0 到 1(默认 1)。

background_stroke_width

轮廓的宽度,以场景单位的百分之一计(默认 0:无)。

sheen_factor

颜色朝 sheen_direction 变亮的程度,取值从 -1 到 1(默认 0); 负值变暗。

sheen_direction

颜色变亮的方向(默认 UL)。

joint_type

描边在路径转折处的连接方式:圆角、斜切或斜接,按二维场景的绘制方式 (参见 LineJointType;默认 AUTO:斜接)。

cap_style

描边在其显示的每一端的端点样式(开放路径的端点、虚线的端点):圆头、平头 或方头,按二维场景的绘制方式(参见 CapStyleType;默认 AUTO:平头)。

shade_in_3d

三维场景的光是否对该 mobject 着色。

material

其表面在三维场景中如何反射场景的光(参见 Material);None:Manim 的着色(默认)。

name

mobject 的名称;未给出时为其类名。

z_index

其在绘制顺序中的位置:索引较高者绘制于较低者之上 (默认 0)。

target

MoveToTarget 将 mobject 移动至的状态。

源码

manimgx\mobjects\annotations.py

def __init__(
    self, mobject: Mobject, buff: float = SMALL_BUFF, **kwargs: Unpack[Arced]
) -> None:
    super().__init__(LEFT, RIGHT, buff=buff, **kwargs)
    self.match_width(mobject)
    self.next_to(mobject, DOWN, buff=self.buff)

Cross

代码
import manimgx as m


class CrossExample(m.Scene):
    def construct(self) -> None:
        wrong = m.MathTex("2 + 2 = 5", font_size=96).shift(2 * m.RIGHT)
        self.add(m.Cross().shift(4 * m.LEFT), wrong)
        self.play(m.Create(m.Cross(wrong, scale_factor=1.2, color=m.YELLOW)))

叉号,即 X 形:从 mobject 包围盒的对角到对角的两条线,或 原点处边长为 2 的正方形的对角线;红色,宽 6,除非另行设置样式。

m.Cross(mobject=None, stroke_color=RED, stroke_width=6.0, scale_factor=1.0, color=None, **kwargs)
mobject

要划叉的 mobject:叉号被拉伸覆盖其包围盒;None 表示不针对任何对象。

stroke_color

其线条的颜色。

stroke_width

其线条的宽度,以百分之一场景单位表示。

scale_factor

相对包围盒(或正方形)放大的倍数, 以其中心为基准。

color

其线条的颜色,代替 stroke_color;None 表示使用前者。

background_stroke_color

绘制于填充之后的轮廓颜色(默认黑色)。

background_stroke_opacity

轮廓的不透明度,取值从 0 到 1(默认 1)。

background_stroke_width

轮廓的宽度,以场景单位的百分之一计(默认 0:无)。

sheen_factor

颜色朝 sheen_direction 变亮的程度,取值从 -1 到 1(默认 0); 负值变暗。

sheen_direction

颜色变亮的方向(默认 UL)。

joint_type

描边在路径转折处的连接方式:圆角、斜切或斜接,按二维场景的绘制方式 (参见 LineJointType;默认 AUTO:斜接)。

cap_style

描边在其显示的每一端的端点样式(开放路径的端点、虚线的端点):圆头、平头 或方头,按二维场景的绘制方式(参见 CapStyleType;默认 AUTO:平头)。

shade_in_3d

三维场景的光是否对该 mobject 着色。

material

其表面在三维场景中如何反射场景的光(参见 Material);None:Manim 的着色(默认)。

name

mobject 的名称;未给出时为其类名。

z_index

其在绘制顺序中的位置:索引较高者绘制于较低者之上 (默认 0)。

target

MoveToTarget 将 mobject 移动至的状态。

还接受 样式关键字。

源码

manimgx\mobjects\annotations.py

def __init__(
    self,
    mobject: Mobject | None = None,
    stroke_color: ParsableManimColor = RED,
    stroke_width: float = 6.0,
    scale_factor: float = 1.0,
    color: ParsableManimColor | None = None,
    **kwargs: Unpack[Look],
) -> None:
    super().__init__(
        Line(UP + LEFT, DOWN + RIGHT), Line(UP + RIGHT, DOWN + LEFT), **kwargs
    )
    if mobject is not None:
        self.replace(mobject, stretch=True)
    self.scale(scale_factor)
    self.set_stroke(
        color=stroke_color if color is None else color, width=stroke_width
    )

AnnotationDot

AnnotationDotExample
代码
import manimgx as m


class AnnotationDotExample(m.Scene):
    def construct(self) -> None:
        arc = m.Arc(radius=3, angle=m.PI, color=m.GREY).shift(1.5 * m.DOWN)
        start = m.AnnotationDot(point=arc.get_start())
        end = m.AnnotationDot(point=arc.get_end())
        top = m.AnnotationDot(
            0.25, point=arc.get_top(), fill_color=m.YELLOW, stroke_color=m.RED
        )
        self.add(arc, start, end, top)

用于标记点的点:比 Dot 略大,未加样式时为蓝色 且带粗白色轮廓。

其颜色为 fill_color 和 stroke_color,color 不会改变它们。

m.AnnotationDot(radius=DEFAULT_DOT_RADIUS * 1.3, *, point=ORIGIN, **kwargs)
radius

其半径,以场景单位计(默认 0.104,为点的 1.3 倍)。

point

其圆心所在位置。

color

填充和描边共用的颜色(默认白色;Circle 的为 红色);None 表示类的默认值。

tip_length

add_tip 所生成尖端的长度,以场景单位计 (默认 0.35;Arrow 的可能更短)。

normal_vector

路径所在平面的法向量(默认 OUT)。为兼容 Manim 而接受;被忽略且不保留。

tip_style

路径所生成尖端的样式关键字(默认 None:无)。除非在此给出,否则尖端的 fill_color 和 stroke_color 取路径的颜色。

fill_color

填充的颜色;未给出时为 color。多个颜色沿 sheen_direction 构成渐变。

fill_opacity

填充的不透明度,取值从 0 到 1(默认 0:无填充)。

stroke_color

描边的颜色;未给出时为 color。多个颜色构成渐变。

stroke_opacity

描边的不透明度,取值从 0 到 1(默认 1)。

stroke_width

描边的宽度,以场景单位的百分之一计(默认 4;0:无描边)。

background_stroke_color

绘制于填充之后的轮廓颜色(默认黑色)。

background_stroke_opacity

轮廓的不透明度,取值从 0 到 1(默认 1)。

background_stroke_width

轮廓的宽度,以场景单位的百分之一计(默认 0:无)。

sheen_factor

颜色朝 sheen_direction 变亮的程度,取值从 -1 到 1(默认 0); 负值变暗。

sheen_direction

颜色变亮的方向(默认 UL)。

joint_type

描边在路径转折处的连接方式:圆角、斜切或斜接,按二维场景的绘制方式 (参见 LineJointType;默认 AUTO:斜接)。

cap_style

描边在其显示的每一端的端点样式(开放路径的端点、虚线的端点):圆头、平头 或方头,按二维场景的绘制方式(参见 CapStyleType;默认 AUTO:平头)。

shade_in_3d

三维场景的光是否对该 mobject 着色。

material

其表面在三维场景中如何反射场景的光(参见 Material);None:Manim 的着色(默认)。

name

mobject 的名称;未给出时为其类名。

z_index

其在绘制顺序中的位置:索引较高者绘制于较低者之上 (默认 0)。

target

MoveToTarget 将 mobject 移动至的状态。

还接受 箭头关键字。

源码

manimgx\mobjects\shapes.py

def __init__(
    self,
    radius: float = DEFAULT_DOT_RADIUS * 1.3,
    *,
    point: Point3DLike = ORIGIN,
    **kwargs: Unpack[Tipped],
) -> None:
    super().__init__(point=point, radius=radius, **kwargs)

标签

Label

LabelExample
代码
import manimgx as m


class LabelExample(m.Scene):
    def construct(self) -> None:
        plain = m.Label("x^2 + y^2 = r^2")
        styled = m.Label(
            m.Text("a label", color=m.YELLOW),
            box_config={"color": m.BLUE, "buff": 0.2},
            frame_config={"color": m.YELLOW, "stroke_width": 4, "buff": 0.2},
        )
        self.add(m.VGroup(plain, styled).arrange(m.DOWN, buff=1).scale(2))

位于背景之上、边框之中的标签:文本或数学式,置于一个使用背景色 的不透明矩形之上,外围有一圈细白色轮廓。

字符串会被排版为数学式,白色,字号 48(参见 MathTex);文本或数学 mobject 则按原样使用。其各部分 为其子 mobject,按绘制顺序排列:其 background_rect、其 rendered_label 和其 frame。

m.Label(label, label_config=None, box_config=None, frame_config=None, **kwargs)
label

标签:一个字符串,排版为数学式,或一个文本/数学 mobject。

label_config

针对字符串 标签的 MathTex 关键字, 默认为白色、字号 48。

box_config

针对背景的 环绕矩形关键字, 默认边距 0.05 且不透明填充(参见 BackgroundRectangle)。

frame_config

针对边框的 环绕矩形关键字, 默认白色、边距 0.05 且宽 0.5 的轮廓线。

color

填充与描边共用的颜色(默认白色);None 表示该类的默认值。

fill_color

填充的颜色;未给出时为 color。多个颜色沿 sheen_direction 构成渐变。

fill_opacity

填充的不透明度,取值从 0 到 1(默认 0:无填充)。

stroke_color

描边的颜色;未给出时为 color。多个颜色构成渐变。

stroke_opacity

描边的不透明度,取值从 0 到 1(默认 1)。

stroke_width

描边的宽度,以场景单位的百分之一计(默认 4;0:无描边)。

background_stroke_color

绘制于填充之后的轮廓颜色(默认黑色)。

background_stroke_opacity

轮廓的不透明度,取值从 0 到 1(默认 1)。

background_stroke_width

轮廓的宽度,以场景单位的百分之一计(默认 0:无)。

sheen_factor

颜色朝 sheen_direction 变亮的程度,取值从 -1 到 1(默认 0); 负值变暗。

sheen_direction

颜色变亮的方向(默认 UL)。

joint_type

描边在路径转折处的连接方式:圆角、斜切或斜接,按二维场景的绘制方式 (参见 LineJointType;默认 AUTO:斜接)。

cap_style

描边在其显示的每一端的端点样式(开放路径的端点、虚线的端点):圆头、平头 或方头,按二维场景的绘制方式(参见 CapStyleType;默认 AUTO:平头)。

shade_in_3d

三维场景的光是否对该 mobject 着色。

material

其表面在三维场景中如何反射场景的光(参见 Material);None:Manim 的着色(默认)。

name

mobject 的名称;未给出时为其类名。

z_index

其在绘制顺序中的位置:索引较高者绘制于较低者之上 (默认 0)。

target

MoveToTarget 将 mobject 移动至的状态。

还接受 样式关键字。

源码

manimgx\mobjects\annotations.py

def __init__(
    self,
    label: str | ManimTextLabel,
    label_config: MathTexOptions | None = None,
    box_config: FrameOptions | None = None,
    frame_config: FrameOptions | None = None,
    **kwargs: Unpack[Style],
) -> None:
    super().__init__(**kwargs)
    label_style = MathTexOptions(color=WHITE, font_size=DEFAULT_FONT_SIZE) | (
        label_config or MathTexOptions()
    )
    box_style = FrameOptions(buff=0.05, fill_opacity=1, stroke_width=0.5) | (
        box_config or FrameOptions()
    )
    frame_style = FrameOptions(color=WHITE, buff=0.05, stroke_width=0.5) | (
        frame_config or FrameOptions()
    )
    if isinstance(label, str):
        self.rendered_label: ManimTextLabel = MathTex(label, **label_style)
        """标签的文本或数学式,一个子 mobject。"""
    elif isinstance(label, Typst):
        self.rendered_label = label
    else:
        raise TypeError(
            "Unsupported label type. Must be MathTex, Tex, Text or Typst."
        )
    self.background_rect = BackgroundRectangle(self.rendered_label, **box_style)
    """标签背后的矩形,一个子 mobject。"""
    self.frame = SurroundingRectangle(self.rendered_label, **frame_style)
    """标签外围的轮廓,一个子 mobject。"""
    self.add(self.background_rect, self.rendered_label, self.frame)

rendered_label

标签的文本或数学式,一个子 mobject。

background_rect

标签背后的矩形,一个子 mobject。

frame

标签外围的轮廓,一个子 mobject。

LabeledDot

LabeledDotExample
代码
import manimgx as m


class LabeledDotExample(m.Scene):
    def construct(self) -> None:
        dots = m.VGroup(
            m.LabeledDot("A"),
            m.LabeledDot("42", color=m.BLUE),
            m.LabeledDot(m.MathTex(r"\alpha"), color=m.PURPLE, radius=0.5),
            m.LabeledDot(m.Text("hi", color=m.BLACK), color=m.YELLOW),
        ).arrange(buff=1)
        self.add(dots.scale(2))

中间带标签的点:一个刚好能容纳标签的圆盘,除非给定半径; 白色,无轮廓线,除非另行设置样式。

它在原点处创建,标签居中于其上,是其子 mobject。

m.LabeledDot(label, radius=None, buff=SMALL_BUFF, **kwargs)
label

标签:一个字符串,排版为黑色的数学式(参见 MathTex),或一个 mobject,按原样使用。

radius

其半径,以场景单位表示;None 表示标签包围盒对角线的一半 加 buff。

buff

当半径适配标签时,标签各角与点边缘之间的边距,以场景 单位表示。

color

填充和描边共用的颜色(默认白色;Circle 的为 红色);None 表示类的默认值。

tip_length

add_tip 所生成尖端的长度,以场景单位计 (默认 0.35;Arrow 的可能更短)。

normal_vector

路径所在平面的法向量(默认 OUT)。为兼容 Manim 而接受;被忽略且不保留。

tip_style

路径所生成尖端的样式关键字(默认 None:无)。除非在此给出,否则尖端的 fill_color 和 stroke_color 取路径的颜色。

fill_color

填充的颜色;未给出时为 color。多个颜色沿 sheen_direction 构成渐变。

fill_opacity

填充的不透明度,取值从 0 到 1(默认 0:无填充)。

stroke_color

描边的颜色;未给出时为 color。多个颜色构成渐变。

stroke_opacity

描边的不透明度,取值从 0 到 1(默认 1)。

stroke_width

描边的宽度,以场景单位的百分之一计(默认 4;0:无描边)。

background_stroke_color

绘制于填充之后的轮廓颜色(默认黑色)。

background_stroke_opacity

轮廓的不透明度,取值从 0 到 1(默认 1)。

background_stroke_width

轮廓的宽度,以场景单位的百分之一计(默认 0:无)。

sheen_factor

颜色朝 sheen_direction 变亮的程度,取值从 -1 到 1(默认 0); 负值变暗。

sheen_direction

颜色变亮的方向(默认 UL)。

joint_type

描边在路径转折处的连接方式:圆角、斜切或斜接,按二维场景的绘制方式 (参见 LineJointType;默认 AUTO:斜接)。

cap_style

描边在其显示的每一端的端点样式(开放路径的端点、虚线的端点):圆头、平头 或方头,按二维场景的绘制方式(参见 CapStyleType;默认 AUTO:平头)。

shade_in_3d

三维场景的光是否对该 mobject 着色。

material

其表面在三维场景中如何反射场景的光(参见 Material);None:Manim 的着色(默认)。

name

mobject 的名称;未给出时为其类名。

z_index

其在绘制顺序中的位置:索引较高者绘制于较低者之上 (默认 0)。

target

MoveToTarget 将 mobject 移动至的状态。

还接受 箭头关键字。

源码

manimgx\mobjects\annotations.py

def __init__(
    self,
    label: str | Mobject,
    radius: float | None = None,
    buff: float = SMALL_BUFF,
    **kwargs: Unpack[Tipped],
) -> None:
    if isinstance(label, str):
        from manimgx.mobjects.text import MathTex

        rendered_label: Mobject = MathTex(label, color=BLACK)
    else:
        rendered_label = label
    if radius is None:
        radius = buff + float(
            np.linalg.norm([rendered_label.width, rendered_label.height]) / 2
        )
    super().__init__(radius=radius, **kwargs)
    rendered_label.move_to(self.get_center())
    self.add(rendered_label)

LabeledLine

LabeledLineExample
代码
import manimgx as m


class LabeledLineExample(m.Scene):
    def construct(self) -> None:
        a, b, c = [-4, -2, 0], [4, -2, 0], [4, 2.5, 0]
        sides = m.VGroup(
            m.LabeledLine("8", start=a, end=b, color=m.BLUE),
            m.LabeledLine("4.5", start=b, end=c, color=m.GREEN),
            m.LabeledLine("c", start=c, end=a, label_position=0.4),
        )
        self.add(sides)

带有标签的线:一个 Label 居中于从线的起点到终点 沿途 label_position 比例处;白色,除非另行设置样式。

标签是一个子 mobject,即线的 label。它 被放置在两端之间的直线路径上,即使线是弯折的也是如此。

m.LabeledLine(label, label_position=0.5, label_config=None, box_config=None, frame_config=None, *, start=LEFT, end=RIGHT, **kwargs)
label

标签:一个字符串,排版为数学式,或一个文本/数学 mobject。

label_position

标签的位置,以从线的起点 (0) 到终点 (1) 的 比例表示。

label_config

针对字符串 标签的 MathTex 关键字 (参见 Label)。

box_config

针对标签背景的 环绕矩形关键字。

frame_config

针对标签边框的 环绕矩形关键字。

start

线的起点:一个点,或一个 mobject(参见 Line)。

end

线的终点:一个点,或一个 mobject。

buff

直线距每端缩短多少,以场景单位计;短于两倍它的直线保留其端点(默认 0)。

path_arc

直线所弯曲的角度,以弧度计:0 为直;否则为从起点到终点的弧, 为正时逆时针(行进时向右弯),为负时顺时针(默认 0)。

color

填充和描边共用的颜色(默认白色;Circle 的为 红色);None 表示类的默认值。

tip_length

add_tip 所生成尖端的长度,以场景单位计 (默认 0.35;Arrow 的可能更短)。

normal_vector

路径所在平面的法向量(默认 OUT)。为兼容 Manim 而接受;被忽略且不保留。

tip_style

路径所生成尖端的样式关键字(默认 None:无)。除非在此给出,否则尖端的 fill_color 和 stroke_color 取路径的颜色。

fill_color

填充的颜色;未给出时为 color。多个颜色沿 sheen_direction 构成渐变。

fill_opacity

填充的不透明度,取值从 0 到 1(默认 0:无填充)。

stroke_color

描边的颜色;未给出时为 color。多个颜色构成渐变。

stroke_opacity

描边的不透明度,取值从 0 到 1(默认 1)。

stroke_width

描边的宽度,以场景单位的百分之一计(默认 4;0:无描边)。

background_stroke_color

绘制于填充之后的轮廓颜色(默认黑色)。

background_stroke_opacity

轮廓的不透明度,取值从 0 到 1(默认 1)。

background_stroke_width

轮廓的宽度,以场景单位的百分之一计(默认 0:无)。

sheen_factor

颜色朝 sheen_direction 变亮的程度,取值从 -1 到 1(默认 0); 负值变暗。

sheen_direction

颜色变亮的方向(默认 UL)。

joint_type

描边在路径转折处的连接方式:圆角、斜切或斜接,按二维场景的绘制方式 (参见 LineJointType;默认 AUTO:斜接)。

cap_style

描边在其显示的每一端的端点样式(开放路径的端点、虚线的端点):圆头、平头 或方头,按二维场景的绘制方式(参见 CapStyleType;默认 AUTO:平头)。

shade_in_3d

三维场景的光是否对该 mobject 着色。

material

其表面在三维场景中如何反射场景的光(参见 Material);None:Manim 的着色(默认)。

name

mobject 的名称;未给出时为其类名。

z_index

其在绘制顺序中的位置:索引较高者绘制于较低者之上 (默认 0)。

target

MoveToTarget 将 mobject 移动至的状态。

源码

manimgx\mobjects\annotations.py

def __init__(
    self,
    label: str | ManimTextLabel,
    label_position: float = 0.5,
    label_config: MathTexOptions | None = None,
    box_config: FrameOptions | None = None,
    frame_config: FrameOptions | None = None,
    *,
    start: Point3DLike | Mobject = LEFT,
    end: Point3DLike | Mobject = RIGHT,
    **kwargs: Unpack[LineOptions],
) -> None:
    super().__init__(start, end, **kwargs)
    self.label = Label(
        label=label,
        label_config=label_config,
        box_config=box_config,
        frame_config=frame_config,
    )
    """标签,一个子 mobject。"""
    line_start, line_end = self.get_start_and_end()
    self.label.move_to(line_start + (line_end - line_start) * label_position)
    self.add(self.label)

label

标签,一个子 mobject。

LabeledArrow

LabeledArrowExample
代码
import manimgx as m


class LabeledArrowExample(m.Scene):
    def construct(self) -> None:
        arrows = m.VGroup(
            m.LabeledArrow("F", start=4 * m.LEFT, end=4 * m.RIGHT),
            m.LabeledArrow(
                "0.5",
                label_position=0.3,
                start=3 * m.LEFT + m.DOWN,
                end=3 * m.RIGHT + 2 * m.UP,
                color=m.YELLOW,
            ),
        ).arrange(m.DOWN, buff=1)
        self.add(arrows)

带有标签的箭头:一个作为 Arrow 的 LabeledLine,在其两端各留 0.25 的间距,除非另行指定 buff;白色,除非另行设置样式。

m.LabeledArrow(label, label_position=0.5, label_config=None, box_config=None, frame_config=None, *, start=LEFT, end=RIGHT, **kwargs)
label

标签:一个字符串,排版为数学式,或一个文本/数学 mobject。

label_position

标签的位置,以从箭头起点 (0) 到箭尖点 (1) 的 比例表示。

label_config

针对字符串 标签的 MathTex 关键字 (参见 Label)。

box_config

针对标签背景的 环绕矩形关键字。

frame_config

针对标签边框的 环绕矩形关键字。

start

箭头的起点:一个点,或一个 mobject(参见 Line)。

end

箭头指向的位置:一个点,或一个 mobject。

buff

直线距每端缩短多少,以场景单位计;短于两倍它的直线保留其端点(默认 0)。

path_arc

直线所弯曲的角度,以弧度计:0 为直;否则为从起点到终点的弧, 为正时逆时针(行进时向右弯),为负时顺时针(默认 0)。

color

填充和描边共用的颜色(默认白色;Circle 的为 红色);None 表示类的默认值。

tip_length

add_tip 所生成尖端的长度,以场景单位计 (默认 0.35;Arrow 的可能更短)。

normal_vector

路径所在平面的法向量(默认 OUT)。为兼容 Manim 而接受;被忽略且不保留。

tip_style

路径所生成尖端的样式关键字(默认 None:无)。除非在此给出,否则尖端的 fill_color 和 stroke_color 取路径的颜色。

fill_color

填充的颜色;未给出时为 color。多个颜色沿 sheen_direction 构成渐变。

fill_opacity

填充的不透明度,取值从 0 到 1(默认 0:无填充)。

stroke_color

描边的颜色;未给出时为 color。多个颜色构成渐变。

stroke_opacity

描边的不透明度,取值从 0 到 1(默认 1)。

stroke_width

描边的宽度,以场景单位的百分之一计(默认 4;0:无描边)。

background_stroke_color

绘制于填充之后的轮廓颜色(默认黑色)。

background_stroke_opacity

轮廓的不透明度,取值从 0 到 1(默认 1)。

background_stroke_width

轮廓的宽度,以场景单位的百分之一计(默认 0:无)。

sheen_factor

颜色朝 sheen_direction 变亮的程度,取值从 -1 到 1(默认 0); 负值变暗。

sheen_direction

颜色变亮的方向(默认 UL)。

joint_type

描边在路径转折处的连接方式:圆角、斜切或斜接,按二维场景的绘制方式 (参见 LineJointType;默认 AUTO:斜接)。

cap_style

描边在其显示的每一端的端点样式(开放路径的端点、虚线的端点):圆头、平头 或方头,按二维场景的绘制方式(参见 CapStyleType;默认 AUTO:平头)。

shade_in_3d

三维场景的光是否对该 mobject 着色。

material

其表面在三维场景中如何反射场景的光(参见 Material);None:Manim 的着色(默认)。

name

mobject 的名称;未给出时为其类名。

z_index

其在绘制顺序中的位置:索引较高者绘制于较低者之上 (默认 0)。

target

MoveToTarget 将 mobject 移动至的状态。

源码

manimgx\mobjects\annotations.py

def __init__(
    self,
    label: str | ManimTextLabel,
    label_position: float = 0.5,
    label_config: MathTexOptions | None = None,
    box_config: FrameOptions | None = None,
    frame_config: FrameOptions | None = None,
    *,
    start: Point3DLike | Mobject = LEFT,
    end: Point3DLike | Mobject = RIGHT,
    **kwargs: Unpack[LineOptions],
) -> None:
    super().__init__(start, end, **kwargs)
    self.label = Label(
        label=label,
        label_config=label_config,
        box_config=box_config,
        frame_config=frame_config,
    )
    """标签,一个子 mobject。"""
    line_start, line_end = self.get_start_and_end()
    self.label.move_to(line_start + (line_end - line_start) * label_position)
    self.add(self.label)

LabeledPolygram

LabeledPolygramExample
代码
import manimgx as m


class LabeledPolygramExample(m.Scene):
    def construct(self) -> None:
        outline = [[-6, -3, 0], [5, -3, 0], [6, 3, 0], [0, 0.5, 0], [-5, 3, 0]]
        hole = [[0, -2, 0], [0, -0.5, 0], [4, -0.5, 0], [4, -2, 0]]
        shape = m.LabeledPolygram(outline, hole, label="P", fill_opacity=0.3)
        reach = m.Circle(shape.radius, color=m.YELLOW).move_to(shape.pole)
        self.add(shape, reach)

带有内部标签的多边形,标签位于其不可及极点处:即 其内部距离边缘最远的点,在 precision 精度内求得;蓝色,除非另行设置样式。

第一组顶点为其外轮廓,其余各组为孔洞,标签会被排除在这些孔洞之外。标签 是一个子 mobject,即 label; pole 为其所在位置,radius 为该位置到最近边缘的距离。

m.LabeledPolygram(*vertex_groups, label, precision=0.01, label_config=None, box_config=None, frame_config=None, **kwargs)
*vertex_groups

各顶点组,每组为一条闭合路径(参见 Polygram):先外轮廓,再其孔洞。

label

标签:一个字符串,排版为数学式,或一个文本/数学 mobject。

precision

多边形边缘最大距离所允许的误差, 以场景单位表示。多个标签位置都可能满足此半径容差。

label_config

针对字符串 标签的 MathTex 关键字 (参见 Label)。

box_config

针对标签背景的 环绕矩形关键字。

frame_config

针对标签边框的 环绕矩形关键字。

color

填充与描边共用的颜色(默认白色);None 表示该类的默认值。

fill_color

填充的颜色;未给出时为 color。多个颜色沿 sheen_direction 构成渐变。

fill_opacity

填充的不透明度,取值从 0 到 1(默认 0:无填充)。

stroke_color

描边的颜色;未给出时为 color。多个颜色构成渐变。

stroke_opacity

描边的不透明度,取值从 0 到 1(默认 1)。

stroke_width

描边的宽度,以场景单位的百分之一计(默认 4;0:无描边)。

background_stroke_color

绘制于填充之后的轮廓颜色(默认黑色)。

background_stroke_opacity

轮廓的不透明度,取值从 0 到 1(默认 1)。

background_stroke_width

轮廓的宽度,以场景单位的百分之一计(默认 0:无)。

sheen_factor

颜色朝 sheen_direction 变亮的程度,取值从 -1 到 1(默认 0); 负值变暗。

sheen_direction

颜色变亮的方向(默认 UL)。

joint_type

描边在路径转折处的连接方式:圆角、斜切或斜接,按二维场景的绘制方式 (参见 LineJointType;默认 AUTO:斜接)。

cap_style

描边在其显示的每一端的端点样式(开放路径的端点、虚线的端点):圆头、平头 或方头,按二维场景的绘制方式(参见 CapStyleType;默认 AUTO:平头)。

shade_in_3d

三维场景的光是否对该 mobject 着色。

material

其表面在三维场景中如何反射场景的光(参见 Material);None:Manim 的着色(默认)。

name

mobject 的名称;未给出时为其类名。

z_index

其在绘制顺序中的位置:索引较高者绘制于较低者之上 (默认 0)。

target

MoveToTarget 将 mobject 移动至的状态。

还接受 样式关键字。

源码

manimgx\mobjects\annotations.py

def __init__(
    self,
    *vertex_groups: Point3DLike_Array,
    label: str | ManimTextLabel,
    precision: float = 0.01,
    label_config: MathTexOptions | None = None,
    box_config: FrameOptions | None = None,
    frame_config: FrameOptions | None = None,
    **kwargs: Unpack[Style],
) -> None:
    super().__init__(*vertex_groups, **kwargs)
    self.label = Label(
        label=label,
        label_config=label_config,
        box_config=box_config,
        frame_config=frame_config,
    )
    """标签,一个子 mobject。"""
    rings = []
    for group in vertex_groups:
        ring = np.asarray(group, dtype=float)
        rings.append(
            ring
            if np.array_equal(ring[0], ring[-1])
            else np.vstack([ring, ring[:1]])
        )
    cell = polylabel(rings, precision=precision)
    self.pole, self.radius = (np.pad(cell.c, (0, 1), "constant"), cell.d)
    self.label.move_to(self.pole)
    self.add(self.label)

label

标签,一个子 mobject。

角

Angle

AngleExample
代码
import manimgx as m


class AngleExample(m.Scene):
    def construct(self) -> None:
        line1 = m.Line(1.2 * m.LEFT, 1.2 * m.RIGHT)
        line2 = m.Line(1.2 * m.DOWN, 1.2 * m.UP).rotate(-30 * m.DEGREES)
        angles = [
            m.Angle(line1, line2, color=m.YELLOW),
            m.Angle(line1, line2, quadrant=(-1, 1), color=m.BLUE),
            m.Angle(line1, line2, other_angle=True, color=m.GREEN),
            m.Angle(line1, line2, dot=True, color=m.RED),
        ]
        labels = ["default", "quadrant=(-1, 1)", "other_angle=True", "dot=True"]
        panels = m.VGroup()
        for angle in angles:
            panels.add(m.VGroup(line1.copy(), line2.copy(), angle))
        panels.arrange(buff=1)
        for panel, label in zip(panels, labels):
            text = m.Text(label, font_size=24).next_to(panel, m.DOWN)
            self.add(panel, text)

两直线间角的标记:关于其交叉点的弧,从沿第一条直线的一侧逆时针到沿第二条 直线的一侧;未加样式时为白色。

直线被视为无限长,因此无需到达交叉点。从交叉点起,quadrant 选择每侧沿其直线 的方向,other_angle 改为顺时针,标记整圈的其余部分:两者共同选择所标记的角, 可超过半圈。带 elbow 时,标记为两段线段,在两侧间成角,如直角标记。屏幕平面 内的平行线产生空标记,值为 0。

m.Angle(line1, line2, radius=None, quadrant=(1, 1), other_angle=False, dot=False, dot_radius=None, dot_distance=0.55, dot_color=WHITE, elbow=False, **kwargs)
line1

角所从测量的直线。

line2

角所至测量的直线。

radius

弧的半径,或直角标记的边长,以场景单位计;None 表示 0.4,或短直线时 为从交叉点到侧所指较近端距离的三分之二,当其小于 0.6 时。

quadrant

每侧从交叉点出发的方向:每条线一个符号,line1 在前;1 沿该线 方向(从其起点指向终点),-1 则反向指向起点。

other_angle

弧是否改为从第一侧到第二侧顺时针运行,标记整圈的其余部分。

dot

是否在弧内放一个点(直角标记无点)。

dot_radius

点的半径,以场景单位计;None 表示弧半径的十分之一。

dot_distance

点距交叉点多远,以弧半径的分数计。

dot_color

点的颜色。

elbow

是否用直角标记代替弧标记角。

color

填充与描边共用的颜色(默认白色);None 表示该类的默认值。

fill_color

填充的颜色;未给出时为 color。多个颜色沿 sheen_direction 构成渐变。

fill_opacity

填充的不透明度,取值从 0 到 1(默认 0:无填充)。

stroke_color

描边的颜色;未给出时为 color。多个颜色构成渐变。

stroke_opacity

描边的不透明度,取值从 0 到 1(默认 1)。

stroke_width

描边的宽度,以场景单位的百分之一计(默认 4;0:无描边)。

background_stroke_color

绘制于填充之后的轮廓颜色(默认黑色)。

background_stroke_opacity

轮廓的不透明度,取值从 0 到 1(默认 1)。

background_stroke_width

轮廓的宽度,以场景单位的百分之一计(默认 0:无)。

sheen_factor

颜色朝 sheen_direction 变亮的程度,取值从 -1 到 1(默认 0); 负值变暗。

sheen_direction

颜色变亮的方向(默认 UL)。

joint_type

描边在路径转折处的连接方式:圆角、斜切或斜接,按二维场景的绘制方式 (参见 LineJointType;默认 AUTO:斜接)。

cap_style

描边在其显示的每一端的端点样式(开放路径的端点、虚线的端点):圆头、平头 或方头,按二维场景的绘制方式(参见 CapStyleType;默认 AUTO:平头)。

shade_in_3d

三维场景的光是否对该 mobject 着色。

material

其表面在三维场景中如何反射场景的光(参见 Material);None:Manim 的着色(默认)。

name

mobject 的名称;未给出时为其类名。

z_index

其在绘制顺序中的位置:索引较高者绘制于较低者之上 (默认 0)。

target

MoveToTarget 将 mobject 移动至的状态。

还接受 样式关键字。

源码

manimgx\mobjects\shapes.py

def __init__(
    self,
    line1: Line,
    line2: Line,
    radius: float | None = None,
    quadrant: AngleQuadrant = (1, 1),
    other_angle: bool = False,
    dot: bool = False,
    dot_radius: float | None = None,
    dot_distance: float = 0.55,
    dot_color: ParsableManimColor = WHITE,
    elbow: bool = False,
    **kwargs: Unpack[Style],
) -> None:
    super().__init__(**kwargs)
    self.lines = (line1, line2)
    self.quadrant = quadrant
    self.dot_distance = dot_distance
    self.elbow = elbow
    try:
        inter = line_intersection(
            [line1.get_start(), line1.get_end()],
            [line2.get_start(), line2.get_end()],
        )
    except ValueError:
        lines_are_in_xy_plane = all(
            point[2] == 0
            for line in (line1, line2)
            for point in (line.get_start(), line.get_end())
        )
        directions_are_parallel = (
            np.cross(line1.get_vector(), line2.get_vector())[2] == 0
        )
        if not (lines_are_in_xy_plane and directions_are_parallel):
            raise
        self.angle_value = 0.0
        return
    if radius is None:
        if quadrant[0] == 1:
            dist_1 = np.linalg.norm(line1.get_end() - inter)
        else:
            dist_1 = np.linalg.norm(line1.get_start() - inter)
        if quadrant[1] == 1:
            dist_2 = np.linalg.norm(line2.get_end() - inter)
        else:
            dist_2 = np.linalg.norm(line2.get_start() - inter)
        radius = (
            float(2 / 3 * min(dist_1, dist_2)) if min(dist_1, dist_2) < 0.6 else 0.4
        )
    else:
        self.radius = radius
    anchor_angle_1 = inter + quadrant[0] * radius * line1.get_unit_vector()
    anchor_angle_2 = inter + quadrant[1] * radius * line2.get_unit_vector()
    if elbow:
        anchor_middle = (
            inter
            + quadrant[0] * radius * line1.get_unit_vector()
            + quadrant[1] * radius * line2.get_unit_vector()
        )
        angle_mobject: VMobject = Elbow(**kwargs)
        angle_mobject.set_points_as_corners(
            np.array([anchor_angle_1, anchor_middle, anchor_angle_2])
        )
    else:
        angle_1 = angle_of_vector(anchor_angle_1 - inter)
        angle_2 = angle_of_vector(anchor_angle_2 - inter)
        if not other_angle:
            start_angle = angle_1
            if angle_2 > angle_1:
                angle_fin = angle_2 - angle_1
            else:
                angle_fin = 2 * np.pi - (angle_1 - angle_2)
        else:
            start_angle = angle_1
            if angle_2 < angle_1:
                angle_fin = -angle_1 + angle_2
            else:
                angle_fin = -2 * np.pi + (angle_2 - angle_1)
        self.angle_value = angle_fin
        angle_mobject = Arc(
            radius=radius,
            angle=self.angle_value,
            start_angle=start_angle,
            arc_center=inter,
            **kwargs,
        )
        if dot:
            if dot_radius is None:
                dot_radius = radius / 10
            else:
                self.dot_radius = dot_radius
            right_dot = Dot(ORIGIN, radius=dot_radius, color=dot_color)
            dot_anchor = (
                inter
                + (angle_mobject.get_center() - inter)
                / np.linalg.norm(angle_mobject.get_center() - inter)
                * radius
                * dot_distance
            )
            right_dot.move_to(dot_anchor)
            self.add(right_dot)
    self.set_points(angle_mobject.points)

get_lines

角所介于的两条直线。

angle.get_lines()

返回 两直线的新组,line1 在前。

源码

manimgx\mobjects\shapes.py

def get_lines(self) -> VGroup:
    """角所介于的两条直线。

    Returns:
        两直线的新组,`line1` 在前。
    """
    return VGroup(*self.lines)

get_value

所标记角的大小:从第一侧到第二侧逆时针,或带 other_angle 时顺时针且为负。

以直角标记的角无值:查询它会引发异常。

angle.get_value(degrees=False)
degrees

是否以度而非弧度给出。

返回 角,以弧度(或度)计,范围 -TAU 到 TAU。

源码

manimgx\mobjects\shapes.py

def get_value(self, degrees: bool = False) -> float:
    """所标记角的大小:从第一侧到第二侧逆时针,或带 `other_angle` 时顺时针且为负。

    以直角标记的角无值:查询它会引发异常。

    Args:
        degrees: 是否以度而非弧度给出。

    Returns:
        角,以弧度(或度)计,范围 -TAU 到 TAU。
    """
    return self.angle_value / DEGREES if degrees else self.angle_value

from_three_points

AngleFromThreePointsExample
代码
import manimgx as m


class AngleFromThreePointsExample(m.Scene):
    def construct(self) -> None:
        a, b, c = [-4, -2, 0], [3, -2, 0], [-1, 2.5, 0]
        angles = m.VGroup(
            m.Angle.from_three_points(b, a, c, radius=0.8, color=m.YELLOW),
            m.Angle.from_three_points(c, b, a, radius=0.8, color=m.BLUE),
            m.Angle.from_three_points(a, c, b, radius=0.8, color=m.GREEN),
        )
        self.add(m.Polygon(a, b, c, color=m.WHITE), angles)

角 ABC 的标记:在 B 处,从朝 A 的直线逆时针到朝 C 的直线。

Angle.from_three_points(A, B, C, **kwargs)
A

第一侧上一点。

B

顶点。

C

第二侧上一点。

radius

弧的半径,或直角标记的边长,以场景单位计(默认 None:0.4,或短直线时 为从交叉点到侧所指较近端距离的三分之二,当其小于 0.6 时)。

elbow

是否用直角标记(两段在其两侧间成角的线段)代替弧标记角(默认 False)。

quadrant

角的每侧从交叉点出发的方向:每条线一个符号,第一条线在前;1 沿该线方向 (从其起点指向终点),-1 则反向指向起点(默认 (1, 1))。

other_angle

弧是否从第一侧到第二侧顺时针运行,而非逆时针:此时标记整圈的其余部分 (默认 False)。

dot

是否在弧内放一个点,如直角有时标记的那样(默认 False;直角标记无点)。

dot_radius

点的半径,以场景单位计(默认 None:弧半径的十分之一)。

dot_distance

点距交叉点多远,以弧半径的分数计(默认 0.55)。

dot_color

点的颜色(默认白色)。

color

填充与描边共用的颜色(默认白色);None 表示该类的默认值。

fill_color

填充的颜色;未给出时为 color。多个颜色沿 sheen_direction 构成渐变。

fill_opacity

填充的不透明度,取值从 0 到 1(默认 0:无填充)。

stroke_color

描边的颜色;未给出时为 color。多个颜色构成渐变。

stroke_opacity

描边的不透明度,取值从 0 到 1(默认 1)。

stroke_width

描边的宽度,以场景单位的百分之一计(默认 4;0:无描边)。

background_stroke_color

绘制于填充之后的轮廓颜色(默认黑色)。

background_stroke_opacity

轮廓的不透明度,取值从 0 到 1(默认 1)。

background_stroke_width

轮廓的宽度,以场景单位的百分之一计(默认 0:无)。

sheen_factor

颜色朝 sheen_direction 变亮的程度,取值从 -1 到 1(默认 0); 负值变暗。

sheen_direction

颜色变亮的方向(默认 UL)。

joint_type

描边在路径转折处的连接方式:圆角、斜切或斜接,按二维场景的绘制方式 (参见 LineJointType;默认 AUTO:斜接)。

cap_style

描边在其显示的每一端的端点样式(开放路径的端点、虚线的端点):圆头、平头 或方头,按二维场景的绘制方式(参见 CapStyleType;默认 AUTO:平头)。

shade_in_3d

三维场景的光是否对该 mobject 着色。

material

其表面在三维场景中如何反射场景的光(参见 Material);None:Manim 的着色(默认)。

name

mobject 的名称;未给出时为其类名。

z_index

其在绘制顺序中的位置:索引较高者绘制于较低者之上 (默认 0)。

target

MoveToTarget 将 mobject 移动至的状态。

返回 一个新角。

源码

manimgx\mobjects\shapes.py

@staticmethod
def from_three_points(
    A: Point3DLike, B: Point3DLike, C: Point3DLike, **kwargs: Unpack[AngleOptions]
) -> Angle:
    """角 ABC 的标记:在 `B` 处,从朝 `A` 的直线逆时针到朝 `C` 的直线。

    Args:
        A: 第一侧上一点。
        B: 顶点。
        C: 第二侧上一点。
        **kwargs: [角关键字][manimgx.mobjects.shapes.AngleOptions]。

    Returns:
        一个新角。

    Examples:
        ```python
        import manimgx as m


        class AngleFromThreePointsExample(m.Scene):
            def construct(self) -> None:
                a, b, c = [-4, -2, 0], [3, -2, 0], [-1, 2.5, 0]
                angles = m.VGroup(
                    m.Angle.from_three_points(b, a, c, radius=0.8, color=m.YELLOW),
                    m.Angle.from_three_points(c, b, a, radius=0.8, color=m.BLUE),
                    m.Angle.from_three_points(a, c, b, radius=0.8, color=m.GREEN),
                )
                self.add(m.Polygon(a, b, c, color=m.WHITE), angles)
        ```
    """
    return Angle(Line(B, A), Line(B, C), **kwargs)

RightAngle

RightAngleExample
代码
import manimgx as m


class RightAngleExample(m.Scene):
    def construct(self) -> None:
        a, b, c = [-6, -2, 0], [-1, -2, 0], [-6, 2, 0]
        triangle = m.Polygon(a, b, c, color=m.BLUE)
        corner = m.RightAngle(m.Line(a, b), m.Line(a, c), color=m.YELLOW)
        line1 = m.Line([1, -2, 0], [6, 3, 0])
        line2 = m.Line([1, 3, 0], [6, -2, 0])
        marks = m.VGroup(
            m.RightAngle(line1, line2),
            m.RightAngle(line1, line2, length=0.7, quadrant=(-1, -1)),
        ).set_color(m.GREEN)
        self.add(triangle, corner, line1, line2, marks)

两直线间直角的标记:以直角标记的 Angle;未加样式时为白色。

两直线无需垂直:此时直角标记为平行四边形的一角。

m.RightAngle(line1, line2, length=None, **kwargs)
line1

第一条直线。

line2

第二条直线。

length

直角标记边长的长度,以场景单位计;None 表示 0.4,或短直线时更小 (见 Angle)。

quadrant

角的每侧从交叉点出发的方向:每条线一个符号,第一条线在前;1 沿该线方向 (从其起点指向终点),-1 则反向指向起点(默认 (1, 1))。

other_angle

弧是否从第一侧到第二侧顺时针运行,而非逆时针:此时标记整圈的其余部分 (默认 False)。

dot

是否在弧内放一个点,如直角有时标记的那样(默认 False;直角标记无点)。

dot_radius

点的半径,以场景单位计(默认 None:弧半径的十分之一)。

dot_distance

点距交叉点多远,以弧半径的分数计(默认 0.55)。

dot_color

点的颜色(默认白色)。

color

填充与描边共用的颜色(默认白色);None 表示该类的默认值。

fill_color

填充的颜色;未给出时为 color。多个颜色沿 sheen_direction 构成渐变。

fill_opacity

填充的不透明度,取值从 0 到 1(默认 0:无填充)。

stroke_color

描边的颜色;未给出时为 color。多个颜色构成渐变。

stroke_opacity

描边的不透明度,取值从 0 到 1(默认 1)。

stroke_width

描边的宽度,以场景单位的百分之一计(默认 4;0:无描边)。

background_stroke_color

绘制于填充之后的轮廓颜色(默认黑色)。

background_stroke_opacity

轮廓的不透明度,取值从 0 到 1(默认 1)。

background_stroke_width

轮廓的宽度,以场景单位的百分之一计(默认 0:无)。

sheen_factor

颜色朝 sheen_direction 变亮的程度,取值从 -1 到 1(默认 0); 负值变暗。

sheen_direction

颜色变亮的方向(默认 UL)。

joint_type

描边在路径转折处的连接方式:圆角、斜切或斜接,按二维场景的绘制方式 (参见 LineJointType;默认 AUTO:斜接)。

cap_style

描边在其显示的每一端的端点样式(开放路径的端点、虚线的端点):圆头、平头 或方头,按二维场景的绘制方式(参见 CapStyleType;默认 AUTO:平头)。

shade_in_3d

三维场景的光是否对该 mobject 着色。

material

其表面在三维场景中如何反射场景的光(参见 Material);None:Manim 的着色(默认)。

name

mobject 的名称;未给出时为其类名。

z_index

其在绘制顺序中的位置:索引较高者绘制于较低者之上 (默认 0)。

target

MoveToTarget 将 mobject 移动至的状态。

源码

manimgx\mobjects\shapes.py

def __init__(
    self,
    line1: Line,
    line2: Line,
    length: float | None = None,
    **kwargs: Unpack[AngleShape],
) -> None:
    super().__init__(line1, line2, radius=length, elbow=True, **kwargs)

Elbow

ElbowExample
代码
import manimgx as m


class ElbowExample(m.Scene):
    def construct(self) -> None:
        elbows = m.VGroup(
            m.Elbow(),
            m.Elbow(width=1.5, color=m.BLUE),
            m.Elbow(width=2, angle=5 * m.PI / 4, color=m.YELLOW),
        ).arrange(buff=1.5)
        self.add(elbows)

直角的标记:两段长 width 的线段在直角处相接;未加样式时为白色。

在原点制作,标记正 x 轴和正 y 轴间的直角:从 (0, width) 跨到其角 (width, width),再下到 (width, 0);angle 关于原点旋转。要标记两直线 间的角,见 RightAngle。

m.Elbow(width=0.2, angle=0, **kwargs)
width

每段线段的长度,以场景单位计。

angle

关于原点旋转的角度,以弧度计,逆时针。

color

填充与描边共用的颜色(默认白色);None 表示该类的默认值。

fill_color

填充的颜色;未给出时为 color。多个颜色沿 sheen_direction 构成渐变。

fill_opacity

填充的不透明度,取值从 0 到 1(默认 0:无填充)。

stroke_color

描边的颜色;未给出时为 color。多个颜色构成渐变。

stroke_opacity

描边的不透明度,取值从 0 到 1(默认 1)。

stroke_width

描边的宽度,以场景单位的百分之一计(默认 4;0:无描边)。

background_stroke_color

绘制于填充之后的轮廓颜色(默认黑色)。

background_stroke_opacity

轮廓的不透明度,取值从 0 到 1(默认 1)。

background_stroke_width

轮廓的宽度,以场景单位的百分之一计(默认 0:无)。

sheen_factor

颜色朝 sheen_direction 变亮的程度,取值从 -1 到 1(默认 0); 负值变暗。

sheen_direction

颜色变亮的方向(默认 UL)。

joint_type

描边在路径转折处的连接方式:圆角、斜切或斜接,按二维场景的绘制方式 (参见 LineJointType;默认 AUTO:斜接)。

cap_style

描边在其显示的每一端的端点样式(开放路径的端点、虚线的端点):圆头、平头 或方头,按二维场景的绘制方式(参见 CapStyleType;默认 AUTO:平头)。

shade_in_3d

三维场景的光是否对该 mobject 着色。

material

其表面在三维场景中如何反射场景的光(参见 Material);None:Manim 的着色(默认)。

name

mobject 的名称;未给出时为其类名。

z_index

其在绘制顺序中的位置:索引较高者绘制于较低者之上 (默认 0)。

target

MoveToTarget 将 mobject 移动至的状态。

还接受 样式关键字。

源码

manimgx\mobjects\shapes.py

def __init__(
    self, width: float = 0.2, angle: float = 0, **kwargs: Unpack[Style]
) -> None:
    self.angle = angle
    super().__init__(**kwargs)
    self.set_points_as_corners(np.array([UP, UP + RIGHT, RIGHT]))
    self.scale_to_fit_width(width, about_point=ORIGIN)
    self.rotate(self.angle, about_point=ORIGIN)

Placement

next_to 如何将一个 mobject 放置在另一个旁边:其关键字, 但不包括方向,供传递它们的方法使用。

buff

两者之间的间距,以场景单位表示(默认 0.25)。

aligned_edge

两个对象在它们相遇侧旁对齐所沿的边,以方向表示:当方向为 RIGHT 和 UP 时, 它们的顶部对齐(默认 ORIGIN:居中)。

submobject_to_align

要放在另一对象旁边的 mobject 的一部分,代替其位置;其余部分随其移动 (默认 None:整个 mobject)。

index_of_submobject_to_align

每个 mobject 中要对齐部分的索引:此对象的部分放在另一对象的部分旁边 (默认 None:各自的全部)。

coor_mask

哪些坐标可以改变:mobject 沿其移动的每个轴为 1,保持不变的轴为 0 (默认 (1, 1, 1))。

buff

两者之间的间距,以场景单位表示(默认 0.25)。

TypstOptions

Typst 的关键字,用于传递它们的类:文本和 LaTeX。

除此之外,它们还接受[外观关键字][manimgx.drawing.paint.Look]和 绘制关键字,后者在排版赋予各部分的颜色之上 重新着色。

font_size

文本的大小:一个 em 为 font_size / 96 场景单位,默认时为 0.5, 48(Text 按其大写字母确定大小:48 时高 0.449 单位)。

typst_preamble

在文档之前设置的 Typst 代码:#set 和 #show 规则、#let 定义、导入(默认为 "")。

font_paths

字体文件(.ttf、.otf、.ttc、.otc)的目录,在 manimgx 附带的字体之前 连同其子目录一起搜索;指向文件的路径不添加任何内容 (默认为 None)。

should_center

mobject 是否居中于原点(默认为 True)。

height

将 mobject 缩放至的高度,以场景单位计,而非按 font_size 确定大小 (默认为 None)。

width

将 mobject 缩放至的宽度,以场景单位计,而非按 font_size 确定大小; 若同时给出 height,则宽度最后设置(默认为 None)。

package_path

Typst 包导入的目录,将包存放为 namespace/name/version 目录: #import "@preview/name:1.0.0" 读取 preview/name/1.0.0(默认为 None: 除 mitex 外无任何包,mitex 由 manimgx 的引擎持有)。不下载任何内容。

background_stroke_color

绘制于填充之后的轮廓颜色(默认黑色)。

background_stroke_opacity

轮廓的不透明度,取值从 0 到 1(默认 1)。

background_stroke_width

轮廓的宽度,以场景单位的百分之一计(默认 0:无)。

sheen_factor

颜色朝 sheen_direction 变亮的程度,取值从 -1 到 1(默认 0); 负值变暗。

sheen_direction

颜色变亮的方向(默认 UL)。

joint_type

描边在路径转折处的连接方式:圆角、斜切或斜接,按二维场景的绘制方式 (参见 LineJointType;默认 AUTO:斜接)。

cap_style

描边在其显示的每一端的端点样式(开放路径的端点、虚线的端点):圆头、平头 或方头,按二维场景的绘制方式(参见 CapStyleType;默认 AUTO:平头)。

shade_in_3d

三维场景的光是否对该 mobject 着色。

material

其表面在三维场景中如何反射场景的光(参见 Material);None:Manim 的着色(默认)。

name

mobject 的名称;未给出时为其类名。

z_index

其在绘制顺序中的位置:索引较高者绘制于较低者之上 (默认 0)。

target

MoveToTarget 将 mobject 移动至的状态。

color

填充与描边共用的颜色。

opacity

填充与描边共用的不透明度,取值从 0 到 1。

fill_color

填充的颜色。

fill_opacity

填充的不透明度,取值从 0 到 1。

stroke_color

描边的颜色。

stroke_opacity

描边的不透明度,取值从 0 到 1。

stroke_width

描边的宽度,以场景单位的百分之一计。

AngleOptions

Angle 除两直线外的关键字(供制作它的方法使用)。

radius

弧的半径,或直角标记的边长,以场景单位计(默认 None:0.4,或短直线时 为从交叉点到侧所指较近端距离的三分之二,当其小于 0.6 时)。

elbow

是否用直角标记(两段在其两侧间成角的线段)代替弧标记角(默认 False)。

quadrant

角的每侧从交叉点出发的方向:每条线一个符号,第一条线在前;1 沿该线方向 (从其起点指向终点),-1 则反向指向起点(默认 (1, 1))。

other_angle

弧是否从第一侧到第二侧顺时针运行,而非逆时针:此时标记整圈的其余部分 (默认 False)。

dot

是否在弧内放一个点,如直角有时标记的那样(默认 False;直角标记无点)。

dot_radius

点的半径,以场景单位计(默认 None:弧半径的十分之一)。

dot_distance

点距交叉点多远,以弧半径的分数计(默认 0.55)。

dot_color

点的颜色(默认白色)。

color

填充与描边共用的颜色(默认白色);None 表示该类的默认值。

fill_color

填充的颜色;未给出时为 color。多个颜色沿 sheen_direction 构成渐变。

fill_opacity

填充的不透明度,取值从 0 到 1(默认 0:无填充)。

stroke_color

描边的颜色;未给出时为 color。多个颜色构成渐变。

stroke_opacity

描边的不透明度,取值从 0 到 1(默认 1)。

stroke_width

描边的宽度,以场景单位的百分之一计(默认 4;0:无描边)。

background_stroke_color

绘制于填充之后的轮廓颜色(默认黑色)。

background_stroke_opacity

轮廓的不透明度,取值从 0 到 1(默认 1)。

background_stroke_width

轮廓的宽度,以场景单位的百分之一计(默认 0:无)。

sheen_factor

颜色朝 sheen_direction 变亮的程度,取值从 -1 到 1(默认 0); 负值变暗。

sheen_direction

颜色变亮的方向(默认 UL)。

joint_type

描边在路径转折处的连接方式:圆角、斜切或斜接,按二维场景的绘制方式 (参见 LineJointType;默认 AUTO:斜接)。

cap_style

描边在其显示的每一端的端点样式(开放路径的端点、虚线的端点):圆头、平头 或方头,按二维场景的绘制方式(参见 CapStyleType;默认 AUTO:平头)。

shade_in_3d

三维场景的光是否对该 mobject 着色。

material

其表面在三维场景中如何反射场景的光(参见 Material);None:Manim 的着色(默认)。

name

mobject 的名称;未给出时为其类名。

z_index

其在绘制顺序中的位置:索引较高者绘制于较低者之上 (默认 0)。

target

MoveToTarget 将 mobject 移动至的状态。

radius

弧的半径,或直角标记的边长,以场景单位计(默认 None:0.4,或短直线时 为从交叉点到侧所指较近端距离的三分之二,当其小于 0.6 时)。

elbow

是否用直角标记(两段在其两侧间成角的线段)代替弧标记角(默认 False)。

AngleShape

Angle 除半径和直角标记外的关键字(直角设置它们): 标记哪个角,及其点,以及样式关键字。

quadrant

角的每侧从交叉点出发的方向:每条线一个符号,第一条线在前;1 沿该线方向 (从其起点指向终点),-1 则反向指向起点(默认 (1, 1))。

other_angle

弧是否从第一侧到第二侧顺时针运行,而非逆时针:此时标记整圈的其余部分 (默认 False)。

dot

是否在弧内放一个点,如直角有时标记的那样(默认 False;直角标记无点)。

dot_radius

点的半径,以场景单位计(默认 None:弧半径的十分之一)。

dot_distance

点距交叉点多远,以弧半径的分数计(默认 0.55)。

dot_color

点的颜色(默认白色)。

color

填充与描边共用的颜色(默认白色);None 表示该类的默认值。

fill_color

填充的颜色;未给出时为 color。多个颜色沿 sheen_direction 构成渐变。

fill_opacity

填充的不透明度,取值从 0 到 1(默认 0:无填充)。

stroke_color

描边的颜色;未给出时为 color。多个颜色构成渐变。

stroke_opacity

描边的不透明度,取值从 0 到 1(默认 1)。

stroke_width

描边的宽度,以场景单位的百分之一计(默认 4;0:无描边)。

background_stroke_color

绘制于填充之后的轮廓颜色(默认黑色)。

background_stroke_opacity

轮廓的不透明度,取值从 0 到 1(默认 1)。

background_stroke_width

轮廓的宽度,以场景单位的百分之一计(默认 0:无)。

sheen_factor

颜色朝 sheen_direction 变亮的程度,取值从 -1 到 1(默认 0); 负值变暗。

sheen_direction

颜色变亮的方向(默认 UL)。

joint_type

描边在路径转折处的连接方式:圆角、斜切或斜接,按二维场景的绘制方式 (参见 LineJointType;默认 AUTO:斜接)。

cap_style

描边在其显示的每一端的端点样式(开放路径的端点、虚线的端点):圆头、平头 或方头,按二维场景的绘制方式(参见 CapStyleType;默认 AUTO:平头)。

shade_in_3d

三维场景的光是否对该 mobject 着色。

material

其表面在三维场景中如何反射场景的光(参见 Material);None:Manim 的着色(默认)。

name

mobject 的名称;未给出时为其类名。

z_index

其在绘制顺序中的位置:索引较高者绘制于较低者之上 (默认 0)。

target

MoveToTarget 将 mobject 移动至的状态。