# Pygame-Animation
This package provides a framework for managing animations using various smoothing techniques. The AnimationManager class is designed to handle the setup and progression of animations, allowing for smooth transitions and customizable easing methods.
# Features
## 1. Customizable Smoothing:
Use different smoothing methods to control the animation's easing.
## 2. Flexible Activation:
Easily manage the activation and deactivation of animations.
## 3. Abstract Methods for Custom Animations:
Implement your own animations by extending the AnimationManager class.
# Installation
Ensure that the module and its dependencies are included in your project. No additional installation steps are required.
```bash
pip install pygame-animations
```
# Usage
## Importing the Classes
```python
from smoothing_methods import EaseOutSuperFastSmoothing, SmoothingInterface
from smooth_animation import SmoothAnimation
from target_manager import TargetManager
from animation_manager import AnimationManager"
```
## Creating a Custom Animation Manager
To create a custom animation, extend the AnimationManager class and implement the abstract methods animate, activated_animation_setup, and deactivated_animation_setup.
```python
class MyCustomAnimationManager(AnimationManager):
"""
A custom animation manager for manipulating the position of a surface.
Args:
surface: The surface object to be animated.
"""
def __init__(self, surface):
super().__init__()
self.surface = surface
def animate(self):
"""Animate the surface's position."""
self.surface.set_position(self.current_value)
def activated_animation_setup(self):
"""
Set up the animation for the activated state.
Initial position of the surface: 10
Target position of the surface: 20
"""
self.set_target(current_value=10, target_value=20)
def deactivated_animation_setup(self):
"""
Set up the animation for the deactivated state.
Initial position of the surface: 20
Target position of the surface: 10
"""
self.set_target(current_value=20, target_value=10)
```
# Usage example
```python
animation_manager = MyCustomAnimationManager(activated=False, percentage_per_iteration=0.05)
animation_manager.check_for_animation(activated=True)
```
# Class Descriptions
## AnimationManager
The AnimationManager class is an abstract base class for managing animations. It handles the setup and progression of animations using a SmoothAnimation instance.
## Initialization
```python
AnimationManager(activated: bool = False, percentage_per_iteration: float = 0.03, smoothing_method: SmoothingInterface = EaseOutSuperFastSmoothing())
```
## activated:
Initial activation state of the animation (default: False).
## percentage_per_iteration:
The percentage change per iteration for the animation (default: 0.03).
## smoothing_method:
The smoothing method to use for the animation (default: EaseOutSuperFastSmoothing).
# Smoothing Methods
This module also provides various smoothing methods to control the easing of animations. Each smoothing method implements the SmoothingInterface and provides a static method smooth_in_animation to calculate the smoothed value based on the elapsed time.
## LinearSmoothing
### Description:
Linear smoothing, returns the input time directly.
## EaseOutQuadSmoothing
### Description:
Quadratic ease-out smoothing.
## QuadraticSmoothing
### Description:
Quadratic smoothing with different behavior based on time.
## ParametricSmoothing
### Description:
Parametric smoothing using a specific parametric formula.
## EaseOutQuintSmoothing
### Description:
Quintic ease-out smoothing.
## EaseOutCubicSmoothing
### Description:
Cubic ease-out smoothing.
## EaseOutBackSmoothing
### Description:
Back ease-out smoothing with overshoot.
## EaseInOutElasticSmoothing
### Description:
Elastic ease-in-out smoothing with a bounce effect.
## EaseOutElasticSmoothing
### Description:
Elastic ease-out smoothing with a bounce effect.
## EaseOutExpoSmoothing
### Description:
Exponential ease-out smoothing.
## EaseOutSuperFastSmoothing
### Description:
Super fast ease-out smoothing, starts quickly then slows down exponentially.
# Contributing
Contributions are welcome! Please open an issue or submit a pull request if you have suggestions for improvements or new features.
# License
This project is licensed under the MIT License.
Raw data
{
"_id": null,
"home_page": "https://github.com/FrickTzy/Pygame-Animation",
"name": "pygame-animation",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "python, pygame, python game, python game development, pygame animations, python animations, pygame animation",
"author": "FrickTzy (Kurt Arnoco)",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/f5/1b/0cec362fd2c8139fd154514e97d1966b10e42796d1d4de104ee83d8585eb/pygame_animation-1.0.0.tar.gz",
"platform": null,
"description": "# Pygame-Animation\nThis package provides a framework for managing animations using various smoothing techniques. The AnimationManager class is designed to handle the setup and progression of animations, allowing for smooth transitions and customizable easing methods.\n\n# Features\n## 1. Customizable Smoothing: \nUse different smoothing methods to control the animation's easing.\n## 2. Flexible Activation: \nEasily manage the activation and deactivation of animations.\n## 3. Abstract Methods for Custom Animations: \nImplement your own animations by extending the AnimationManager class.\n\n# Installation\nEnsure that the module and its dependencies are included in your project. No additional installation steps are required.\n```bash\npip install pygame-animations\n```\n\n# Usage\n## Importing the Classes\n```python\nfrom smoothing_methods import EaseOutSuperFastSmoothing, SmoothingInterface\nfrom smooth_animation import SmoothAnimation\nfrom target_manager import TargetManager\nfrom animation_manager import AnimationManager\"\n```\n## Creating a Custom Animation Manager\nTo create a custom animation, extend the AnimationManager class and implement the abstract methods animate, activated_animation_setup, and deactivated_animation_setup.\n\n```python\nclass MyCustomAnimationManager(AnimationManager):\n \"\"\"\n A custom animation manager for manipulating the position of a surface.\n\n Args:\n surface: The surface object to be animated.\n \"\"\"\n def __init__(self, surface):\n super().__init__()\n self.surface = surface\n \n def animate(self):\n \"\"\"Animate the surface's position.\"\"\"\n self.surface.set_position(self.current_value)\n\n def activated_animation_setup(self):\n \"\"\"\n Set up the animation for the activated state.\n\n Initial position of the surface: 10\n Target position of the surface: 20\n \"\"\"\n self.set_target(current_value=10, target_value=20)\n\n def deactivated_animation_setup(self):\n \"\"\"\n Set up the animation for the deactivated state.\n\n Initial position of the surface: 20\n Target position of the surface: 10\n \"\"\"\n self.set_target(current_value=20, target_value=10)\n\n```\n# Usage example\n```python\nanimation_manager = MyCustomAnimationManager(activated=False, percentage_per_iteration=0.05)\nanimation_manager.check_for_animation(activated=True)\n```\n# Class Descriptions\n## AnimationManager\nThe AnimationManager class is an abstract base class for managing animations. It handles the setup and progression of animations using a SmoothAnimation instance.\n\n## Initialization\n```python\nAnimationManager(activated: bool = False, percentage_per_iteration: float = 0.03, smoothing_method: SmoothingInterface = EaseOutSuperFastSmoothing())\n```\n## activated: \nInitial activation state of the animation (default: False).\n## percentage_per_iteration: \nThe percentage change per iteration for the animation (default: 0.03).\n## smoothing_method: \nThe smoothing method to use for the animation (default: EaseOutSuperFastSmoothing).\n# Smoothing Methods\nThis module also provides various smoothing methods to control the easing of animations. Each smoothing method implements the SmoothingInterface and provides a static method smooth_in_animation to calculate the smoothed value based on the elapsed time.\n\n## LinearSmoothing\n### Description: \nLinear smoothing, returns the input time directly.\n## EaseOutQuadSmoothing\n### Description: \nQuadratic ease-out smoothing.\n## QuadraticSmoothing\n### Description: \nQuadratic smoothing with different behavior based on time.\n## ParametricSmoothing\n### Description: \nParametric smoothing using a specific parametric formula.\n## EaseOutQuintSmoothing\n### Description: \nQuintic ease-out smoothing.\n## EaseOutCubicSmoothing\n### Description: \nCubic ease-out smoothing.\n## EaseOutBackSmoothing\n### Description: \nBack ease-out smoothing with overshoot.\n## EaseInOutElasticSmoothing\n### Description: \nElastic ease-in-out smoothing with a bounce effect.\n## EaseOutElasticSmoothing\n### Description: \nElastic ease-out smoothing with a bounce effect.\n## EaseOutExpoSmoothing\n### Description: \nExponential ease-out smoothing.\n## EaseOutSuperFastSmoothing\n### Description: \nSuper fast ease-out smoothing, starts quickly then slows down exponentially.\n\n# Contributing\nContributions are welcome! Please open an issue or submit a pull request if you have suggestions for improvements or new features.\n\n# License\nThis project is licensed under the MIT License.\n\n",
"bugtrack_url": null,
"license": null,
"summary": "A package for managing animations of pygame surfaces",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/FrickTzy/Pygame-Animation"
},
"split_keywords": [
"python",
" pygame",
" python game",
" python game development",
" pygame animations",
" python animations",
" pygame animation"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fef5e17b42fca23375f93629220e90eb4b004ace4d2123f0cff4371f31ae6e86",
"md5": "6101e1935ee6ab301ba1fe7404ea4648",
"sha256": "5052dacca72f396417d97ef4a8d189720285d3c14ec7d03913c1f93d6a320895"
},
"downloads": -1,
"filename": "pygame_animation-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6101e1935ee6ab301ba1fe7404ea4648",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7254,
"upload_time": "2024-05-30T05:31:01",
"upload_time_iso_8601": "2024-05-30T05:31:01.181497Z",
"url": "https://files.pythonhosted.org/packages/fe/f5/e17b42fca23375f93629220e90eb4b004ace4d2123f0cff4371f31ae6e86/pygame_animation-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f51b0cec362fd2c8139fd154514e97d1966b10e42796d1d4de104ee83d8585eb",
"md5": "aae754453977ca02e7e00c98de3a2152",
"sha256": "42bcec58f686dac89ca5e0947f887d8f33c0bab6e9127c441708d723e28761c4"
},
"downloads": -1,
"filename": "pygame_animation-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "aae754453977ca02e7e00c98de3a2152",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6620,
"upload_time": "2024-05-30T05:31:03",
"upload_time_iso_8601": "2024-05-30T05:31:03.021598Z",
"url": "https://files.pythonhosted.org/packages/f5/1b/0cec362fd2c8139fd154514e97d1966b10e42796d1d4de104ee83d8585eb/pygame_animation-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-30 05:31:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "FrickTzy",
"github_project": "Pygame-Animation",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pygame-animation"
}