animation¶
Animate mobjects.
Classes
Add Mobjects to a scene, without animating them in any other way. |
|
An animation. |
|
A "no operation" animation. |
Functions
- override_animation(animation_class)[source]¶
Decorator used to mark methods as overrides for specific
Animationtypes.Should only be used to decorate methods of classes derived from
Mobject.Animationoverrides get inherited to subclasses of theMobjectwho defined them. They don’t override subclasses of theAnimationthey override.See also
- Parameters:
animation_class (type[Animation]) – The animation to be overridden.
- Returns:
The actual decorator. This marks the method as overriding an animation.
- Return type:
Callable[[Callable], Callable]
Examples
Example: 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)[source]¶
Returns either an unchanged animation, or the animation built from a passed animation factory.
Examples
>>> 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