M

manim

Verified

by manim-community · Updated Apr 16, 2026

opus
3.5Kin11.8Kout
$1.147m 30s

Comprehensive guide for Manim Community - Python framework for creating mathematical animations and educational videos with programmatic control

manimpythonanimationmathvideovisualization

See It In Action

1 turns·claude
The project codebase is in your current working directory. Explore the files to understand the code before making changes. need a quick gradient descent explainer for today's new-hire orientation, show it on a parabola with the equation too, and send a video plus a preview still

I'll start by exploring the codebase and understanding the project structure, then create the Manim animation.

Now let me read the key reference files to nail the Manim API usage.

Now I'll create the Manim script and render both the video and a preview still.

Now let me render the video (medium quality) and the still frame in parallel.

Manim isn't installed. Let me install it.

Manim is installed. Now let me render the video and the still frame.

LaTeX tooling (dvisvgm) is missing. I'll rewrite the script to use Text and MathTex-free approaches so it renders without a TeX distribution.

Good, dvisvgm is installed now. Let me render both the video and the still frame.

The standalone dvisvgm can't find the TeX config. Let me check if texlive ships its own version.

The dvisvgm/texlive integration is broken. The fastest fix is to rewrite the script using Text objects instead of MathTex to avoid LaTeX entirely.

The axis numbers use LaTeX internally. Let me fix the dvisvgm configuration issue -- it needs to find texlive's kpathsea config.

The dvisvgm issue persists. Let me take the clean approach: disable LaTeX entirely and use only Text objects for everything including axis labels.

Video rendered successfully. Now let me render the preview still.

Both outputs are ready. Let me verify the files and show the preview.

Both files are ready:

OutputPathSize
Video (720p 30fps)media/videos/gradient_descent/720p30/GradientDescent.mp41.2 MB
Preview still (PNG)media/images/gradient_descent/GradientDescent_ManimCE_v0.20.1.png69 KB

The animation walks through:

  1. Title card -- "Gradient Descent"
  2. Parabola f(x) = x² plotted on labeled axes
  3. Update rule displayed: x_new = x_old - α · f'(x) with derivative f'(x) = 2x and learning rate α = 0.3
  4. 7 descent steps starting at x = 3.50 -- each step shows a red tangent line at the current point, the slope value, and the x-value update before the dot slides down the curve
  5. Minimum highlight with a green flash at x = 0
  6. Closing summary text
Claude Sonnet 4.6

External Tools

ToolType
python3binary

Permissions

ScopeDescription
filesystem:read
filesystem:write
process:spawn

SKILL.md

Manim Community - Mathematical Animation Engine

Comprehensive skill set for creating mathematical animations using Manim Community, a Python framework for creating explanatory math videos programmatically, popularized by 3Blue1Brown.

When to use

Use this skill whenever you are dealing with Manim code to obtain domain-specific knowledge about:

  • Creating mathematical animations and visualizations
  • Building educational video content programmatically
  • Working with geometric shapes and transformations
  • Animating LaTeX equations and mathematical formulas
  • Creating graphs, charts, and coordinate systems
  • Implementing scene-based animation sequences
  • Rendering high-quality mathematical diagrams
  • Building explanatory visual content for teaching

Core Concepts

Manim allows you to create animations using:

  • Scenes: Canvas for your animations where you orchestrate mobjects
  • Mobjects: Mathematical objects that can be displayed (shapes, text, equations)
  • Animations: Transformations applied to mobjects (Write, Create, Transform, FadeIn)
  • Transforms: Morphing between different states of mobjects
  • LaTeX Integration: Native support for rendering mathematical notation
  • Python Simplicity: Use Python to programmatically specify animation behavior

Key Features

  • Precise mathematical object positioning and transformations
  • Native LaTeX rendering for equations and formulas
  • Extensive shape library (circles, rectangles, arrows, polygons)
  • Coordinate systems and function graphing
  • Boolean operations on geometric shapes
  • Camera controls and scene management
  • High-quality video rendering
  • IPython/Jupyter notebook integration
  • VS Code extension with live preview

How to use

Read individual rule files for detailed explanations and code examples:

Core Concepts

For additional topics including transforms, timing, shapes, coordinate systems, 3D animations, camera movement, and advanced features, refer to the comprehensive Manim Community documentation.

Quick Start Example

from manim import *

class SquareToCircle(Scene):
    def construct(self):
        # Create a square
        square = Square()
        square.set_fill(BLUE, opacity=0.5)

        # Create a circle
        circle = Circle()
        circle.set_fill(RED, opacity=0.5)

        # Animate square creation
        self.play(Create(square))
        self.wait(1)

        # Transform square into circle
        self.play(Transform(square, circle))
        self.wait(1)

        # Fade out
        self.play(FadeOut(square))

Render with: manim -pql script.py SquareToCircle

Best Practices

  1. Inherit from Scene - All animations should be in a class inheriting from Scene
  2. Use construct() method - Place all animation code inside the construct() method
  3. Think in layers - Add mobjects to the scene before animating them
  4. Use self.play() - Animate mobjects using self.play(Animation(...))
  5. Test with low quality - Use -ql flag for faster preview renders
  6. Leverage LaTeX - Use Tex() and MathTex() for mathematical notation
  7. Group related objects - Use VGroup to manage multiple mobjects together
  8. Preview frequently - Use -p flag to automatically open rendered videos

Command Line Usage

# Preview at low quality (fast)
manim -pql script.py SceneName

# Render at high quality
manim -pqh script.py SceneName

# Save last frame as image
manim -s script.py SceneName

# Render multiple scenes
manim script.py Scene1 Scene2

Resources

FAQ

What does manim do?

Comprehensive guide for Manim Community - Python framework for creating mathematical animations and educational videos with programmatic control

When should I use manim?

Use it when you need a repeatable workflow that produces source code, image output, downloadable file.

What does manim output?

In the evaluated run it produced source code, image output, downloadable file.

How do I install or invoke manim?

npx skills add https://github.com/davila7/claude-code-templates --skill manim

Which agents does manim support?

Claude Code

What tools, channels, or permissions does manim need?

It uses python3; channels commonly include code, image, file, text; permissions include filesystem:read, filesystem:write, process:spawn.

Is manim safe to install?

Static analysis marked this skill as medium risk; review side effects and permissions before enabling it.

How is manim different from an MCP or plugin?

A skill packages instructions and workflow conventions; tools, MCP servers, and plugins are dependencies the skill may call during execution.

Does manim outperform not using a skill?

About manim

When to use manim

When you need to write or edit Manim scenes for mathematical animations. When you want to render explanatory visuals or educational videos from Python code. When working with LaTeX-based equations, graphs, or geometric animation sequences in Manim.

When manim is not the right choice

When you only need general-purpose video editing rather than programmatic animation generation. When the environment cannot run Python-based rendering workflows.

What it produces

Produces source code, image output and downloadable file.

Install

npx skills add https://github.com/davila7/claude-code-templates --skill manim

Invoke: Ask Claude Code to use manim for the task.