A powerful AI-powered animation generation system that combines Flask, Pygame, and Google's Gemini AI to create dynamic 2D animations from text descriptions.
- AI-Powered Animation Generation: Leverages Google's Gemini AI to convert text descriptions into Python animation code
- Real-Time Preview: Instantly view generated animations in the browser
- Customizable Settings: Control animation duration, resolution, and frame rate
- Code Visibility: View and learn from the AI-generated Python code
- Video Export: Download animations in MP4 format
- History Management: Keep track of previous generations and chat history
- Responsive UI: Modern, user-friendly interface built with Tailwind CSS
pyanimate.mp4
- Python 3.8 or higher
- Google Gemini API key
- Modern web browser
- FFmpeg (for video processing)
- Clone the repository:
git clone https://github.com/LikithMeruvu/PyAnimate2D-AI.git
cd PyAnimate2D-AI
- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install required packages:
pip install -r requirements.txt
- Configure your environment:
- Obtain a Google Gemini API key
- Have FFmpeg installed and accessible in your system PATH
- Start the Flask server:
python app.py
- Open your browser and navigate to:
http://localhost:5000
- Enter your Gemini API key in the configuration section
- Select your preferred Gemini model
- Adjust the temperature setting (0.0-2.0)
- Save your configuration
- Enter a descriptive prompt for your desired animation
- Set animation parameters:
- Duration (in seconds, max 60)
- Resolution (144p to 1440p)
- Frame rate (15-60 FPS)
- Click "Generate Animation"
- Wait for the generation process to complete
- Preview and download your animation
- Frontend: HTML5, Tailwind CSS, JavaScript
- Backend: Flask (Python)
- Animation Engine: Pygame
- AI Integration: Google Generative AI (Gemini)
- Video Processing: OpenCV, FFmpeg
-
Flask Application (
app.py
)- Handles HTTP routes and requests
- Manages session data
- Coordinates between UI and animation generation
- Handles video file management
-
Animation Generation
- Uses Pygame for rendering
- Converts AI-generated code into animations
- Supports custom resolutions and frame rates
- Handles error recovery and retries
-
User Interface
- Responsive design with Tailwind CSS
- Real-time video preview with Video.js
- Code syntax highlighting with Prism.js
- Interactive chat history
-
Video Processing
- OpenCV for frame processing
- FFmpeg for video encoding
- Supports multiple video formats and qualities
The system can generate various types of 2D animations, including:
- Geometric patterns and shapes
- Particle systems
- Character animations
- Abstract visualizations
- Mathematical animations
- Interactive scenes
- Resolution: 144p to 1440p
- Frame Rate: 15, 30, 45, or 60 FPS
- Duration: Up to 60 seconds
- Format: MP4 (H.264 codec)
- Model Selection: Multiple Gemini models available
- Temperature: 0.0 to 2.0 (controls creativity)
- API Configuration: Custom API key support
- Fork the repository
- Create a feature branch
- Implement your changes
- Submit a pull request
- Follow PEP 8 guidelines
- Use type hints where possible
- Document new functions and classes
- Add appropriate error handling
-
Video Generation Fails
- Check FFmpeg installation
- Verify write permissions in output directories
- Check available system memory
-
AI Generation Errors
- Verify API key validity
- Check internet connection
- Review prompt complexity
-
Performance Issues
- Lower video resolution
- Reduce animation duration
- Check system resources
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please read our Contributing Guidelines for details on our code of conduct and the process for submitting pull requests.
- Google Generative AI team for the Gemini API
- Pygame community for the animation framework
- Flask team for the web framework
- Contributors and users of the project
For support, please:
- Open an issue on GitHub
- Join our Discord community
- Check the documentation wiki
Made with โค๏ธ by the PyAnimate2D-AI team