LaggedStart

完全限定名: manim.animation.composition.LaggedStart

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

基类: AnimationGroup

根据 lag_ratio 调整一系列 Animation 的时间。

参数:
  • animations (Animation) – 要播放的 Animation 对象序列。

  • lag_ratio (float)

    定义动画应用于子对象后的延迟。 lag_ration.nn 意味着当前动画播放了 nnn% 后,下一个动画将开始播放。默认为 0.05,表示当前动画播放了 5% 后,下一个动画将开始。

    这不影响动画的总运行时长。相反,单个动画的运行时长会被调整,以使整个动画具有定义的运行时长。

示例

示例: LaggedStartExample

from manim import *

class LaggedStartExample(Scene):
    def construct(self):
        title = Text("lag_ratio = 0.25").to_edge(UP)

        dot1 = Dot(point=LEFT * 2 + UP, radius=0.16)
        dot2 = Dot(point=LEFT * 2, radius=0.16)
        dot3 = Dot(point=LEFT * 2 + DOWN, radius=0.16)
        line_25 = DashedLine(
            start=LEFT + UP * 2,
            end=LEFT + DOWN * 2,
            color=RED
        )
        label = Text("25%", font_size=24).next_to(line_25, UP)
        self.add(title, dot1, dot2, dot3, line_25, label)

        self.play(LaggedStart(
            dot1.animate.shift(RIGHT * 4),
            dot2.animate.shift(RIGHT * 4),
            dot3.animate.shift(RIGHT * 4),
            lag_ratio=0.25,
            run_time=4
        ))
class LaggedStartExample(Scene):
    def construct(self):
        title = Text("lag_ratio = 0.25").to_edge(UP)

        dot1 = Dot(point=LEFT * 2 + UP, radius=0.16)
        dot2 = Dot(point=LEFT * 2, radius=0.16)
        dot3 = Dot(point=LEFT * 2 + DOWN, radius=0.16)
        line_25 = DashedLine(
            start=LEFT + UP * 2,
            end=LEFT + DOWN * 2,
            color=RED
        )
        label = Text("25%", font_size=24).next_to(line_25, UP)
        self.add(title, dot1, dot2, dot3, line_25, label)

        self.play(LaggedStart(
            dot1.animate.shift(RIGHT * 4),
            dot2.animate.shift(RIGHT * 4),
            dot3.animate.shift(RIGHT * 4),
            lag_ratio=0.25,
            run_time=4
        ))

方法

属性

run_time

_original__init__(*animations, lag_ratio=0.05, **kwargs)

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

参数: