-
Notifications
You must be signed in to change notification settings - Fork 1
Animation Reference
real-time-manim is a Python + native Vulkan rendering backend for ManimCE. You
drive it by opening an MLWindow, binding it to a Scene,
and calling win.play(...) on Manim animations. Every animation listed below is
importable from real_time_manim.vulkan_bind and has been verified against the
installed source.
The Scene is just an object that holds the window and the mobjects; it is not
rendered by Manim's own renderer. You open a window, assign it to self, play
animations, and close it:
from manim import Scene, Square, BLUE
from real_time_manim.vulkan_bind import MLWindow, Create, Wait
class Example(Scene):
def construct(self):
win = MLWindow(960, 540) # opens a live Vulkan window
win.scene = self # bind the scene to the window
sq = Square(side_length=1.5, color=BLUE).set_fill(BLUE, 0.6)
win.play(Create(sq), run_time=1.0)
win.play(Wait(0.5))
win.close()All snippets below are fragments meant to live inside a construct() like the
one above; create the mobjects they reference first. To render to an MP4
instead of a visible window, pass your scene to
real_time_manim.record.fast_record_scene.
Mobjects are Manim objects that the engine routes to native per-type Vulkan "sender" methods. The following common shapes are handled by dedicated senders; anything else falls back to generic bezier/tessellation rendering.
| Manim mobject | Engine dispatch | Notes |
|---|---|---|
Square |
dedicated square sender | side_length |
Rectangle |
dedicated rectangle sender |
width, height
|
Circle |
dedicated circle sender | radius |
Ellipse |
dedicated ellipse sender |
width, height
|
Line |
dedicated line sender | two points, no fill |
DashedLine |
dedicated dashed-line sender |
dash_length, dashed_ratio
|
Arrow |
dedicated arrow sender | shaft + triangular tip |
Polygon / Polygram
|
polygon (straight-edge) sender | arbitrary vertex lists |
Triangle |
polygon sender |
Triangle is a Polygon
|
Arc |
dedicated arc sender |
start_angle, angle
|
Dot |
dedicated dot sender | small filled circle |
Point |
dedicated point sender | single pixel |
Text |
text/glyph senders | TrueType, per-character reveal |
MathTex |
text/glyph senders | LaTeX or Unicode, see Math Rendering |
VGroup / Group
|
routed to its children | container for grouped mobjects |
These take fill/stroke color and opacity via the usual Manim API
(set_fill, set_stroke), and the engine picks the right sender automatically.
Draws a mobject by tracing its outline, progressively revealing it. This is the workhorse for building a shape into the scene.
win.play(Create(sq)) # default speed
win.play(Create(circle, run_time=2.0)) # slower drawThe reverse of Create: erases a mobject by untracing its outline, then
removes it from the scene.
win.play(Uncreate(sq, run_time=1.5))Draws the stroke first, then fills the interior once the outline completes.
win.play(DrawBorderThenFill(sq, run_time=2.0))Reveals the submobjects of a group one at a time, keeping earlier ones visible.
group = VGroup(Dot(), Square(), Triangle())
win.play(ShowIncreasingSubsets(group, run_time=2.0))Spirals a shape (or group) into position from outside the frame while fading it in.
win.play(SpiralIn(VGroup(sq, circle)))Adds mobjects to the scene instantly (default run_time=0), no drawn-in
transition.
win.play(Add(sq, circle))Holds the current frame for a given duration.
win.play(Wait(0.5))FadeIn fades a mobject into view; FadeOut fades it out. Both accept an
optional shift to slide from/to, target_position, and scale.
win.play(FadeIn(sq))
win.play(FadeIn(sq, shift=UP * 2)) # slide in from above
win.play(FadeOut(sq, shift=DOWN * 2))Cross-fades one mobject into another, optionally stretching non-uniformly to
fit and choosing which dimension to match via dim_to_match.
win.play(FadeTransform(square, circle, run_time=2.0))Like FadeTransform, but cross-fades each pair of submobjects individually
instead of the group as a whole.
win.play(FadeTransformPieces(VGroup(sq, tri), VGroup(circle, star)))Morphs a source mobject into a target mobject in place (the source object stays
in the scene and visually becomes the target). Supports path_arc for an arc
interpolation path.
win.play(Transform(square, circle, run_time=1.5))Transforms a source into a target and removes the source from the scene, replacing it with the target.
win.play(ReplacementTransform(square, triangle, run_time=1.5))Matches submobjects by point similarity and transforms the matched pieces, which gives smooth per-letter morphs between two pieces of text or shape groups.
win.play(TransformMatchingShapes(Text("the morse code"),
Text("here come dots")))Matches MathTex submobjects by their LaTeX substrings, so equation terms slide
into new positions during a rewrite.
eq = MathTex(r"x^2 + y^2 = r^2")
win.play(TransformMatchingTex(eq, MathTex(r"r^2 = x^2 + y^2")))Moves a mobject to its saved .target attribute. Assign mob.target = ...
first, then animate to it.
sq.target = Circle().shift(RIGHT * 3)
win.play(MoveToTarget(sq))Moves a mobject along the path of another mobject (commonly a Dot around a
Circle).
win.play(MoveAlongPath(dot, circle))Deforms a mobject with a continuous function homotopy(x, y, z, t) evaluated
every frame, where t runs 0 to 1 over the animation.
def warp(x, y, z, t):
return np.array([x + np.sin(t * PI) * y, y, z])
win.play(Homotopy(warp, sq))Continuously rotates a mobject over the whole animation duration (default: one
full turn). Supports axis, about_point, and about_edge.
win.play(Rotating(sq, run_time=3.0))
win.play(Rotating(arrow, PI, about_point=arrow.get_start()))Rotates a mobject by a fixed angle, interpolated smoothly over run_time.
Optional about_point selects the pivot.
win.play(Rotate(sq, PI / 4))
win.play(Rotate(sq, 90 * DEGREES, about_point=ORIGIN))Scales a mobject up from its center point.
win.play(GrowFromCenter(sq))GrowFromEdge grows a mobject from a given edge; GrowFromPoint grows it from
an arbitrary point.
win.play(GrowFromEdge(sq, DOWN))
win.play(GrowFromPoint(sq, LEFT * 3))Grows an arrow from its tail toward its tip.
win.play(GrowArrow(Arrow(LEFT, RIGHT)))Spins a mobject while growing it in from its center.
win.play(SpinInFromNothing(sq))Write reveals text (or any mobject) character by character, simulating
handwriting. Unwrite erases it again. reverse=True flips the direction.
win.play(Write(Text("Hello World"), run_time=2.0))
win.play(Unwrite(Text("Hello World")))TypeWithCursor types text one character at a time while a cursor mobject sits
at the insertion point; UntypeWithCursor deletes it character by character.
text = Text("Hello")
cursor = Dot(color=WHITE).scale(0.3)
win.play(TypeWithCursor(text, cursor))
win.play(UntypeWithCursor(text, cursor))A Text mobject that renders a formatted decimal number (a common companion to
animated counters). Animate it with any reveal/fade animation, or update it
between plays.
count = TextDecimalNumber(0, num_decimal_places=2)
win.play(Create(count))Briefly scales a mobject up and back to draw attention, optionally tinting it a color (default yellow).
win.play(Indicate(sq))
win.play(Indicate(circle, color=RED))Sweeps a bright band along a mobject's path for a moment, emphasizing a curve or outline without changing it.
win.play(ShowPassingFlash(circle))Draws a shape (a Rectangle by default) around a mobject to enclose it.
win.play(Circumscribe(sq))Makes a mobject blink by fading it off and back on; handy for eyes or cursors.
win.play(Blink(Dot()))Passes a sinusoidal wave distortion through a mobject, e.g. making a shape ripple along a direction.
win.play(ApplyWave(sq))Plays several animations simultaneously, optionally staggering their starts with
lag_ratio.
win.play(AnimationGroup(Create(sq), FadeIn(circle), lag_ratio=0.5))Plays a sequence of animations one after another as a single play.
win.play(Succession(Create(sq), Transform(sq, circle), FadeOut(circle)))-
MathTexdefaults to real LaTeX rendering (_USE_NATIVE_MATHTEX = Falseinreal_time_manim.vulkan_bind). Flip that flag toTrueto use the fast, native Unicode mode that needs no TeX installation. See Math Rendering for both modes, the Unicode mapping, and cache helpers. -
Textrenders TrueType fonts with per-character submobjects, so it works withWrite,TypeWithCursor, and the text senders. Color, size, weight and slant are set through the standard Manim API.
Recording and automatic cleanup of transient media/ output are handled by the
real_time_manim.record module -- fast_record_scene for offline (hidden)
rendering and record_scene for a visible live window. See
Recording for the full option set, and the
API Reference for the animation classes and window API.