What are Manim Animations?
Manim is a Python library created by 3Blue1Brown for creating mathematical and educational animations programmatically.Key Features
- Precise control: Animations defined through code
- Mathematical accuracy: Perfect for equations and diagrams
- Reproducible: Same code produces identical results
- Professional quality: Smooth, polished animations
backend/generators/manim_generator.py
When Animations Are Generated
The AI automatically determines which slides benefit from animation based on:Supported Topics
Physics Concepts- Force diagrams and vectors
- Motion and acceleration
- Energy transformations
- Wave mechanics
- Newton’s laws demonstrations
- Geometric proofs
- Equation transformations
- Graph plotting
- Algebraic manipulations
- Pythagorean theorem visualizations
- Sorting algorithms
- Data structure operations
- Graph traversals
- Recursion visualization
- Binary search demonstrations
- Molecular structures
- Chemical reactions
- Cell processes
- DNA replication
Animation Generation Process
AI analyzes slide content
The system examines:
- Slide topic and description
- Complexity of concept
- Potential for visual representation
- Available animation duration
Generate Manim code
If animation is beneficial, the AI:
- Reads animation guidelines from
backend/MANIM_CODE_GUIDE.md - Generates Python code following strict rules
- Validates code structure
- Saves code to disk
backend/generators/manim_generator.py:26-78Render animation
The Manim library:
- Executes the Python code
- Renders frames at 60fps
- Outputs MP4 video file
- Includes in final presentation
Manim Code Guidelines
The system follows strict guidelines to ensure reliable animation generation.Approved Objects Only
Animations can ONLY use these Manim objects: Basic Shapesbackend/MANIM_CODE_GUIDE.md:56-91
Prohibited Objects
Coordinate Rules
All coordinates must be 3D (X, Y, Z): Correct:backend/MANIM_CODE_GUIDE.md:118-142
Animation Methods
Manim provides various animation types:Creation Animations
Transformation Animations
Removal Animations
Timing Control
backend/MANIM_CODE_GUIDE.md:144-166
Animation Template
All animations follow this structure:backend/MANIM_CODE_GUIDE.md:169-217
Viewing Animation Details
In the Slide Editor, animated slides show:Animation Preview
- Live rendering of the animation
- Plays automatically in loop
- Shows actual animation timing
- Updates when code is edited
frontend/src/components/SlideEditor.jsx:628-635
Animation Description
A text description explaining:- What the animation demonstrates
- Key visual elements
- Timing and transitions
frontend/src/components/SlideEditor.jsx:638-645
Animation Code Viewer
Expand to see/edit:- Full Python/Manim code
- Syntax highlighting
- Real-time validation
- Direct editing capability
frontend/src/components/SlideEditor.jsx:647-663
Editing Animation Code
Access the code editor
In the Slide Editor:
- Find a slide with animation
- Locate the Animation section
- Click View/Edit Animation Code
- The code editor expands
Make your changes
- Edit directly in the textarea
- Follow Manim syntax rules
- Keep the class name as
SlideAnimation - Maintain the
constructmethod
Animation Limitations
Technical Constraints
Rendering Time- Each animation takes 10-30 seconds to render
- Complex animations take longer
- Rendering happens server-side
- Animations increase final video size
- More animations = larger file
- Typical animation: 2-5 MB
- Animations are 5-10 seconds each
- Matched to narration timing
- Cannot exceed slide duration
Content Limitations
No External Files- Cannot use SVG files
- Cannot use image files
- Cannot use custom fonts
- Must use built-in objects only
- Only approved objects allowed (see guidelines)
- No arbitrary Manim objects
- Limited to mathematical/geometric shapes
- Very complex animations may fail
- Too many objects cause performance issues
- Extremely long calculations timeout
Troubleshooting Animations
Animation fails to generate- Check backend console for errors
- Verify Manim is installed:
pip install manim - Review generated code for syntax errors
- Check animation meets guidelines
- Review animation description
- Check slide content - animation derives from it
- Edit animation code directly
- Regenerate with modified prompt
- Normal: 10-30 seconds per animation
- Complex animations take longer
- Check server resources
- Consider simplifying animation
- Verify output file exists
- Check file format is MP4
- Review FFmpeg logs
- Test animation in isolation