bevy_animations is a Lightweight 2d animations engine built for Bevy
What bevy_animations accomplishes
-
using bevy_animations is easy and the animation configurations are simple
-
bevy_animations is fast enough to handle all of the entities you want animated
Add bevy_animations to your Bevy App
use AnimationsPlugin;
use *;
How bevy_animations animations work
- they work off of left to right based animations from sprite sheets
- specified timings or
meters_per_frame
for each frame - user defining which y indexes are left, right, up and down facing sprites
- timed animations can block others from happening
- utilizing a priortity based system so you can define multiple blocking animations with different priorities to render
How to define a bevy_animations animation
You first need to spawn an entity using Commands
like this
use *;
use *;
You can then add your animations to ResMut<Animations>
like this
animations.insert_animation
You can also add a TimedAnimation
like this
animations.insert_animation
We can then start an animation by sending it over an EventWriter<AnimationEvent>
like this
-
Note that you can send an event of the same name multiple times even during animation without ruining it
-
Note if you send an event with a different name the current animation of the entity will change immediately.
Knowing this you can change the player_running
animation to player_die
in another system where you could check collisions like this
-
Note that
bevy_animations
will automatically remove your entity from it's own data structure if it doesn't exist in theWorld
i.e when the entity despawns via.despawn()
-
Note there is no functionality internally yet for doing a task like despawning an entity only after an animation is finished. This can be accomplished on your own however.
Open Source
bevy_animations is open-source forever. You can contribute via the GitHub Repo