Animation

This module provides custom animations and animation helpers that can be played inside a Scene.

Inheritance diagram of manim_extensions.animations

manim_extensions.animations.VisDrawArc(scene, arc, axis=array([0., 0., 1.]), run_time=1)[source]

Visualised arc-drawing animation.

Plays an animation in scene that draws arc while simultaneously showing a moving dot travelling along the arc and a dashed radius line.

Note

This is a convenience function — call it directly; there is no need to wrap it in self.play().

Parameters:
  • scene (Scene) – The Manim scene in which the animation is played.

  • arc (Arc) – The arc to draw.

  • axis (ndarray) – Rotation axis. OUT gives counter‑clockwise motion, IN gives clockwise motion. Defaults to OUT.

  • run_time (float) – Duration of the animation in seconds. Defaults to 1.

Return type:

None

Examples

Example: VisDrawArcDocExample

from manim import *
from manim_extensions import VisDrawArc

class VisDrawArcDocExample(Scene):
    def construct(self):
        arc = Arc(start_angle=0, angle=PI, radius=2, color=YELLOW)
        VisDrawArc(self, arc, axis=OUT, run_time=2)
        self.wait()
from manim import *
from manim_extensions import VisDrawArc

class VisDrawArcDocExample(Scene):
    def construct(self):
        arc = Arc(start_angle=0, angle=PI, radius=2, color=YELLOW)
        VisDrawArc(self, arc, axis=OUT, run_time=2)
        self.wait()

class manim_extensions.animations.TypeWriter(mobject, interval=2, **kwargs)[source]

Bases: Animation

Typewriter effect animation.

Reveals the content of a Text object character by character, simulating a typewriter. The total run time is automatically calculated from the character count and interval unless an explicit run_time is passed in kwargs.

Inheritance diagram of manim_extensions.animations.TypeWriter

Parameters:
  • mobject (Text) – The Text object to animate.

  • interval (float) – Display interval between consecutive characters in seconds. Defaults to 2.

  • **kwargs – Additional keyword arguments forwarded to Animation.

interval

The stored interval between characters.

Type:

float

char_count

Number of characters in mobject.

Type:

int

Examples

Example: TypeWriterDocExample

from manim import *
from manim_extensions import TypeWriter

class TypeWriterDocExample(Scene):
    def construct(self):
        text = Text("Hello World")
        self.play(TypeWriter(text, interval=0.1))
        self.wait()
from manim import *
from manim_extensions import TypeWriter

class TypeWriterDocExample(Scene):
    def construct(self):
        text = Text("Hello World")
        self.play(TypeWriter(text, interval=0.1))
        self.wait()

__init__(mobject, interval=2, **kwargs)[source]
interpolate_mobject(alpha)[source]

Set the visible characters based on the animation progress alpha.

This method is called internally by Manim during the animation. It reveals characters one by one as alpha goes from 0 to 1.

Examples

Return type:

Text