UntypeWithCursor¶
完整名称: manim.animation.creation.UntypeWithCursor
- 类 UntypeWithCursor(mobject=None, *args, use_override=True, **kwargs)[源代码]¶
基类:
TypeWithCursor
类似于
RemoveTextLetterByLetter
,但在末尾带有一个额外的光标 Mobject。- 参数:
**time_per_char** (float) – 字母出现频率。
**buff** – 控制光标与最后一个添加的字母右侧的距离。
**keep_cursor_y** – 如果为
True
,则光标的 y 坐标设置为Text
的中心,并在整个动画过程中保持不变。否则,它将设置为最后一个添加的字母的中心。**leave_cursor_on** – 动画结束后是否显示光标。
**提示::** (..) – 目前仅适用于 class:~.Text,不适用于 class:~.MathTex。
**text** (Text)
示例
示例: DeletingTextExample ¶
from manim import * class DeletingTextExample(Scene): def construct(self): text = Text("Deleting", color=PURPLE).scale(1.5).to_edge(LEFT) cursor = Rectangle( color = GREY_A, fill_color = GREY_A, fill_opacity = 1.0, height = 1.1, width = 0.5, ).move_to(text[0]) # Position the cursor self.play(UntypeWithCursor(text, cursor)) self.play(Blink(cursor, blinks=2))
class DeletingTextExample(Scene): def construct(self): text = Text("Deleting", color=PURPLE).scale(1.5).to_edge(LEFT) cursor = Rectangle( color = GREY_A, fill_color = GREY_A, fill_opacity = 1.0, height = 1.1, width = 0.5, ).move_to(text[0]) # Position the cursor self.play(UntypeWithCursor(text, cursor)) self.play(Blink(cursor, blinks=2))
参考:
Blink
方法
属性
运行时