UntypeWithCursor

完整名称: manim.animation.creation.UntypeWithCursor

UntypeWithCursor(mobject=None, *args, use_override=True, **kwargs)[源代码]

基类: TypeWithCursor

类似于 RemoveTextLetterByLetter,但在末尾带有一个额外的光标 Mobject。

参数:
  • **time_per_char** (float) – 字母出现频率。

  • **cursor** (VMobject | None) – 在最后一个添加的字母后显示的光标Mobject

  • **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

方法

属性

运行时

_original__init__(text, cursor=None, time_per_char=0.1, reverse_rate_function=True, introducer=False, remover=True, **kwargs)

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

参数:
  • **text** (Text)

  • **cursor** (VMobject | None)

  • **time_per_char** (float)

返回类型: