带标签的线¶
限定名称: manim.mobject.geometry.labeled.LabeledLine
- class LabeledLine(label, label_position=0.5, font_size=48, label_color=ManimColor('#FFFFFF'), label_frame=True, frame_fill_color=None, frame_fill_opacity=1, *args, **kwargs)[来源]¶
基础类:
Line构造一条线,在其长度上的某个位置包含一个标签框。
- Parameters:
label_position (float | optional) – 一个在[0-1]范围内的比率,用于指示标签相对于线条长度的位置。默认值为0.5。
font_size (float | optional) – 控制标签的字体大小。此参数仅在label类型为str时使用。
label_color (ParsableManimColor | optional) – 标签文本的颜色。此参数仅在label类型为str时使用。
label_frame (Bool | optional) – 为标签框添加一个SurroundingRectangle框架。
frame_fill_color (ParsableManimColor | optional) – 用于填充标签框的背景颜色。如果未提供值,将使用画布的背景颜色。
frame_fill_opacity (float | optional) – 通过传递一个在[0-1]范围内的值来确定标签框的不透明度,其中0表示完全透明,1表示完全不透明。
参见:: (..) –
LabeledArrow
示例
示例:LabeledLineExample ¶
from manim import * class LabeledLineExample(Scene): def construct(self): line = LabeledLine( label = '0.5', label_position = 0.8, font_size = 20, label_color = WHITE, label_frame = True, 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, font_size = 20, label_color = WHITE, label_frame = True, start=LEFT+DOWN, end=RIGHT+UP) line.set_length(line.get_length() * 2) self.add(line)方法
属性
animate用于动画化
self的任何方法的应用。animation_overridescolordepthmobject的深度。
fill_color如果有多种颜色(用于渐变),则返回第一个颜色
heightmobject的高度。
n_points_per_curvesheen_factorstroke_colorwidthmobject的宽度。
- _original__init__(label, label_position=0.5, font_size=48, label_color=ManimColor('#FFFFFF'), label_frame=True, frame_fill_color=None, frame_fill_opacity=1, *args, **kwargs)¶
初始化自身。有关准确的签名,请参阅 help(type(self))。
- Parameters:
label_position (float)
font_size (float)
label_color (ParsableManimColor)
label_frame (布尔型)
frame_fill_color (ParsableManimColor)
frame_fill_opacity (float)
- Return type:
无