恢复

限定名称: manim.animation.transform.Restore

Restore(mobject=None, *args, use_override=True, **kwargs)[源]

基类: ApplyMethod

将一个mobject变换到其最后保存的状态。

要保存mobject的状态,请使用save_state()方法。

示例

示例: RestoreExample

from manim import *

class RestoreExample(Scene):
    def construct(self):
        s = Square()
        s.save_state()
        self.play(FadeIn(s))
        self.play(s.animate.set_color(PURPLE).set_opacity(0.5).shift(2*LEFT).scale(3))
        self.play(s.animate.shift(5*DOWN).rotate(PI/4))
        self.wait()
        self.play(Restore(s), run_time=2)
class RestoreExample(Scene):
    def construct(self):
        s = Square()
        s.save_state()
        self.play(FadeIn(s))
        self.play(s.animate.set_color(PURPLE).set_opacity(0.5).shift(2*LEFT).scale(3))
        self.play(s.animate.shift(5*DOWN).rotate(PI/4))
        self.wait()
        self.play(Restore(s), run_time=2)

方法

属性

路径弧

路径函数

运行时间

参数:

mobject (Mobject)

_original__init__(mobject, **kwargs)

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

参数:

mobject (Mobject)

返回类型: