跳转至

线与箭头

影片代码
import manimgx as m


class LinesAndArrows(m.Scene):
    def construct(self) -> None:
        line = m.Line(m.LEFT, m.RIGHT)
        dashed = m.DashedLine(m.LEFT, m.RIGHT, color=m.BLUE)
        arrow = m.Arrow(m.LEFT, m.RIGHT, buff=0, color=m.YELLOW)
        double = m.DoubleArrow(m.LEFT, m.RIGHT, buff=0, color=m.GREEN)
        curved = m.CurvedArrow(m.LEFT, m.RIGHT, color=m.PINK)
        stealth = m.Line(m.LEFT, m.RIGHT, color=m.ORANGE).add_tip(
            tip_shape=m.StealthTip
        )
        shapes = m.VGroup(line, dashed, arrow, double, curved, stealth)
        names = m.VGroup(
            m.Text("Line", font="monospace", font_size=26),
            m.Text("DashedLine", font="monospace", font_size=26),
            m.Text("Arrow", font="monospace", font_size=26),
            m.Text("DoubleArrow", font="monospace", font_size=26),
            m.Text("CurvedArrow", font="monospace", font_size=26),
            m.Text("StealthTip", font="monospace", font_size=26),
        )
        cells = m.VGroup()
        for shape, name in zip(shapes, names, strict=True):
            name.next_to(shape, m.DOWN, buff=0.4)
            cells.add(m.VGroup(shape, name))
        cells.arrange_in_grid(rows=2, buff=(1.4, 1))
        self.play(m.LaggedStart(*[m.Create(shape) for shape in shapes], lag_ratio=0.2))
        self.play(m.FadeIn(names))
        self.wait()

线连接两个点。箭头是末端带有箭头尖端的线,用于指示方向;向量是从原点出发的箭头。线、箭头和弧都可以在任一端以箭头尖端结束,尖端可以是本页末尾列出的任何形状。

线的一端也可以是一个 mobject:此时线从该 mobject 的边缘开始延伸,从而连接两个形状而不穿过它们。

Line

LineExample
代码
import manimgx as m


class LineExample(m.Scene):
    def construct(self) -> None:
        straight = m.Line(4 * m.LEFT, 4 * m.RIGHT, color=m.BLUE)
        bent = m.Line(4 * m.LEFT, 4 * m.RIGHT, path_arc=-m.PI / 3)
        m.VGroup(straight, bent).arrange(m.DOWN, buff=1).shift(m.UP)
        left = m.Circle(radius=1, color=m.GREEN).move_to([-4.5, -2, 0])
        right = m.Circle(radius=0.5, color=m.RED).move_to([4.5, -2.5, 0])
        link = m.Line(left, right, buff=0.2, color=m.YELLOW)
        self.add(straight, bent, left, right, link)

从一点到另一点的直线,未加样式时为白色;或其间弯曲 path_arc 的弧。

一端可为 mobject:直线则从(或到)其朝向另一端最远的点开始(或结束) (见 get_boundary_point),因此两形状 间的直线从轮廓到轮廓。直线在创建时定位,之后不跟随 mobject。

m.Line(start=LEFT, end=RIGHT, buff=0, path_arc=0, **kwargs)
start

直线起点:一个点或一个 mobject。

end

直线终点:一个点或一个 mobject。

buff

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

path_arc

所弯曲的角度,以弧度计:0 为直;否则为弧,为正时逆时针, 行进时向右弯(见 ArcBetweenPoints)。

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,
    start: Point3DLike | Mobject = LEFT,
    end: Point3DLike | Mobject = RIGHT,
    buff: float = 0,
    path_arc: float = 0,
    **kwargs: Unpack[Tipped],
) -> None:
    self.dim = 3
    self.buff = buff
    self.path_arc = path_arc
    self._set_start_and_end_attrs(start, end)
    super().__init__(**kwargs)

set_path_arc

将直线弯曲一个新角度:在其创建端点间重建,直或为弧。

在其创建处(或上次重建处)重建,无论此后移到何处,并保留其缓冲。

line.set_path_arc(new_value)
new_value

角度,以弧度计:0 为直;否则为弧,为正时逆时针。

源码

manimgx\mobjects\shapes.py

def set_path_arc(self, new_value: float) -> Self:
    """将直线弯曲一个新角度:在其创建端点间重建,直或为弧。

    在其创建处(或上次重建处)重建,无论此后移到何处,并保留其缓冲。

    Args:
        new_value: 角度,以弧度计:0 为直;否则为弧,为正时逆时针。
    """
    self.path_arc = new_value
    self.init_points()
    return self

put_start_and_end_on

代码
import manimgx as m


class LinePutStartAndEndOnExample(m.Scene):
    def construct(self) -> None:
        a, b, c = [-4, -2, 0], [0, 2.5, 0], [4, -2, 0]
        dots = m.VGroup(*(m.Dot(p, radius=0.12) for p in (a, b, c)))
        line = m.Line(a, b, color=m.BLUE)
        self.add(dots, line)
        self.play(line.animate.put_start_and_end_on(b, c))
        self.play(line.animate.put_start_and_end_on(c, a))

移动、旋转并缩放直线使其从 start 到 end,包含尖端;其形状保持, 按比例缩放(箭头的尖端保持其大小)。

两端重合的直线在新两端间重建。

line.put_start_and_end_on(start, end)
start

其起点目标位置:若有起点尖端则为该尖端的点。

end

其终点目标位置:若有终点尖端则为该尖端的点。

源码

manimgx\mobjects\shapes.py

def put_start_and_end_on(self, start: Point3DLike, end: Point3DLike) -> Self:
    """移动、旋转并缩放直线使其从 `start` 到 `end`,包含尖端;其形状保持,
    按比例缩放(箭头的尖端保持其大小)。

    两端重合的直线在新两端间重建。

    Args:
        start: 其起点目标位置:若有起点尖端则为该尖端的点。
        end: 其终点目标位置:若有终点尖端则为该尖端的点。

    Examples:
        ```python
        import manimgx as m


        class LinePutStartAndEndOnExample(m.Scene):
            def construct(self) -> None:
                a, b, c = [-4, -2, 0], [0, 2.5, 0], [4, -2, 0]
                dots = m.VGroup(*(m.Dot(p, radius=0.12) for p in (a, b, c)))
                line = m.Line(a, b, color=m.BLUE)
                self.add(dots, line)
                self.play(line.animate.put_start_and_end_on(b, c))
                self.play(line.animate.put_start_and_end_on(c, a))
        ```
    """
    curr_start, curr_end = self.get_start_and_end()
    if np.all(curr_start == curr_end):
        self.start = np.asarray(start)
        self.end = np.asarray(end)
        self.generate_points()
    return super().put_start_and_end_on(start, end)

get_vector

从直线起点到终点的向量,包含尖端。

line.get_vector()

返回 向量,以场景单位计。

源码

manimgx\mobjects\shapes.py

def get_vector(self) -> Vector3D:
    """从直线起点到终点的向量,包含尖端。

    Returns:
        向量,以场景单位计。
    """
    return self.get_end() - self.get_start()

get_unit_vector

直线的方向:从起点指向终点的单位向量。

line.get_unit_vector()

返回 长度为 1 的向量;长度为零的直线返回零向量。

源码

manimgx\mobjects\shapes.py

def get_unit_vector(self) -> Vector3D:
    """直线的方向:从起点指向终点的单位向量。

    Returns:
        长度为 1 的向量;长度为零的直线返回零向量。
    """
    return normalize(self.get_vector())

get_angle

直线的角度:从起点到终点的方向,从正 x 轴起逆时针。

line.get_angle()

返回 角度,以弧度计,范围 -PI 到 PI。

源码

manimgx\mobjects\shapes.py

def get_angle(self) -> float:
    """直线的角度:从起点到终点的方向,从正 x 轴起逆时针。

    Returns:
        角度,以弧度计,范围 -PI 到 PI。
    """
    return angle_of_vector(self.get_vector())

