manim.mobject.mobject

Base classes for objects that can be displayed.

Classes

Group

Groups together multiple Mobjects.

Mobject

Mathematical Object: base class for objects that can be displayed on screen.

Functions

override_animate(method)[source]

Decorator for overriding method animations.

This allows to specify a method (returning an Animation) which is called when the decorated method is used with the .animate syntax for animating the application of a method.

Note

Overridden methods cannot be combined with normal or other overridden methods using method chaining with the .animate syntax.

Examples

AnimationOverrideExample
from manim import Circle, Scene, ShowCreation, Text, Uncreate, VGroup

class CircleWithContent(VGroup):
    def __init__(self, content):
        super().__init__()
        self.circle = Circle()
        self.content = content
        self.add(self.circle, content)
        content.move_to(self.circle.get_center())

    def clear_content(self):
        self.remove(self.content)
        self.content = None

    @override_animate(clear_content)
    def _clear_content_animation(self):
        anim = Uncreate(self.content)
        self.clear_content()
        return anim

class AnimationOverrideExample(Scene):
    def construct(self):
        t = Text("hello!")
        my_mobject = CircleWithContent(t)
        self.play(ShowCreation(my_mobject))
        self.play(my_mobject.animate.clear_content())
        self.wait()