Skip to content

PyAnimate2D is a project that leverages Pygame to create stunning 2D animations. Whether you're a beginner or a seasoned developer, PyAnimate2D offers an intuitive interface for crafting engaging animations for games, apps, and visual art projects. Dive into the world of 2D animation and bring your creative ideas to life with PyAnimate2D.

License

Notifications You must be signed in to change notification settings

LikithMeruvu/PyAnimate2D-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

13 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

PyAnimate2D-AI ๐ŸŽจ

A powerful AI-powered animation generation system that combines Flask, Pygame, and Google's Gemini AI to create dynamic 2D animations from text descriptions.

๐ŸŒŸ Features

  • 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

Video Demo

pyanimate.mp4

๐Ÿš€ Getting Started

Prerequisites

  • Python 3.8 or higher
  • Google Gemini API key
  • Modern web browser
  • FFmpeg (for video processing)

Installation

  1. Clone the repository:
git clone https://github.com/LikithMeruvu/PyAnimate2D-AI.git
cd PyAnimate2D-AI
  1. Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install required packages:
pip install -r requirements.txt
  1. Configure your environment:
    • Obtain a Google Gemini API key
    • Have FFmpeg installed and accessible in your system PATH

Running the Application

  1. Start the Flask server:
python app.py
  1. Open your browser and navigate to:
http://localhost:5000

๐ŸŽฎ Usage

Configuration

  1. Enter your Gemini API key in the configuration section
  2. Select your preferred Gemini model
  3. Adjust the temperature setting (0.0-2.0)
  4. Save your configuration

Generating Animations

  1. Enter a descriptive prompt for your desired animation
  2. Set animation parameters:
    • Duration (in seconds, max 60)
    • Resolution (144p to 1440p)
    • Frame rate (15-60 FPS)
  3. Click "Generate Animation"
  4. Wait for the generation process to complete
  5. Preview and download your animation

๐Ÿ› ๏ธ Technical Details

Architecture

  • Frontend: HTML5, Tailwind CSS, JavaScript
  • Backend: Flask (Python)
  • Animation Engine: Pygame
  • AI Integration: Google Generative AI (Gemini)
  • Video Processing: OpenCV, FFmpeg

Key Components

  1. Flask Application (app.py)

    • Handles HTTP routes and requests
    • Manages session data
    • Coordinates between UI and animation generation
    • Handles video file management
  2. Animation Generation

    • Uses Pygame for rendering
    • Converts AI-generated code into animations
    • Supports custom resolutions and frame rates
    • Handles error recovery and retries
  3. User Interface

    • Responsive design with Tailwind CSS
    • Real-time video preview with Video.js
    • Code syntax highlighting with Prism.js
    • Interactive chat history
  4. Video Processing

    • OpenCV for frame processing
    • FFmpeg for video encoding
    • Supports multiple video formats and qualities

๐ŸŽจ Animation Capabilities

The system can generate various types of 2D animations, including:

  • Geometric patterns and shapes
  • Particle systems
  • Character animations
  • Abstract visualizations
  • Mathematical animations
  • Interactive scenes

๐Ÿ”ง Configuration Options

Video Settings

  • Resolution: 144p to 1440p
  • Frame Rate: 15, 30, 45, or 60 FPS
  • Duration: Up to 60 seconds
  • Format: MP4 (H.264 codec)

AI Settings

  • Model Selection: Multiple Gemini models available
  • Temperature: 0.0 to 2.0 (controls creativity)
  • API Configuration: Custom API key support

๐Ÿ“ Development Guidelines

Adding New Features

  1. Fork the repository
  2. Create a feature branch
  3. Implement your changes
  4. Submit a pull request

Code Style

  • Follow PEP 8 guidelines
  • Use type hints where possible
  • Document new functions and classes
  • Add appropriate error handling

๐Ÿ› Troubleshooting

Common Issues

  1. Video Generation Fails

    • Check FFmpeg installation
    • Verify write permissions in output directories
    • Check available system memory
  2. AI Generation Errors

    • Verify API key validity
    • Check internet connection
    • Review prompt complexity
  3. Performance Issues

    • Lower video resolution
    • Reduce animation duration
    • Check system resources

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿค Contributing

Contributions are welcome! Please read our Contributing Guidelines for details on our code of conduct and the process for submitting pull requests.

๐Ÿ™ Acknowledgments

  • 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

๐Ÿ“ž Support

For support, please:

  • Open an issue on GitHub
  • Join our Discord community
  • Check the documentation wiki

Made with โค๏ธ by the PyAnimate2D-AI team

About

PyAnimate2D is a project that leverages Pygame to create stunning 2D animations. Whether you're a beginner or a seasoned developer, PyAnimate2D offers an intuitive interface for crafting engaging animations for games, apps, and visual art projects. Dive into the world of 2D animation and bring your creative ideas to life with PyAnimate2D.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published