get_projection

直线上距某点最近的点:该点在直线上的正交投影,可超出端点。

line.get_projection(point)
point

要投影的点。

返回 直线上的点,以场景坐标表示。

源码

manimgx\mobjects\shapes.py

def get_projection(self, point: Point3DLike) -> Point3D:
    """直线上距某点最近的点:该点在直线上的正交投影,可超出端点。

    Args:
        point: 要投影的点。

    Returns:
        直线上的点,以场景坐标表示。
    """
    start = self.get_start()
    end = self.get_end()
    unit_vect = normalize(end - start)
    return start + float(np.dot(point - start, unit_vect)) * unit_vect

get_slope

直线的斜率:每向右一个单位上升多少,即其 角度 的正切。

line.get_slope()

返回 斜率;近垂直的直线非常大。

源码

manimgx\mobjects\shapes.py

def get_slope(self) -> float:
    """直线的斜率:每向右一个单位上升多少,即其
    [角度][manimgx.Line.get_angle] 的正切。

    Returns:
        斜率;近垂直的直线非常大。
    """
    return float(np.tan(self.get_angle()))

set_angle

旋转直线使其 角度 为 angle:关于其起点, 除非另给一点。

line.set_angle(angle, about_point=None)
angle

新角度,以弧度计,从正 x 轴起逆时针。

about_point

旋转所绕的点;None 表示其起点。

源码

manimgx\mobjects\shapes.py

def set_angle(self, angle: float, about_point: Point3DLike | None = None) -> Self:
    """旋转直线使其 [角度][manimgx.Line.get_angle] 为 `angle`:关于其起点,
    除非另给一点。

    Args:
        angle: 新角度,以弧度计,从正 x 轴起逆时针。
        about_point: 旋转所绕的点;None 表示其起点。
    """
    if about_point is None:
        about_point = self.get_start()
    self.rotate(angle - self.get_angle(), about_point=about_point)
    return self

set_length

代码
import manimgx as m


class LineSetLengthExample(m.Scene):
    def construct(self) -> None:
        line = m.Line(m.LEFT, m.RIGHT, color=m.BLUE).shift(m.UP)
        arrow = m.Arrow(m.LEFT, m.RIGHT, color=m.YELLOW).shift(m.DOWN)
        self.add(line, arrow)
        self.play(line.animate.set_length(10), arrow.animate.set_length(10))
        self.play(line.animate.set_length(4), arrow.animate.set_length(4))

关于圆心将直线缩放到某长度,包含尖端(箭头的尖端保持其大小)。

line.set_length(length)
length

新长度,从起点到终点,以场景单位计。

源码

manimgx\mobjects\shapes.py

def set_length(self, length: float) -> Self:
    """关于圆心将直线缩放到某长度,包含尖端(箭头的尖端保持其大小)。

    Args:
        length: 新长度,从起点到终点,以场景单位计。

    Examples:
        ```python
        import manimgx as m


        class LineSetLengthExample(m.Scene):
            def construct(self) -> None:
                line = m.Line(m.LEFT, m.RIGHT, color=m.BLUE).shift(m.UP)
                arrow = m.Arrow(m.LEFT, m.RIGHT, color=m.YELLOW).shift(m.DOWN)
                self.add(line, arrow)
                self.play(line.animate.set_length(10), arrow.animate.set_length(10))
                self.play(line.animate.set_length(4), arrow.animate.set_length(4))
        ```
    """
    scale_factor: float = length / self.get_length()
    return self.scale(scale_factor)

DashedLine

DashedLineExample
代码
import manimgx as m


class DashedLineExample(m.Scene):
    def construct(self) -> None:
        start, end = 5 * m.LEFT, 5 * m.RIGHT
        lines = m.VGroup(
            m.DashedLine(start, end),
            m.DashedLine(start, end, dash_length=0.4, color=m.BLUE),
            m.DashedLine(start, end, dash_length=0.4, dashed_ratio=0.2),
            m.DashedLine(start, end, path_arc=m.PI / 4, color=m.YELLOW),
        ).arrange(m.DOWN, buff=1)
        lines[2].set_color(m.GREEN)
        self.add(lines)

以虚线绘制的直线,未加样式时为白色。

虚线是直线描边分段绘制:整数段,至少两段,从端到端均匀分布,每段约 dash_length 长,按直线的 cap_style 结束。它保持为一条路径,像 Line 一样定位、弯曲和加尖端,起止于直线端点;其控制柄为 其虚线的控制柄,即第一条和最后一条虚线的。虚线在创建时计数,并随其缩放。

m.DashedLine(start=LEFT, end=RIGHT, buff=0, path_arc=0, *, dash_length=DEFAULT_DASH_LENGTH, dashed_ratio=0.5, **kwargs)
start

直线起点:一个点或一个 mobject(见 Line)。

end

直线终点:一个点或一个 mobject。

buff

距每端缩短多少,以场景单位计。

path_arc

所弯曲的角度,以弧度计:0 为直。

dash_length

每段虚线的长度,以场景单位计(默认 0.05):约为此值, 以整数段虚线跨整条直线。

dashed_ratio

虚线覆盖直线的比例,从 0 到 1;其余为间隙。

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,
    start: Point3DLike | Mobject = LEFT,
    end: Point3DLike | Mobject = RIGHT,
    buff: float = 0,
    path_arc: float = 0,
    *,
    dash_length: float = DEFAULT_DASH_LENGTH,
    dashed_ratio: float = 0.5,
    **kwargs: Unpack[Tipped],
) -> None:
    self.dash_length = dash_length
    self.dashed_ratio = dashed_ratio
    super().__init__(start, end, buff, path_arc, **kwargs)
    self.paint = self.paint.but(  # a line drawn in dashes: one path, a dash window
        dash=dash_pattern(self._calculate_num_dashes(), dashed_ratio, 0, False)
    )

Arrow

ArrowExample
代码
import manimgx as m


class ArrowExample(m.Scene):
    def construct(self) -> None:
        a, b = 2.5 * m.LEFT, 2.5 * m.RIGHT
        arrows = m.VGroup(
            m.Arrow(a, b),
            m.Arrow(a, b, buff=0, color=m.BLUE),
            m.Arrow(a, b, path_arc=-m.PI / 3, color=m.GREEN),
            m.Arrow(a, b, tip_shape=m.StealthTip, color=m.YELLOW),
        ).arrange(m.DOWN, buff=0.8, aligned_edge=m.LEFT)
        shorts = m.VGroup()
        for length in (0.5, 1, 2, 4, 6):
            shorts.add(m.Arrow(m.ORIGIN, length * m.UP, buff=0, color=m.RED))
        shorts.arrange(aligned_edge=m.DOWN)
        self.add(m.VGroup(arrows, shorts).arrange(buff=1.5))

箭头:一条带终点尖端的直线,距所连两点各缩短 buff;未加样式时为白色, 描边宽 6。

短箭头按比例绘制:其尖端至多为其长度的 max_tip_length_to_length_ratio, 描边至多每单位长度 max_stroke_width_to_length_ratio 宽。缩放时保持尖端大小 (见 scale)。

m.Arrow(start=LEFT, end=RIGHT, *, buff=MED_SMALL_BUFF, max_tip_length_to_length_ratio=0.25, max_stroke_width_to_length_ratio=5, tip_shape=ArrowTriangleFilledTip, **kwargs)
start

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

end

箭头指向处:一个点或一个 mobject。

buff

距每端缩短多少,以场景单位计(默认 0.25):两 mobject 间的箭头 在每端留有间隙。

max_tip_length_to_length_ratio

尖端最长可为多长,为其长度的比例。

max_stroke_width_to_length_ratio

描边最宽可为多宽,以每场景单位长度的 百分之一场景单位计。

tip_shape

其尖端的类。

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\shapes.py

def __init__(
    self,
    start: Point3DLike | Mobject = LEFT,
    end: Point3DLike | Mobject = RIGHT,
    *,
    buff: float = MED_SMALL_BUFF,
    max_tip_length_to_length_ratio: float = 0.25,
    max_stroke_width_to_length_ratio: float = 5,
    tip_shape: type[ArrowTip] = ArrowTriangleFilledTip,
    **kwargs: Unpack[Arced],
) -> None:
    self.max_tip_length_to_length_ratio = max_tip_length_to_length_ratio
    self.max_stroke_width_to_length_ratio = max_stroke_width_to_length_ratio
    super().__init__(start, end, buff=buff, **kwargs)
    self.initial_stroke_width = self.stroke_width
    self.add_tip(tip_shape=tip_shape)
    self._set_stroke_width_from_length()

scale

代码
import manimgx as m


class ArrowScaleExample(m.Scene):
    def construct(self) -> None:
        kept = m.Arrow(m.LEFT, m.RIGHT, color=m.BLUE).shift(1.5 * m.UP)
        scaled = m.Arrow(m.LEFT, m.RIGHT, color=m.YELLOW).shift(m.DOWN)
        top = m.Text("scale(3)").move_to(2.8 * m.UP)
        bottom = m.Text("scale(3, scale_tips=True)").move_to(2.5 * m.DOWN)
        self.add(top, bottom, kept, scaled)
        self.play(
            kept.animate.scale(3), scaled.animate.scale(3, scale_tips=True)
        )

缩放箭头,除非 scale_tips 否则保持尖端大小。

箭杆被缩放,尖端重新加到其端。然后箭杆的描边宽度按其新长度设定, 如箭头创建时:取创建时的宽度与 max_stroke_width_to_length_ratio 乘其 长度的较小值。长度为零的箭头保持原样。

arrow.scale(scale_factor, scale_stroke=False, scale_tips=False, **kwargs)
scale_factor

缩放因子:一个,或每轴一个(见 Mobject.scale)。

scale_stroke

描边宽度是否也缩放;箭杆的仍按其长度设定。

scale_tips

尖端是否随箭杆缩放。

about_point

保持不动的点,以场景坐标表示;它优先于 about_edge。

about_edge

mobject 边界框上保持不动的点,以方向命名: UP 表示其顶边的中点,UR 表示其右上角,ORIGIN 表示其中心。

源码

manimgx\mobjects\shapes.py

def scale(
    self,
    scale_factor: float | Vector3DLike,
    scale_stroke: bool = False,
    scale_tips: bool = False,
    **kwargs: Unpack[Pivot],
) -> Self:
    """缩放箭头,除非 `scale_tips` 否则保持尖端大小。

    箭杆被缩放,尖端重新加到其端。然后箭杆的描边宽度按其新长度设定,
    如箭头创建时:取创建时的宽度与 `max_stroke_width_to_length_ratio` 乘其
    长度的较小值。长度为零的箭头保持原样。

    Args:
        scale_factor: 缩放因子:一个,或每轴一个(见
            [Mobject.scale][manimgx.Mobject.scale])。
        scale_stroke: 描边宽度是否也缩放;箭杆的仍按其长度设定。
        scale_tips: 尖端是否随箭杆缩放。
        **kwargs: [Pivot 关键字][manimgx.mobject.Pivot]:保持不变的点
            (默认:其圆心)。

    Examples:
        ```python
        import manimgx as m


        class ArrowScaleExample(m.Scene):
            def construct(self) -> None:
                kept = m.Arrow(m.LEFT, m.RIGHT, color=m.BLUE).shift(1.5 * m.UP)
                scaled = m.Arrow(m.LEFT, m.RIGHT, color=m.YELLOW).shift(m.DOWN)
                top = m.Text("scale(3)").move_to(2.8 * m.UP)
                bottom = m.Text("scale(3, scale_tips=True)").move_to(2.5 * m.DOWN)
                self.add(top, bottom, kept, scaled)
                self.play(
                    kept.animate.scale(3), scaled.animate.scale(3, scale_tips=True)
                )
        ```
    """
    if self.get_length() == 0:
        return self
    if scale_tips:
        super().scale(scale_factor, scale_stroke, **kwargs)
        self._set_stroke_width_from_length()
        return self
    has_tip = self.has_tip()
    order = list(self.submobjects)  # the tips come back to their places among them
    old_tips = self.pop_tips()
    super().scale(scale_factor, scale_stroke, **kwargs)
    self._set_stroke_width_from_length()
    for tip, at_start in zip(
        old_tips, (False, True) if has_tip else (True,), strict=False
    ):
        self.add_tip(tip=tip, at_start=at_start)
    place = {id(m): i for i, m in enumerate(order)}
    self.submobjects.sort(key=lambda m: place.get(id(m), len(order)))
    return self

DoubleArrow

DoubleArrowExample
代码
import manimgx as m


class DoubleArrowExample(m.Scene):
    def construct(self) -> None:
        circle = m.Circle(radius=2, color=m.BLUE).shift(3 * m.LEFT)
        diameter = m.DoubleArrow(circle.get_left(), circle.get_right(), buff=0)
        mixed = m.DoubleArrow(
            m.RIGHT,
            6 * m.RIGHT,
            tip_shape_start=m.ArrowCircleFilledTip,
            tip_shape_end=m.StealthTip,
            color=m.YELLOW,
        )
        self.add(circle, diameter, mixed)

两端各带一个尖端的箭头;未加样式时为白色,描边宽 6。

其尖端和描边按其长度(尖端到尖端)设定,如同 Arrow。

m.DoubleArrow(start=LEFT, end=RIGHT, *, tip_shape_start=ArrowTriangleFilledTip, tip_shape_end=None, **kwargs)
start

其起点:一个点或一个 mobject(见 Line)。

end

其终点:一个点或一个 mobject。

tip_shape_start

起点尖端的类。

tip_shape_end

终点尖端的类;None 表示 tip_shape 关键字的值, 否则为 ArrowTriangleFilledTip。

buff

箭头距每端缩短多少,以场景单位计(默认 0.25)。

max_tip_length_to_length_ratio

尖端最长可为多长,为其长度的比例:短箭头的尖端更短(默认 0.25)。

max_stroke_width_to_length_ratio

描边最宽可为多宽,以每场景单位长度的百分之一场景单位计:短箭头更细(默认 5)。

tip_shape

其尖端的类(默认 ArrowTriangleFilledTip)。

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\shapes.py

def __init__(
    self,
    start: Point3DLike | Mobject = LEFT,
    end: Point3DLike | Mobject = RIGHT,
    *,
    tip_shape_start: type[ArrowTip] = ArrowTriangleFilledTip,
    tip_shape_end: type[ArrowTip] | None = None,
    **kwargs: Unpack[ArrowOptions],
) -> None:
    if tip_shape_end is not None:
        kwargs["tip_shape"] = tip_shape_end
    super().__init__(start, end, **kwargs)
    self.add_tip(at_start=True, tip_shape=tip_shape_start)
    self._set_stroke_width_from_length()  # as an arrow's: by its length, tip to tip

Vector

VectorExample
代码
import manimgx as m


class VectorExample(m.Scene):
    def construct(self) -> None:
        vectors = m.VGroup(
            m.Vector([2, 1], color=m.YELLOW),
            m.Vector([-3, 2], color=m.BLUE),
            m.Vector([1, -3, 0], color=m.GREEN),
        )
        self.add(m.NumberPlane(), vectors)

向量:从原点到某点的箭头;未加样式时为白色。

m.Vector(direction=RIGHT, buff=0, **kwargs)
direction

其指向何处,从原点起:两个或三个坐标。

buff

距原点和终点各缩短多少,以场景单位计。

max_tip_length_to_length_ratio

尖端最长可为多长,为其长度的比例:短箭头的尖端更短(默认 0.25)。

max_stroke_width_to_length_ratio

描边最宽可为多宽,以每场景单位长度的百分之一场景单位计:短箭头更细(默认 5)。

tip_shape

其尖端的类(默认 ArrowTriangleFilledTip)。

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\shapes.py

def __init__(
    self,
    direction: Vector2DLike | Vector3DLike = RIGHT,
    buff: float = 0,
    **kwargs: Unpack[ArrowTips],
) -> None:
    self.buff = buff
    end = np.asarray(direction, dtype=float)
    if len(end) == 2:
        end = np.hstack([end, 0])
    super().__init__(ORIGIN, end, buff=buff, **kwargs)

coordinate_label

VectorCoordinateLabelExample
代码
import manimgx as m


class VectorCoordinateLabelExample(m.Scene):
    def construct(self) -> None:
        right = m.Vector([3, 2], color=m.YELLOW)
        left = m.Vector([-4, -2], color=m.BLUE)
        self.add(m.NumberPlane(), right, left)
        self.add(right.coordinate_label())
        self.add(left.coordinate_label(color=m.BLUE))

制作向量坐标的标签:其尖端旁的列矩阵。

标签以矩阵大小的 0.8 放置,在向量终点之外 0.25 处,垂直居中:向量指向右 (或正上或正下)时在其右侧,否则在其左侧。不添加到向量。

vector.coordinate_label(integer_labels=True, n_dim=2, **kwargs)
integer_labels

是否将坐标四舍五入为整数。

n_dim

显示多少坐标:2 为 x 和 y,3 为含 z。

v_buff

各行之间的距离,以场景单位表示,从一行的条目对齐角到下一行的对齐角 (默认 0.8)。

h_buff

各列之间的距离,以场景单位表示,同上(默认 1.3)。

bracket_h_buff

条目与每个括号之间的间距,以场景单位表示(默认 0.25)。

bracket_v_buff

当括号被拉伸时,括号在条目上下方延伸的距离,以场景单位表示 (默认 0.25)。

add_background_rectangles_to_entries

每个条目是否获得一个背景矩形(默认 False)。

include_background_rectangle

矩阵是否获得一个背景矩形(默认 False)。

element_alignment_corner

每个条目放置在网格上的角,以方向命名:DR 使一列中的条目按其右侧对齐, UL 则按其左侧对齐(默认 DR)。

left_bracket

左括号,作为 LaTeX 分隔符:"[", "(", "\{", "\langle", "|", …(默认 "[")。

right_bracket

右括号,作为 LaTeX 分隔符(默认 "]")。

stretch_brackets

括号是否被拉伸到条目的高度,并再延伸 bracket_v_buff 的距离 (默认 True)。

bracket_config

括号的 Math 关键字: 其 color,…(默认 None:无)。

element_to_mobject

构造每个条目的 mobject 的函数,以条目和 element_to_mobject_config 的关键字 参数调用(默认:矩阵类自身的函数,对于 Matrix 为 MathTex)。

element_to_mobject_config

element_to_mobject 的关键字参数(默认 None:矩阵类自身的设置,对于 Matrix 为无)。

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 coordinate_label(
    self,
    integer_labels: bool = True,
    n_dim: int = 2,
    **kwargs: Unpack[MatrixOptions],
) -> Matrix:
    """制作向量坐标的标签:其尖端旁的列矩阵。

    标签以矩阵大小的 0.8 放置,在向量终点之外 0.25 处,垂直居中:向量指向右
    (或正上或正下)时在其右侧,否则在其左侧。不添加到向量。

    Args:
        integer_labels: 是否将坐标四舍五入为整数。
        n_dim: 显示多少坐标:2 为 x 和 y,3 为含 z。
        **kwargs: [矩阵关键字][manimgx.mobjects.grid.MatrixOptions];`color`
            为整个标签上色。

    Returns:
        一个新矩阵。

    Examples:
        ```python
        import manimgx as m


        class VectorCoordinateLabelExample(m.Scene):
            def construct(self) -> None:
                right = m.Vector([3, 2], color=m.YELLOW)
                left = m.Vector([-4, -2], color=m.BLUE)
                self.add(m.NumberPlane(), right, left)
                self.add(right.coordinate_label())
                self.add(left.coordinate_label(color=m.BLUE))
        ```
    """
    from manimgx.mobjects.grid import Matrix

    vect = np.array(self.get_end())
    if integer_labels:
        vect = np.round(vect).astype(int)
    vect = vect[:n_dim]
    vect = vect.reshape((n_dim, 1))
    color = kwargs.pop("color", None)
    label = Matrix(vect, **kwargs)
    label.scale(LARGE_BUFF - 0.2)
    shift_dir = np.array(self.get_end())
    if shift_dir[0] >= 0:
        shift_dir -= label.get_left() + DEFAULT_MOBJECT_TO_MOBJECT_BUFFER * LEFT
    else:
        shift_dir -= label.get_right() + DEFAULT_MOBJECT_TO_MOBJECT_BUFFER * RIGHT
    label.shift(shift_dir)
    if color is not None:
        label.set_color(color)
    return label

CurvedArrow

代码
import manimgx as m


class CurvedArrowExample(m.Scene):
    def construct(self) -> None:
        start, end = 3 * m.LEFT + 0.5 * m.UP, 3 * m.RIGHT + 0.5 * m.UP
        arrows = m.VGroup(
            m.CurvedArrow(start, end, color=m.BLUE),
            m.CurvedArrow(start, end, angle=m.PI, color=m.YELLOW),
            m.CurvedArrow(end, start, color=m.GREEN),
            m.CurvedArrow(end, start, radius=3.2, tip_shape=m.StealthTip),
        )
        self.add(m.Dot(start, radius=0.12), m.Dot(end, radius=0.12))
        self.play(m.Create(arrows, run_time=4))

沿弧线的箭头:一个 ArcBetweenPoints, 终点带尖端,默认行进时向右弯曲;未加样式时为白色。

m.CurvedArrow(start_point, end_point, *, tip_shape=None, **kwargs)
start_point

箭头起点。

end_point

箭头指向处:其尖端的点。

tip_shape

其尖端的类;None 表示 ArrowTriangleFilledTip。

angle

弧线在行进中所转过的角度,以弧度计:为正时逆时针,向直线路径右侧弯曲; 为负时顺时针;为 0 时为直线段(默认 TAU / 4)。

radius

弧线圆的半径,以场景单位计,代替 angle:该半径的较短弧,向右弯曲, 或为负时向左;至少为两端距离的一半(默认 None:由 angle 设定)。

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,
    start_point: Point3DLike,
    end_point: Point3DLike,
    *,
    tip_shape: type[ArrowTip] | None = None,
    **kwargs: Unpack[ArcBetweenOptions],
) -> None:

    super().__init__(start_point, end_point, **kwargs)
    self.add_tip(tip_shape=tip_shape or ArrowTriangleFilledTip)

CurvedDoubleArrow

代码
import manimgx as m


class CurvedDoubleArrowExample(m.Scene):
    def construct(self) -> None:
        left = m.Circle(radius=1, color=m.BLUE).shift(4 * m.LEFT)
        right = m.Square(side_length=2, color=m.GREEN).shift(4 * m.RIGHT)
        top = left.get_top(), right.get_top()
        arrows = m.VGroup(
            m.CurvedDoubleArrow(*top, angle=-m.PI / 3),
            m.CurvedDoubleArrow(
                left.get_bottom(),
                right.get_bottom(),
                tip_shape_start=m.ArrowCircleFilledTip,
                tip_shape_end=m.StealthTip,
                color=m.YELLOW,
            ),
        )
        self.add(left, right)
        self.play(m.Create(arrows, run_time=2))

沿弧线且两端各带一个尖端的箭头:一个 ArcBetweenPoints, 带两个尖端,默认行进时向右弯曲;未加样式时为白色。

