Paragraph¶
完全限定名称: manim.mobject.text.text\_mobject.Paragraph
- class Paragraph(*text, line_spacing=-1, alignment=None, **kwargs)[源码]¶
基类:
VGroup
显示一个文本段落。
对于给定的
Paragraph
par
,属性par.chars
是一个包含所有行的VGroup
。在此上下文中,每一行都构建为一个包含该行字符的VGroup
。- 参数:
line_spacing (float) – 表示行间距。默认为 -1,表示自动。
alignment (str | None) – 定义段落的对齐方式。默认为 None。可能的值为 “left”、“right” 或 “center”。
text (Sequence[str])
示例
常规用法
paragraph = Paragraph( "this is a awesome", "paragraph", "With \nNewlines", "\tWith Tabs", " With Spaces", "With Alignments", "center", "left", "right", )
移除不需要的不可见字符
self.play(Transform(remove_invisible_chars(paragraph.chars[0:2]), remove_invisible_chars(paragraph.chars[3][0:3]))
方法
属性
animate (动画)
用于动画化
self
的任何方法的应用。animation_overrides (动画覆盖)
颜色
depth (深度)
mobject 的深度。
fill_color (填充颜色)
如果存在多种颜色(用于渐变),则返回第一种颜色
height (高度)
mobject 的高度。
n_points_per_curve (每条曲线的点数)
sheen_factor (光泽因子)
stroke_color (描边颜色)
width (宽度)
mobject 的宽度。
- _change_alignment_for_a_line(alignment, line_no)[源码]¶
用于将一行的对齐方式更改为特定值的函数。
- 参数:
alignment (str) – 定义段落的对齐方式。可能的值为 “left”、“right”、“center”。
line_no (int) – 定义我们想要设置给定对齐方式的行号。
- 返回类型:
无
- _gen_chars(lines_str_list)[源码]¶
将普通字符串列表转换为字符VGroup的VGroup的函数。
- 参数:
lines_str_list (list) – 普通文本字符串列表。
- 返回:
生成的二维字符VGroup。
- 返回类型:
- _original__init__(*text, line_spacing=-1, alignment=None, **kwargs)¶
初始化自身。有关准确签名,请参阅 help(type(self))。
- 参数:
text (Sequence[str])
line_spacing (float)
alignment (str | None)
- 返回类型:
无
- _set_all_lines_alignments(alignment)[源码]¶
用于将所有行的对齐方式设置为特定值的函数。
- 参数:
alignment (str) – 定义段落的对齐方式。可能的值为 “left”、“right”、“center”。
- 返回类型: