CoolFace
Apppublic

chiragagrawal24/cursor_2d_animation

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes
App README

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:

  1. 1.Topic Analysis: Breaking down educational topics into digestible scenes
  2. 2.AI-Powered Code Generation: Using Google Gemini LLM with web search and Manim documentation RAG
  3. 3.Automated Animation: Generating complete Manim Python scripts for each scene
  4. 4.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

  1. 1.Clone the repository
bash
   git clone https://github.com/yashpinjarkar10/Cursor_2D_Animation.git
   cd Cursor_2D_Animation
  1. 1.Install dependencies
bash
   pip install -r requirements.txt
  1. 1.Environment configuration Create a .env file with your API keys:
env
   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

bash
cd src/langraph_pipeline
python main_modular.py

Advanced Options

bash
# Test mode with predefined topic
python main_modular.py --test

# Debug mode with detailed logging
python main_modular.py --debug

Example Workflow

  1. 1.Run the pipeline: python main_modular.py
  2. 2.Enter your educational topic (e.g., "Pythagorean Theorem")
  3. 3.Watch as the AI generates scene descriptions
  4. 4.Generated Manim scripts appear in generated_scenes/
  5. 5.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:

  1. 1.Fork the repository
  2. 2.Create a feature branch
  3. 3.Make your changes with tests
  4. 4.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 ---