m.CurvedDoubleArrow(start_point, end_point, *, tip_shape_start=None, tip_shape_end=None, **kwargs)
start_point

箭头起点:其起点尖端的点。

end_point

箭头终点:其终点尖端的点。

tip_shape_start

起点尖端的类;None 表示 ArrowTriangleFilledTip。

tip_shape_end

终点尖端的类;None 表示 ArrowTriangleFilledTip。

angle

弧线在行进中所转过的角度,以弧度计:为正时逆时针,向直线路径右侧弯曲; 为负时顺时针;为 0 时为直线段(默认 TAU / 4)。

radius

弧线圆的半径,以场景单位计,代替 angle:该半径的较短弧,向右弯曲, 或为负时向左;至少为两端距离的一半(默认 None:由 angle 设定)。

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,
    start_point: Point3DLike,
    end_point: Point3DLike,
    *,
    tip_shape_start: type[ArrowTip] | None = None,
    tip_shape_end: type[ArrowTip] | None = None,
    **kwargs: Unpack[ArcBetweenOptions],
) -> None:

    super().__init__(start_point, end_point, tip_shape=tip_shape_end, **kwargs)
    self.add_tip(at_start=True, tip_shape=tip_shape_start or ArrowTriangleFilledTip)

TangentLine

TangentLineExample
代码
import manimgx as m


class TangentLineExample(m.Scene):
    def construct(self) -> None:
        circle = m.Circle(radius=2.5, color=m.BLUE)
        self.add(circle)
        for alpha in (0, 0.2, 0.45, 0.7):
            self.add(m.TangentLine(circle, alpha, length=4, color=m.YELLOW))
            self.add(m.Dot(circle.point_from_proportion(alpha)))

在某点沿路径与路径相切的直线,长 length,以该点为圆心;未加样式时为白色。

其方向为该点前后 d_alpha 处两点间弦的方向。

m.TangentLine(vmob, alpha, length=1, d_alpha=1e-06, **kwargs)
vmob

路径。

alpha

沿路径何处,以其长度的比例计:0 在起点,1 在终点。

length

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

d_alpha

该点前后路径长度的比例,其弦确定方向。

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\shapes.py

def __init__(
    self,
    vmob: VMobject,
    alpha: float,
    length: float = 1,
    d_alpha: float = 1e-06,
    **kwargs: Unpack[LineOptions],
) -> None:
    self.length = length
    self.d_alpha = d_alpha
    da = self.d_alpha
    a1 = np.clip(alpha - da, 0, 1)
    a2 = np.clip(alpha + da, 0, 1)
    super().__init__(
        vmob.point_from_proportion(a1), vmob.point_from_proportion(a2), **kwargs
    )
    self.scale(self.length / self.get_length())

箭头尖端

箭头尖端是位于线、弧或箭头末端的一个小形状。箭头会自行创建其尖端;任何其他线或弧可通过 add_tip 添加一个。tip_shape 选择其形状,tip_style 选择其样式。

TipableVMobject

可终止于箭头尖端的路径:直线、弧线和箭头的共同之处。

尖端是一个小形状(一个 ArrowTip),作为子对象添加到路径 的终点或起点,沿路径指向。尖端的点位于路径结束处,而路径被调整到在尖端底部停止。 带有尖端时,路径的 start 和 end 即为尖端的点。

m.TipableVMobject(tip_length=DEFAULT_ARROW_TIP_LENGTH, normal_vector=OUT, tip_style=None, **kwargs)
tip_length

add_tip 所生成尖端的长度, 以场景单位计(默认 0.35)。

normal_vector

路径所在平面的法向量。为兼容 Manim 而接受;被忽略。

tip_style

路径所生成尖端的样式关键字;除非在此给出,否则尖端的 fill_color 和 stroke_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,
    tip_length: float = DEFAULT_ARROW_TIP_LENGTH,
    normal_vector: Vector3DLike = OUT,
    tip_style: Style | None = None,
    **kwargs: Unpack[Style],
) -> None:
    self.tip_length: float = tip_length
    self.tip_style: Style = tip_style if tip_style is not None else {}
    super().__init__(**kwargs)

tip

路径终点的尖端,一旦 add_tip 已生成其一。

start_tip

路径起点的尖端,一旦 add_tip(at_start=True) 已生成其一。

add_tip

TipableVMobjectAddTipExample
代码
import manimgx as m


class TipableVMobjectAddTipExample(m.Scene):
    def construct(self) -> None:
        line = m.Line(3 * m.LEFT, 3 * m.RIGHT, color=m.BLUE).add_tip()
        both = m.Line(3 * m.LEFT, 3 * m.RIGHT, color=m.GREEN)
        both.add_tip(tip_shape=m.StealthTip)
        both.add_tip(tip_shape=m.ArrowCircleFilledTip, at_start=True)
        arc = m.Arc(radius=2, angle=m.PI, color=m.YELLOW)
        arc.add_tip(tip_length=0.5, tip_width=0.5)
        self.add(m.VGroup(line, both, arc).arrange(m.DOWN, buff=1))

在路径终点(或起点)添加一个箭头尖端,沿该处路径指向。

尖端的点位于路径结束处,而路径关于其另一端缩放并旋转,以在尖端底部停止。 尖端是一个子对象,名为 tip(或 start_tip), 颜色取路径的颜色,除非 tip_style 另行指定。

line.add_tip(tip=None, tip_shape=None, tip_length=None, tip_width=None, at_start=False)
tip

预先制作的尖端,将被旋转并移动到位;None 表示新建一个。

tip_shape

要制作的尖端类,一个 ArrowTip 子类; None 表示 ArrowTriangleFilledTip。

tip_length

要制作的尖端长度,以场景单位计;None 表示路径的 tip_length。

tip_width

要制作的尖端宽度(当其为默认的填充三角形时),以场景单位计; None 表示默认长度。其他形状不接受宽度:它们仅以 tip_length 制作。

at_start

尖端是否位于路径起点,沿路径反向指向。

源码

manimgx\mobjects\shapes.py

def add_tip(
    self,
    tip: ArrowTip | None = None,
    tip_shape: type[ArrowTip] | None = None,
    tip_length: float | None = None,
    tip_width: float | None = None,
    at_start: bool = False,
) -> Self:
    """在路径终点(或起点)添加一个箭头尖端,沿该处路径指向。

    尖端的点位于路径结束处,而路径关于其另一端缩放并旋转,以在尖端底部停止。
    尖端是一个子对象,名为 [tip][manimgx.TipableVMobject.tip](或 `start_tip`),
    颜色取路径的颜色,除非 `tip_style` 另行指定。

    Args:
        tip: 预先制作的尖端,将被旋转并移动到位;None 表示新建一个。
        tip_shape: 要制作的尖端类,一个 [ArrowTip][manimgx.ArrowTip] 子类;
            None 表示 [ArrowTriangleFilledTip][manimgx.ArrowTriangleFilledTip]。
        tip_length: 要制作的尖端长度,以场景单位计;None 表示路径的 `tip_length`。
        tip_width: 要制作的尖端宽度(当其为默认的填充三角形时),以场景单位计;
            None 表示默认长度。其他形状不接受宽度:它们仅以 `tip_length` 制作。
        at_start: 尖端是否位于路径起点,沿路径反向指向。

    Examples:
        ```python
        import manimgx as m


        class TipableVMobjectAddTipExample(m.Scene):
            def construct(self) -> None:
                line = m.Line(3 * m.LEFT, 3 * m.RIGHT, color=m.BLUE).add_tip()
                both = m.Line(3 * m.LEFT, 3 * m.RIGHT, color=m.GREEN)
                both.add_tip(tip_shape=m.StealthTip)
                both.add_tip(tip_shape=m.ArrowCircleFilledTip, at_start=True)
                arc = m.Arc(radius=2, angle=m.PI, color=m.YELLOW)
                arc.add_tip(tip_length=0.5, tip_width=0.5)
                self.add(m.VGroup(line, both, arc).arrange(m.DOWN, buff=1))
        ```
    """
    if tip is None:
        tip = self.create_tip(tip_shape, tip_length, tip_width, at_start)
    else:
        self.position_tip(tip, at_start)
    self.reset_endpoints_based_on_tip(tip, at_start)
    self.assign_tip_attr(tip, at_start)
    self.add(tip)
    return self

pop_tips

移除路径的尖端,并将路径恢复到其起点和终点之间原本的位置:即尖端的点。

line.pop_tips()

返回 被移除的尖端,终点尖端在前,置于一个新组中(若无则为空组)。

源码

manimgx\mobjects\shapes.py

def pop_tips(self) -> VGroup[ArrowTip]:
    """移除路径的尖端,并将路径恢复到其起点和终点之间原本的位置:即尖端的点。

    Returns:
        被移除的尖端,终点尖端在前,置于一个新组中(若无则为空组)。
    """

    start, end = self.get_start_and_end()
    result = VGroup[ArrowTip]()
    if self.has_tip():
        result.add(self.tip)
        self.remove(self.tip)
    if self.has_start_tip():
        result.add(self.start_tip)
        self.remove(self.start_tip)
    if result.submobjects:
        self.put_start_and_end_on(start, end)
    return result

get_tip

路径的尖端:终点处的那个,或若终点处无则起点处的那个。

它是 get_tips 的第一个; 从未被赋予尖端的路径会引发异常。

line.get_tip()
源码

manimgx\mobjects\shapes.py

def get_tip(self) -> ArrowTip:
    """路径的尖端:终点处的那个,或若终点处无则起点处的那个。

    它是 [get_tips][manimgx.TipableVMobject.get_tips] 的第一个;
    从未被赋予尖端的路径会引发异常。
    """
    tips = self.get_tips()
    if not tips.submobjects:
        raise Exception("tip not found")
    return tips[0]

get_tips

路径已具有的尖端:其 tip 和 start_tip,即其所拥有过的。

被 pop_tips 移除的尖端仍被命名, 并列于此处;has_tip 指示其是否仍在路径上。

line.get_tips()

返回 尖端,终点尖端在前,置于一个新组中。

源码

manimgx\mobjects\shapes.py

def get_tips(self) -> VGroup[ArrowTip]:
    """路径已具有的尖端:其 [tip][manimgx.TipableVMobject.tip] 和
    [start_tip][manimgx.TipableVMobject.start_tip],即其所拥有过的。

    被 [pop_tips][manimgx.TipableVMobject.pop_tips] 移除的尖端仍被命名,
    并列于此处;[has_tip][manimgx.TipableVMobject.has_tip] 指示其是否仍在路径上。

    Returns:
        尖端,终点尖端在前,置于一个新组中。
    """

    result = VGroup[ArrowTip]()
    if hasattr(self, "tip"):
        result.add(self.tip)
    if hasattr(self, "start_tip"):
        result.add(self.start_tip)
    return result

has_tip

路径是否在终点有尖端:其 tip 在其子对象中。

line.has_tip()
源码

manimgx\mobjects\shapes.py

def has_tip(self) -> bool:
    """路径是否在终点有尖端:其 [tip][manimgx.TipableVMobject.tip] 在其子对象中。
    """
    tip = self.__dict__.get("tip")
    return tip is not None and any(m is tip for m in self.submobjects)

has_start_tip

路径是否在起点有尖端:其 start_tip 在其子对象中。

line.has_start_tip()
源码

manimgx\mobjects\shapes.py

def has_start_tip(self) -> bool:
    """路径是否在起点有尖端:其 [start_tip][manimgx.TipableVMobject.start_tip]
    在其子对象中。
    """
    tip = self.__dict__.get("start_tip")
    return tip is not None and any(m is tip for m in self.submobjects)

get_start

路径起始处:若有起点尖端则为该尖端的点,否则为其第一个点。

line.get_start()

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

源码

manimgx\mobjects\shapes.py

def get_start(self) -> Point3D:
    """路径起始处:若有起点尖端则为该尖端的点,否则为其第一个点。

    Returns:
        该点,以场景坐标表示。
    """
    if self.has_start_tip():
        return np.array(self.start_tip.tip_point)
    else:
        return super().get_start()

get_end

路径结束处:若有终点尖端则为该尖端的点,否则为其最后一个点。

line.get_end()

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

源码

manimgx\mobjects\shapes.py

def get_end(self) -> Point3D:
    """路径结束处:若有终点尖端则为该尖端的点,否则为其最后一个点。

    Returns:
        该点,以场景坐标表示。
    """
    if self.has_tip():
        return np.array(self.tip.tip_point)
    else:
        return super().get_end()

get_length

路径起点到终点的距离,包含尖端:直线跨越,因此为弧的弦长,而非沿弧的长度。

line.get_length()

返回 距离,以场景单位计。

源码

manimgx\mobjects\shapes.py

def get_length(self) -> float:
    """路径起点到终点的距离,包含尖端:直线跨越,因此为弧的弦长,而非沿弧的长度。

    Returns:
        距离,以场景单位计。
    """
    start, end = self.get_start_and_end()
    return float(np.linalg.norm(start - end))

TippedBase

除 color 外的所有样式关键字,以及可终止于箭头尖端的路径的关键字 (见 TipableVMobject)。

按位置接收 color 的类会自行声明它,其余由本类声明。

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 移动至的状态。

tip_length

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

normal_vector

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

tip_style

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

尖端形状

ArrowTriangleFilledTip

ArrowTriangleFilledTipExample
代码
import manimgx as m


class ArrowTriangleFilledTipExample(m.Scene):
    def construct(self) -> None:
        tip = m.ArrowTriangleFilledTip
        a, b = 3 * m.LEFT, 3 * m.RIGHT
        arrows = m.VGroup(
            m.Arrow(a, b, tip_shape=tip),
            m.Arrow(a / 3, b / 3, tip_shape=tip, color=m.BLUE),
            m.CurvedArrow(a, b, angle=-m.PI / 3, tip_shape=tip, color=m.GREEN),
            m.Line(a, b, color=m.YELLOW).add_tip(tip_shape=tip, tip_length=0.6),
        ).arrange(m.DOWN, buff=0.8)
        self.add(arrows)

三角形尖端,填充且无轮廓:直线、弧线和箭头的默认尖端。

m.ArrowTriangleFilledTip(length=DEFAULT_ARROW_TIP_LENGTH, width=DEFAULT_ARROW_TIP_LENGTH, start_angle=PI, **kwargs)
length

其长度,从底到尖点,以场景单位计。

width

其宽度,跨底,以场景单位计。

start_angle

制作时尖点所指方向,以弧度计(默认 PI:向左); 路径会旋转尖端以沿自身指向。

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

@prototype
def __init__(
    self,
    length: float = DEFAULT_ARROW_TIP_LENGTH,
    width: float = DEFAULT_ARROW_TIP_LENGTH,
    start_angle: float = PI,
    **kwargs: Unpack[Style],
) -> None:
    Triangle.__init__(self, start_angle=start_angle, **kwargs)
    self.width = width
    self.stretch_to_fit_width(length)
    self.stretch_to_fit_height(width)

ArrowTriangleTip

ArrowTriangleTipExample
代码
import manimgx as m


class ArrowTriangleTipExample(m.Scene):
    def construct(self) -> None:
        tip = m.ArrowTriangleTip
        a, b = 3 * m.LEFT, 3 * m.RIGHT
        arrows = m.VGroup(
            m.Arrow(a, b, tip_shape=tip),
            m.Arrow(a / 3, b / 3, tip_shape=tip, color=m.BLUE),
            m.CurvedArrow(a, b, angle=-m.PI / 3, tip_shape=tip, color=m.GREEN),
            m.Line(a, b, color=m.YELLOW).add_tip(tip_shape=tip, tip_length=0.6),
        ).arrange(m.DOWN, buff=0.8)
        self.add(arrows)

