LabeledLine

完全限定名: manim.mobject.geometry.labeled.LabeledLine

LabeledLine(label, label_position=0.5, label_config=None, box_config=None, frame_config=None, *args, **kwargs)[来源]

基类: Line

构造一条线,其长度上的某个位置包含一个标签框。

参数:
  • label (str | Tex | MathTex | Text) – 将在线上显示的标签。

  • label_position (float) – 一个在[0-1]范围内的比率,表示标签相对于线长度的位置。默认值为0.5。

  • label_config (dict[str, Any] | None) – 一个包含标签配置的字典。这仅在 labelstr 类型时应用。

  • box_config (dict[str, Any] | None) – 一个包含背景框配置的字典。

  • frame_config (dict[str, Any] | None) –

    包含帧配置的字典。

    另请参阅

    LabeledArrow

  • args (任意类型)

  • kwargs (Any)

示例

示例: LabeledLineExample

../_images/LabeledLineExample-1.png
from manim import *

class LabeledLineExample(Scene):
    def construct(self):
        line = LabeledLine(
            label          = '0.5',
            label_position = 0.8,
            label_config = {
                "font_size" : 20
            },
            start=LEFT+DOWN,
            end=RIGHT+UP)

        line.set_length(line.get_length() * 2)
        self.add(line)
class LabeledLineExample(Scene):
    def construct(self):
        line = LabeledLine(
            label          = '0.5',
            label_position = 0.8,
            label_config = {
                "font_size" : 20
            },
            start=LEFT+DOWN,
            end=RIGHT+UP)

        line.set_length(line.get_length() * 2)
        self.add(line)

方法

属性

animate (动画)

用于动画化 self 的任何方法的应用。

animation_overrides (动画覆盖)

颜色

depth (深度)

mobject 的深度。

fill_color (填充颜色)

如果存在多种颜色(用于渐变),则返回第一种颜色

height (高度)

mobject 的高度。

n_points_per_curve (每条曲线的点数)

sheen_factor (光泽因子)

stroke_color (描边颜色)

width (宽度)

mobject 的宽度。

_original__init__(label, label_position=0.5, label_config=None, box_config=None, frame_config=None, *args, **kwargs)

初始化自身。有关准确签名,请参阅 help(type(self))。

参数:
  • label (str | Tex | MathTex | Text)

  • label_position (float)

  • label_config (dict[str, Any] | None)

  • box_config (dict[str, Any] | None)

  • frame_config (dict[str, Any] | None)

  • args (任意类型)

  • kwargs (Any)

返回类型: