Manim Elite
Streamline your workflow with this comprehensive, guide, manim, community. Includes structured workflows, validation checks, and reusable patterns for video.
Manim Mathematical Animation
A mathematical animation skill for creating publication-quality math visualizations, educational videos, and animated proofs using the Manim library for Python.
When to Use
Choose Manim when:
- Creating animated mathematical visualizations for educational content
- Building step-by-step proof animations with equations and diagrams
- Generating video content explaining mathematical concepts visually
- Producing conference presentation animations with LaTeX-quality typography
Consider alternatives when:
- Creating static math diagrams — use TikZ, Matplotlib, or Desmos
- Building interactive web visualizations — use D3.js or Observable
- Making general-purpose motion graphics — use After Effects or Motion
Quick Start
# Install Manim Community Edition pip install manim # Verify installation manim --version
from manim import * class QuadraticFormula(Scene): def construct(self): # Title title = Text("The Quadratic Formula", font_size=48) self.play(Write(title)) self.wait() self.play(title.animate.to_edge(UP)) # General form general = MathTex("ax^2 + bx + c = 0") self.play(Write(general)) self.wait() # Derivation steps steps = VGroup( MathTex("x^2 + \\frac{b}{a}x = -\\frac{c}{a}"), MathTex("x^2 + \\frac{b}{a}x + \\frac{b^2}{4a^2} = \\frac{b^2}{4a^2} - \\frac{c}{a}"), MathTex("\\left(x + \\frac{b}{2a}\\right)^2 = \\frac{b^2 - 4ac}{4a^2}"), ).arrange(DOWN, buff=0.5) self.play( general.animate.shift(UP * 1.5), *[Write(step) for step in steps], run_time=3 ) self.wait() # Final formula formula = MathTex( "x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}", font_size=56 ).set_color(YELLOW) self.play( FadeOut(general), FadeOut(steps), Write(formula), run_time=2 ) # Highlight discriminant discriminant = MathTex("b^2 - 4ac", color=RED, font_size=40) discriminant.next_to(formula, DOWN, buff=0.8) label = Text("Discriminant", font_size=24, color=RED) label.next_to(discriminant, DOWN) self.play(Write(discriminant), Write(label)) self.wait(2) class GraphAnimation(Scene): def construct(self): # Create axes axes = Axes( x_range=[-4, 4, 1], y_range=[-2, 8, 1], x_length=8, y_length=5, axis_config={"include_numbers": True} ) labels = axes.get_axis_labels(x_label="x", y_label="f(x)") # Plot function graph = axes.plot(lambda x: x**2, color=BLUE) graph_label = axes.get_graph_label(graph, "f(x) = x^2") self.play(Create(axes), Write(labels)) self.play(Create(graph), Write(graph_label)) # Animate tangent line x_tracker = ValueTracker(-3) tangent = always_redraw(lambda: axes.get_secant_slope_group( x=x_tracker.get_value(), graph=graph, dx=0.01, secant_line_color=RED, secant_line_length=4 )) dot = always_redraw(lambda: Dot( axes.c2p(x_tracker.get_value(), x_tracker.get_value()**2), color=YELLOW )) self.play(Create(tangent), Create(dot)) self.play(x_tracker.animate.set_value(3), run_time=5, rate_func=smooth) self.wait()
Core Concepts
Animation Types
| Animation | Usage | Example |
|---|---|---|
Write | Draw text/equations stroke by stroke | Write(MathTex("x^2")) |
Create | Draw shapes and graphs | Create(circle) |
FadeIn/FadeOut | Opacity transitions | FadeIn(obj, shift=UP) |
Transform | Morph one object into another | Transform(eq1, eq2) |
ReplacementTransform | Replace with smooth morph | ReplacementTransform(a, b) |
Indicate | Flash highlight an object | Indicate(formula) |
MoveToTarget | Animate to preset target position | obj.animate.shift(RIGHT) |
AnimationGroup | Play multiple animations together | AnimationGroup(a, b) |
Scene Composition Patterns
class PythagoreanProof(Scene): def construct(self): # Create the right triangle triangle = Polygon( ORIGIN, RIGHT * 3, RIGHT * 3 + UP * 4, color=WHITE, fill_opacity=0.2 ) # Label sides a_label = MathTex("a=3").next_to(triangle, DOWN) b_label = MathTex("b=4").next_to(triangle, RIGHT) c_label = MathTex("c=5").move_to( triangle.get_center() + UP * 0.5 + LEFT * 0.5 ).rotate(np.arctan(4/3)) # Build squares on each side a_square = Square(side_length=3, color=BLUE, fill_opacity=0.3) a_square.next_to(triangle, DOWN, buff=0) b_square = Square(side_length=4, color=GREEN, fill_opacity=0.3) b_square.next_to(triangle, RIGHT, buff=0) c_square = Square(side_length=5, color=RED, fill_opacity=0.3) # Position along hypotenuse # Animate the proof self.play(Create(triangle)) self.play(Write(a_label), Write(b_label), Write(c_label)) self.wait() self.play(Create(a_square), Create(b_square)) # Show area equations eq = MathTex("a^2 + b^2 = c^2").to_edge(UP) eq_nums = MathTex("9 + 16 = 25").next_to(eq, DOWN) self.play(Write(eq)) self.play(Write(eq_nums)) self.wait(2)
Configuration
| Option | Description | Default |
|---|---|---|
quality | Render quality: low_quality, medium, high_quality, 4k | "medium" |
fps | Frames per second | 30 |
background_color | Scene background color | BLACK |
pixel_width | Output video width | 1920 |
pixel_height | Output video height | 1080 |
tex_template | LaTeX template for math rendering | Default |
output_dir | Directory for rendered videos | "media/" |
preview | Auto-open rendered video | true |
Best Practices
- Plan your animation timeline on paper first by sketching keyframes and noting which objects appear, transform, and exit in each phase — jumping directly into code leads to disjointed animations with poor pacing
- Use
VGroupto organize related objects so you can position, animate, and transform them as a unit; this keeps scene composition manageable as complexity grows - Render at low quality during development with
manim -ql scene.py SceneNameand only switch to high quality for final output — high-quality rendering takes 10-50x longer and slows iteration - Use
always_redrawfor dynamic objects that should update continuously based on aValueTrackervalue, like moving tangent lines or animated graphs that respond to parameter changes - Break complex animations into methods within the Scene class to maintain readability; a single
constructmethod with hundreds of lines becomes impossible to debug and modify
Common Issues
LaTeX rendering errors: Manim uses LaTeX for math typesetting, and invalid LaTeX commands cause cryptic errors. Test complex equations in an online LaTeX editor first, ensure your LaTeX distribution includes the required packages, and check for unescaped special characters in MathTex strings.
Object positioning and overlap: Objects placed with absolute coordinates break when other elements are added or removed. Use relative positioning methods like .next_to(), .to_edge(), and .move_to() with references to other objects rather than hardcoded coordinates.
Slow render times for complex scenes: Scenes with many objects, high-resolution textures, or long durations take significant rendering time. Split long animations into shorter scenes that can be concatenated, reduce unnecessary objects, and use simpler shapes where high-detail objects are not visible at the rendered resolution.
Reviews
No reviews yet. Be the first to review this template!
Similar Templates
Full-Stack Code Reviewer
Comprehensive code review skill that checks for security vulnerabilities, performance issues, accessibility, and best practices across frontend and backend code.
Test Suite Generator
Generates comprehensive test suites with unit tests, integration tests, and edge cases. Supports Jest, Vitest, Pytest, and Go testing.
Pro Architecture Workspace
Battle-tested skill for architectural, decision, making, framework. Includes structured workflows, validation checks, and reusable patterns for development.