TypeWithCursor

完全限定名: manim.animation.creation.TypeWithCursor

class TypeWithCursor(mobject=None, *args, use_override=True, **kwargs)[源码]

基类: AddTextLetterByLetter

AddTextLetterByLetter 类似,但在末尾添加了一个额外的光标 Mobject。

参数:

示例

示例: InsertingTextExample

from manim import *

class InsertingTextExample(Scene):
    def construct(self):
        text = Text("Inserting", 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(TypeWithCursor(text, cursor))
        self.play(Blink(cursor, blinks=2))
class InsertingTextExample(Scene):
    def construct(self):
        text = Text("Inserting", 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(TypeWithCursor(text, cursor))
        self.play(Blink(cursor, blinks=2))

参考: Blink

方法

开始

开始动画。

从场景中清理

动画完成后清理 Scene>。

finish

完成动画。

update_submobject_list

属性

run_time

_original__init__(text, cursor, buff=0.1, keep_cursor_y=True, leave_cursor_on=True, time_per_char=0.1, reverse_rate_function=False, introducer=True, **kwargs)

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

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

  • cursor (Mobject)

  • buff (浮点数)

  • keep_cursor_y (bool)

  • leave_cursor_on (bool)

  • time_per_char (float)

返回类型:

begin()[源码]

开始动画。

此方法在动画播放时立即调用。应尽可能多的初始化,特别是任何 mobject 复制,都应在此方法中进行。

返回类型:

clean_up_from_scene(scene)[源码]

动画完成后清理 Scene>。

这包括如果动画是一个移除器,则 remove() 动画的 Mobject>。

参数:

scene (场景) – 动画应从中清理的场景。

返回类型:

finish()[源码]

完成动画。

此方法在动画结束时调用。

返回类型: