动画¶
动画对象。
类
函数
- override_animation(animation_class)[source]¶
用于将方法标记为特定
Animation类型的覆盖的装饰器。应仅用于装饰从
Mobject派生的类的方法。Animation的重写会继承到定义了它们的Mobject的子类中。它们不会重写它们所重写的Animation的子类。- Parameters:
animation_class (类型[动画]) – 要被覆盖的动画。
- Returns:
实际的装饰器。这标记了该方法为覆盖动画。
- Return type:
Callable[[Callable], Callable]
示例
示例:OverrideAnimationExample ¶
from manim import * class MySquare(Square): @override_animation(FadeIn) def _fade_in_override(self, **kwargs): return Create(self, **kwargs) class OverrideAnimationExample(Scene): def construct(self): self.play(FadeIn(MySquare()))
class MySquare(Square): @override_animation(FadeIn) def _fade_in_override(self, **kwargs): return Create(self, **kwargs) class OverrideAnimationExample(Scene): def construct(self): self.play(FadeIn(MySquare()))
- prepare_animation(anim)[来源]¶
返回一个未更改的动画,或者从传递的动画工厂构建的动画。
示例
>>> from manim import Square, FadeIn >>> s = Square() >>> prepare_animation(FadeIn(s)) FadeIn(Square)
>>> prepare_animation(s.animate.scale(2).rotate(42)) _MethodAnimation(Square)
>>> prepare_animation(42) Traceback (most recent call last): ... TypeError: Object 42 cannot be converted to an animation