bevy_spritesheet_animation is a Bevy plugin for animating sprites that are backed by spritesheets.
Features
- A single Bevy component to add to your entities to play animations.
- Tunable parameters: duration, repetitions, direction, easing.
- Composable animations from multiple clips.
- Events to react to animations ending or reaching specific points.
- A convenient API to select frames in spritesheets.
Quick start
- Add the SpritesheetAnimationPlugin to your app
- Use the SpritesheetLibrary resource to create new clips and animations
- Add a SpritesheetAnimation component to your entity
Overview
Animation clips
An animation clip is a reusable sequence of frames.
It is the most basic building block for creating animations.
Use the SpritesheetLibrary resource to create and configure a new clip.
The clip can then be referenced in any number of animations.
Animations
In its simplest form, an animation is composed of a single clip that loops endlessly.
However, you're free to compose more sophisticated animations by chaining multiple clips and by tuning the animation parameters.
Use the SpritesheetLibrary resource to create a new animation.
The animation can then be referenced in any number of SpritesheetAnimation component.
Think of clips and animations as assets!
Clips and animations should be created once. You can then assign them to many entities.
❌ BAD
You should not create the same clip/animation for each entity that plays it.
👍 GOOD
Instead, create clips/animations once and then reference them when needed.
For instance, you can create all your animations in a setup system, give them unique names and then assign them to entities at a later stage.
More examples
For more examples, browse the examples/ directory.
Example | Description |
---|---|
basic | Minimal example showing how to create an animated sprite |
composition | Advanced example showing how to create an animation with multiple stages |
parameters | Shows the effect of each parameter |
character | Shows how to create a controllable character with multiple animations |
events | Shows how to react to animations reaching points of interest with events |
stress | A stress test with thousands of animated sprites |
Compatibility
bevy | bevy_spritesheet_animation |
---|---|
0.13 | 0.1.0 |
Credits
- The character spritesheet used for the examples is CC0 from thekingphoenix