- Simple Text-to-Animation Interface: Type what you want to see, get an animation
- Low-Quality Preview: Fast rendering for quick feedback
- Code Display: View the generated Manim code for learning or further customization
- Minimalist Design: Clean, two-pane interface for easy use
- Python 3.10+
- Flask
- Manim
- FFmpeg
- Cairo, Pango, and other Manim dependencies
First, install the required system dependencies:
sudo apt-get update
sudo apt-get install -y build-essential python3-dev python3-pip ffmpeg \
libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev \
python3-setuptools meson ninja-buildInstall the required Python packages:
pip3 install pycairo
pip3 install manim openai flaskgit clone https://github.com/yourusername/manim-animation-generator.git
cd manim-animation-generatorStart the application with:
python3 app.pyBy default, the application runs on port 8000. You can specify a different port with:
python3 app.py --port 8080The application will automatically find an available port if the specified one is in use.
Open your web browser and navigate to:
http://localhost:8000
- Enter a description of the animation you want to create in the left pane
- Click the "Generate Animation" button
- Wait for the animation to be generated (this may take a few seconds)
- View the animation in the right pane
- Optionally, copy the generated Manim code for further customization
Here are some example descriptions you can try:
- "Create a blue circle and transform it into a red square"
- "Write the text 'Hello, Manim!' and fade in a green triangle below it"
- "Draw a square, rotate it, and then fade it out"
The application provides a RESTful API for generating animations programmatically.
GET /api/health
Returns the status of the API.
Response:
{
"status": "ok",
"message": "Manim app backend is running"
}POST /api/generate
Generates an animation from a text description.
Request Body:
{
"description": "Create a blue circle"
}Response:
{
"status": "success",
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"video_url": "/api/video/550e8400-e29b-41d4-a716-446655440000",
"code": "from manim import *\n\nclass ManimScene(Scene):\n def construct(self):\n # Create a circle\n circle = Circle(color=BLUE)\n self.play(Create(circle))\n self.wait(1)"
}GET /api/video/<job_id>
Returns the generated video file.
GET /api/status/<job_id>
Checks the status of a job.
Response:
{
"status": "completed",
"video_url": "/api/video/550e8400-e29b-41d4-a716-446655440000"
}The application consists of two main components:
- Backend: A Flask application that handles API requests, generates Manim code from text descriptions, and runs Manim to create animations.
- Frontend: A simple HTML/CSS/JavaScript interface that allows users to enter descriptions and view the resulting animations.
manim_app/
├── app.py # Main application entry point
├── backend/ # Backend API code
│ ├── __init__.py # Backend initialization
│ └── api.py # API endpoints and Manim code generation
├── static/ # Static assets
│ ├── css/ # CSS styles
│ │ └── styles.css # Main stylesheet
│ └── js/ # JavaScript code
│ └── main.js # Main frontend logic
├── templates/ # HTML templates
│ └── index.html # Main application page
├── utils/ # Utility scripts
│ └── temp/ # Temporary files for Manim scripts
└── media/ # Generated media files
└── videos/ # Output video files
The application now integrates with Google's Gemini 2.5 Pro API for enhanced text-to-code conversion capabilities. This integration enables:
- Complex Animation Generation: Create sophisticated animations from simple descriptions
- 3D Scene Support: Generate 3D scenes and objects with proper camera settings
- Mathematical Equation Rendering: Create animations with complex mathematical equations
For more details, see the Gemini Integration Documentation.
- Fine-tune the Gemini model specifically for Manim code generation
- Implement user accounts and saved animations
- Add a gallery of example animations
- Support for higher quality rendering options
- Add interactive refinement of generated animations
This project is licensed under the MIT License - see the LICENSE file for details.
- Manim - The mathematical animation engine
- Flask - The web framework used
- 3Blue1Brown - For creating Manim and inspiring this project