三角形尖端,带轮廓:一个长 length、宽 width 的等腰三角形, 其轮廓宽 3 且不填充。

m.ArrowTriangleTip(length=DEFAULT_ARROW_TIP_LENGTH, width=DEFAULT_ARROW_TIP_LENGTH, start_angle=PI, **kwargs)
length

其长度,从底到尖点,以场景单位计。

width

其宽度,跨底,以场景单位计。

start_angle

制作时尖点所指方向,以弧度计(默认 PI:向左); 路径会旋转尖端以沿自身指向。

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

@prototype
def __init__(
    self,
    length: float = DEFAULT_ARROW_TIP_LENGTH,
    width: float = DEFAULT_ARROW_TIP_LENGTH,
    start_angle: float = PI,
    **kwargs: Unpack[Style],
) -> None:
    Triangle.__init__(self, start_angle=start_angle, **kwargs)
    self.width = width
    self.stretch_to_fit_width(length)
    self.stretch_to_fit_height(width)

StealthTip

StealthTipExample
代码
import manimgx as m


class StealthTipExample(m.Scene):
    def construct(self) -> None:
        tip = m.StealthTip
        a, b = 3 * m.LEFT, 3 * m.RIGHT
        arrows = m.VGroup(
            m.Arrow(a, b, tip_shape=tip),
            m.Arrow(a / 3, b / 3, tip_shape=tip, color=m.BLUE),
            m.CurvedArrow(a, b, angle=-m.PI / 3, tip_shape=tip, color=m.GREEN),
            m.Line(a, b, color=m.YELLOW).add_tip(tip_shape=tip, tip_length=0.6),
        ).arrange(m.DOWN, buff=0.8)
        self.add(arrows)

镖形尖端:一个尖点,其后掠出两个倒刺,其间有缺口,路径在此停止; 填充,描边宽 3。

其长度从倒刺到尖点;缺口在从尖点往回 ⅝ 处。除非给定长度,否则其长度为其他 尖端的一半。

m.StealthTip(length=DEFAULT_ARROW_TIP_LENGTH / 2, start_angle=PI, **kwargs)
length

其长度,从倒刺到尖点,以场景单位计(默认 0.175)。

start_angle

为兼容 Manim 而接受;被忽略。

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

@prototype
def __init__(
    self,
    length: float = DEFAULT_ARROW_TIP_LENGTH / 2,
    start_angle: float = PI,
    **kwargs: Unpack[Style],
):
    self.start_angle = start_angle
    VMobject.__init__(self, **kwargs)
    self.set_points_as_corners(
        np.array([[2, 0, 0], [-1.2, 1.6, 0], [0, 0, 0], [-1.2, -1.6, 0], [2, 0, 0]])
    )
    self.scale(length / self.length)
length

尖端的整体长度,以场景单位计:从倒刺到尖点,为从缺口到尖点距离的 1.6 倍。

stealth_tip.length
源码

manimgx\mobjects\shapes.py

def length(self) -> float:
    """尖端的整体长度,以场景单位计:从倒刺到尖点,为从缺口到尖点距离的 1.6 倍。"""
    return float(np.linalg.norm(self.vector) * 1.6)

ArrowCircleFilledTip

ArrowCircleFilledTipExample
代码
import manimgx as m


class ArrowCircleFilledTipExample(m.Scene):
    def construct(self) -> None:
        tip = m.ArrowCircleFilledTip
        a, b = 3 * m.LEFT, 3 * m.RIGHT
        arrows = m.VGroup(
            m.Arrow(a, b, tip_shape=tip),
            m.Arrow(a / 3, b / 3, tip_shape=tip, color=m.BLUE),
            m.CurvedArrow(a, b, angle=-m.PI / 3, tip_shape=tip, color=m.GREEN),
            m.Line(a, b, color=m.YELLOW).add_tip(tip_shape=tip, tip_length=0.6),
        ).arrange(m.DOWN, buff=0.8)
        self.add(arrows)

圆形尖端,填充且无轮廓:一个跨 length 的圆盘,从路径停止处到其结束处。

m.ArrowCircleFilledTip(length=DEFAULT_ARROW_TIP_LENGTH, start_angle=PI, **kwargs)
length

其直径,以场景单位计。

start_angle

为兼容 Manim 而接受;被忽略。

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

@prototype
def __init__(
    self,
    length: float = DEFAULT_ARROW_TIP_LENGTH,
    start_angle: float = PI,
    **kwargs: Unpack[Style],
) -> None:
    self.start_angle = start_angle
    Circle.__init__(self, **kwargs)
    self.width = length
    self.stretch_to_fit_height(length)

ArrowCircleTip

ArrowCircleTipExample
代码
import manimgx as m


class ArrowCircleTipExample(m.Scene):
    def construct(self) -> None:
        tip = m.ArrowCircleTip
        a, b = 3 * m.LEFT, 3 * m.RIGHT
        arrows = m.VGroup(
            m.Arrow(a, b, tip_shape=tip),
            m.Arrow(a / 3, b / 3, tip_shape=tip, color=m.BLUE),
            m.CurvedArrow(a, b, angle=-m.PI / 3, tip_shape=tip, color=m.GREEN),
            m.Line(a, b, color=m.YELLOW).add_tip(tip_shape=tip, tip_length=0.6),
        ).arrange(m.DOWN, buff=0.8)
        self.add(arrows)

圆形尖端,带轮廓:一个跨 length 的圆,从路径停止处到其结束处; 其轮廓宽 3 且不填充。

m.ArrowCircleTip(length=DEFAULT_ARROW_TIP_LENGTH, start_angle=PI, **kwargs)
length

其直径,以场景单位计。

start_angle

为兼容 Manim 而接受;被忽略。

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

@prototype
def __init__(
    self,
    length: float = DEFAULT_ARROW_TIP_LENGTH,
    start_angle: float = PI,
    **kwargs: Unpack[Style],
) -> None:
    self.start_angle = start_angle
    Circle.__init__(self, **kwargs)
    self.width = length
    self.stretch_to_fit_height(length)

ArrowSquareFilledTip

ArrowSquareFilledTipExample
代码
import manimgx as m


class ArrowSquareFilledTipExample(m.Scene):
    def construct(self) -> None:
        tip = m.ArrowSquareFilledTip
        a, b = 3 * m.LEFT, 3 * m.RIGHT
        arrows = m.VGroup(
            m.Arrow(a, b, tip_shape=tip),
            m.Arrow(a / 3, b / 3, tip_shape=tip, color=m.BLUE),
            m.CurvedArrow(a, b, angle=-m.PI / 3, tip_shape=tip, color=m.GREEN),
            m.Line(a, b, color=m.YELLOW).add_tip(tip_shape=tip, tip_length=0.6),
        ).arrange(m.DOWN, buff=0.8)
        self.add(arrows)

方形尖端,填充且无轮廓:一个边长 length 的正方形,置于一个角上, 其对角线沿路径从路径停止处到其结束处。

其 length 即该对角线的长度。

m.ArrowSquareFilledTip(length=DEFAULT_ARROW_TIP_LENGTH, start_angle=PI, **kwargs)
length

其边长,以场景单位计。

start_angle

为兼容 Manim 而接受;被忽略。

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

@prototype
def __init__(
    self,
    length: float = DEFAULT_ARROW_TIP_LENGTH,
    start_angle: float = PI,
    **kwargs: Unpack[Style],
) -> None:
    self.start_angle = start_angle
    Square.__init__(self, side_length=length, **kwargs)
    self.width = length
    self.stretch_to_fit_height(length)

ArrowSquareTip

ArrowSquareTipExample
代码
import manimgx as m


