chiragagrawal24/cursor_2d_animation
0
Cursor 2D Animation Pipeline
An intelligent educational animation generation system that converts topics into high-quality Manim animations using AI-powered LangGraph pipelines, web search, and RAG (Retrieval Augmented Generation).
๐ฏ Overview
This project creates educational animations automatically by:
- Topic Analysis: Breaking down educational topics into digestible scenes
- AI-Powered Code Generation: Using Google Gemini LLM with web search and Manim documentation RAG
- Automated Animation: Generating complete Manim Python scripts for each scene
- Modular Architecture: Clean, maintainable code structure with separated concerns
๐ Features
- ๐ง Intelligent Scene Generation: Automatically breaks down complex topics into animated scenes
- ๐ Web-Enhanced Research: Uses Tavily search for current information and context
- ๐ RAG-Powered Documentation: Leverages Supabase vector store with Manim documentation
- โก Parallel Processing: Concurrent scene generation for improved performance
- ๐ฌ Manim Integration: Generates production-ready Manim animation scripts
- ๐ LangGraph Pipeline: Robust workflow orchestration with state management
- ๐ Progress Tracking: Real-time pipeline execution monitoring
๐ Project Structure
Cursor_2D_Animation/
โโโ src/ # Core source code
โ โโโ editor/ # Animation editing components
โ โโโ langraph_pipeline/ # Main AI pipeline modules
โ โ โโโ config.py # Environment and LLM configuration
โ โ โโโ main_modular.py # Clean main entry point
โ โ โโโ manim_generator.py # Manim code generation with RAG
โ โ โโโ pipeline.py # LangGraph workflow orchestration
โ โ โโโ scene_generator.py # Scene description generation
โ โ โโโ state.py # Pipeline state management
โ โโโ renderer/ # Animation rendering components
โ โโโ storage/ # Data storage utilities
โ โโโ utils/ # Common utility functions
โโโ scripts/ # Utility scripts
โ โโโ RAG/ # RAG system components
โ โโโ chunk_docs.py # Document chunking utilities
โ โโโ crawl_recursive.py # Web crawling for documentation
โ โโโ create_table.sql # Database schema
โ โโโ insert_docs.py # Document insertion pipeline
โ โโโ utils.py # RAG utility functions
โโโ assets/ # Static assets and resources
โโโ docs/ # Project documentation
โโโ tests/ # Unit and integration tests
โโโ out/ # Generated animations output
โโโ requirements.txt # Python dependencies
โโโ README.md # This file๐ ๏ธ Installation
Prerequisites
- Python 3.10+
- FFmpeg (for video rendering)
- Git
Setup
- Clone the repository
git clone https://github.com/yashpinjarkar10/Cursor_2D_Animation.git
cd Cursor_2D_Animation- Install dependencies
pip install -r requirements.txt- Environment configuration Create a
.envfile with your API keys:
GOOGLE_API_KEY=your_gemini_api_key
TAVILY_API_KEY=your_tavily_api_key
SUPABASE_URL=your_supabase_url
SUPABASE_SERVICE_KEY=your_supabase_key
LANGSMITH_API_KEY=your_langsmith_key # Optional for debugging๐ฎ Usage
Basic Usage
cd src/langraph_pipeline
python main_modular.pyAdvanced Options
# Test mode with predefined topic
python main_modular.py --test
# Debug mode with detailed logging
python main_modular.py --debugExample Workflow
- Run the pipeline:
python main_modular.py - Enter your educational topic (e.g., "Pythagorean Theorem")
- Watch as the AI generates scene descriptions
- Generated Manim scripts appear in
generated_scenes/ - Rendered videos will be saved to
out/
๐ง Key Technologies
- ๐ค AI/ML: Google Gemini 2.5 Flash, LangChain, LangGraph
- ๐ฌ Animation: Manim Community Edition
- ๐ Search: Tavily Web Search API
- ๐ RAG: Supabase Vector Database, Google Embeddings
- ๐ธ๏ธ Web Crawling: Crawl4AI for documentation scraping
- ๐ฅ Video Processing: MoviePy, FFmpeg
- ๐ Monitoring: LangSmith (optional)
๐งฉ Core Components
LangGraph Pipeline (src/langraph_pipeline/)
- State Management: Typed state flow through the pipeline
- Scene Generation: AI-powered topic breakdown into scenes
- Code Generation: RAG-enhanced Manim script creation
- Parallel Processing: Concurrent scene processing for efficiency
RAG System (scripts/RAG/)
- Web Crawling: Recursive documentation crawling
- Document Processing: Intelligent chunking and embedding
- Vector Storage: Supabase-based retrieval system
- Query Enhancement: Context-aware documentation search
๐ Output
The pipeline generates:
- Manim Scripts: Complete Python files ready for rendering
- Scene Descriptions: Human-readable animation breakdowns
- Execution Logs: Detailed pipeline performance metrics
- Rendered Videos: Final MP4 animations (when rendering is enabled)
๐ฎ Future Enhancements
- [ ] Video Editor Integration: Automated scene assembly
- [ ] Advanced Rendering: GPU acceleration and optimization
- [ ] Interactive UI: Web-based interface for topic input
- [ ] Template System: Reusable animation patterns
- [ ] Batch Processing: Multiple topic processing
- [ ] Quality Assessment: Automated animation quality metrics
๐ค Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes with tests
- Submit a pull request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Manim Community for the excellent animation framework
- LangChain Team for the AI orchestration tools
- Google for the Gemini LLM API
- Supabase for the vector database platform
Built with โค๏ธ for educational content creators and AI enthusiasts ---