class ArrowSquareTipExample(m.Scene):
    def construct(self) -> None:
        tip = m.ArrowSquareTip
        a, b = 3 * m.LEFT, 3 * m.RIGHT
        arrows = m.VGroup(
            m.Arrow(a, b, tip_shape=tip),
            m.Arrow(a / 3, b / 3, tip_shape=tip, color=m.BLUE),
            m.CurvedArrow(a, b, angle=-m.PI / 3, tip_shape=tip, color=m.GREEN),
            m.Line(a, b, color=m.YELLOW).add_tip(tip_shape=tip, tip_length=0.6),
        ).arrange(m.DOWN, buff=0.8)
        self.add(arrows)

方形尖端,带轮廓:一个边长 length 的正方形,置于一个角上, 其对角线沿路径从路径停止处到其结束处;其轮廓宽 3 且不填充。

其 length 即该对角线的长度。

m.ArrowSquareTip(length=DEFAULT_ARROW_TIP_LENGTH, start_angle=PI, **kwargs)
length

其边长,以场景单位计。

start_angle

为兼容 Manim 而接受;被忽略。

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

@prototype
def __init__(
    self,
    length: float = DEFAULT_ARROW_TIP_LENGTH,
    start_angle: float = PI,
    **kwargs: Unpack[Style],
) -> None:
    self.start_angle = start_angle
    Square.__init__(self, side_length=length, **kwargs)
    self.width = length
    self.stretch_to_fit_height(length)

ArrowTip

箭头尖端的基类:一个具有两个自身点的小形状,其 tip_point(其所终止路径指向之处)和其 base(路径停止之处)。

路径以 tip_shape(length=…, **style) 制作其尖端(见 add_tip),再旋转并移动到位:尖端即其类 在该长度下所制作。其本身不被制作:其子类才是尖端。要自行制作尖端,请子类化 它和一个以给定长度制作的形状:形状的第一个点为尖端点,其轮廓中点为底。 两者均从其点读取,因此随其移动;命名其形状其他点的子类以属性方式这样做, 从不存储。

m.ArrowTip(length=DEFAULT_ARROW_TIP_LENGTH, **kwargs)
length

尖端的长度,以场景单位计。

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

@prototype
def __init__(
    self, length: float = DEFAULT_ARROW_TIP_LENGTH, **kwargs: Unpack[Style]
) -> None:
    raise NotImplementedError("Has to be implemented in inheriting subclasses.")
base

路径与尖端相接并停止之处:从尖端点沿其轮廓走一半所到的点。

tip.base
源码

manimgx\mobjects\shapes.py

def base(self) -> Point3D:
    """路径与尖端相接并停止之处:从尖端点沿其轮廓走一半所到的点。"""
    return self.point_from_proportion(0.5)
tip_point

尖端的点,即路径指向之处:其轮廓的第一个点。

tip.tip_point
源码

manimgx\mobjects\shapes.py

def tip_point(self) -> Point3D:
    """尖端的点,即路径指向之处:其轮廓的第一个点。"""
    tip_point: Point3D = self.points[0]
    return tip_point
vector

从尖端底到尖端点的向量:其所指方向。

tip.vector
源码

manimgx\mobjects\shapes.py

def vector(self) -> Vector3D:
    """从尖端底到尖端点的向量:其所指方向。"""
    return self.tip_point - self.base
tip_angle

尖端所指方向:其 vector 的角度, 以弧度计,从正 x 轴起逆时针。

tip.tip_angle
源码

manimgx\mobjects\shapes.py

def tip_angle(self) -> float:
    """尖端所指方向:其 [vector][manimgx.ArrowTip.vector] 的角度,
    以弧度计,从正 x 轴起逆时针。"""
    return angle_of_vector(self.vector)
length

尖端的长度,以场景单位计:从其底到其尖端点的距离。

tip.length
源码

manimgx\mobjects\shapes.py

def length(self) -> float:
    """尖端的长度,以场景单位计:从其底到其尖端点的距离。"""
    return float(np.linalg.norm(self.vector))

Arced

直线的弯曲,带样式和尖端关键字(供自行设置缓冲的直线使用)。

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 移动至的状态。

Pivot

变换所保持不动的点:给定的点,或 mobject 边界框上的一个点。

当两个关键字均未指定时,缩放、旋转或拉伸保持 mobject 的中心不动, 而函数或矩阵关于原点应用。

about_point

保持不动的点,以场景坐标表示;它优先于 about_edge。

about_edge

mobject 边界框上保持不动的点,以方向命名: UP 表示其顶边的中点,UR 表示其右上角,ORIGIN 表示其中心。

about_point

保持不动的点,以场景坐标表示;它优先于 about_edge。

about_edge

mobject 边界框上保持不动的点,以方向命名: UP 表示其顶边的中点,UR 表示其右上角,ORIGIN 表示其中心。

MatrixOptions

Matrix 除条目以外的关键字参数,供将其传递下去的方法使用 (如向量的坐标标签):即条目的类型,以及其 布局、括号和样式。

v_buff

各行之间的距离,以场景单位表示,从一行的条目对齐角到下一行的对齐角 (默认 0.8)。

h_buff

各列之间的距离,以场景单位表示,同上(默认 1.3)。

bracket_h_buff

条目与每个括号之间的间距,以场景单位表示(默认 0.25)。

bracket_v_buff

当括号被拉伸时,括号在条目上下方延伸的距离,以场景单位表示 (默认 0.25)。

add_background_rectangles_to_entries

每个条目是否获得一个背景矩形(默认 False)。

include_background_rectangle

矩阵是否获得一个背景矩形(默认 False)。

element_alignment_corner

每个条目放置在网格上的角,以方向命名:DR 使一列中的条目按其右侧对齐, UL 则按其左侧对齐(默认 DR)。

left_bracket

左括号,作为 LaTeX 分隔符:"[", "(", "\{", "\langle", "|", …(默认 "[")。

right_bracket

右括号,作为 LaTeX 分隔符(默认 "]")。

stretch_brackets

括号是否被拉伸到条目的高度,并再延伸 bracket_v_buff 的距离 (默认 True)。

bracket_config

括号的 Math 关键字: 其 color,…(默认 None:无)。

element_to_mobject

构造每个条目的 mobject 的函数,以条目和 element_to_mobject_config 的关键字 参数调用(默认:矩阵类自身的函数,对于 Matrix 为 MathTex)。

element_to_mobject_config

element_to_mobject 的关键字参数(默认 None:矩阵类自身的设置,对于 Matrix 为无)。

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 移动至的状态。

v_buff

各行之间的距离,以场景单位表示,从一行的条目对齐角到下一行的对齐角 (默认 0.8)。

h_buff

各列之间的距离,以场景单位表示,同上(默认 1.3)。

bracket_h_buff

条目与每个括号之间的间距,以场景单位表示(默认 0.25)。

bracket_v_buff

当括号被拉伸时,括号在条目上下方延伸的距离,以场景单位表示 (默认 0.25)。

add_background_rectangles_to_entries

每个条目是否获得一个背景矩形(默认 False)。

include_background_rectangle

矩阵是否获得一个背景矩形(默认 False)。

element_alignment_corner

每个条目放置在网格上的角,以方向命名:DR 使一列中的条目按其右侧对齐, UL 则按其左侧对齐(默认 DR)。

left_bracket

左括号,作为 LaTeX 分隔符:"[", "(", "\{", "\langle", "|", …(默认 "[")。

right_bracket

右括号,作为 LaTeX 分隔符(默认 "]")。

stretch_brackets

括号是否被拉伸到条目的高度,并再延伸 bracket_v_buff 的距离 (默认 True)。

bracket_config

括号的 Math 关键字: 其 color,…(默认 None:无)。

element_to_mobject

构造每个条目的 mobject 的函数,以条目和 element_to_mobject_config 的关键字 参数调用(默认:矩阵类自身的函数,对于 Matrix 为 MathTex)。

element_to_mobject_config

element_to_mobject 的关键字参数(默认 None:矩阵类自身的设置,对于 Matrix 为无)。