Benimator

License Crates.io Docs Bevy tracking dependency status Build

A sprite sheet animation plugin for bevy

Features

Usage

```rust fn main() { App::build() .addplugins(DefaultPlugins) .addplugin(AnimationPlugin) // <-- Add the plugin .addstartupsystem(spawn.system()) .run(); }

fn spawn( mut commands: Commands, assetserver: Res, mut textures: ResMut>, ) { // Don't forget the camera ;-) commands.spawnbundle(OrthographicCameraBundle::new_2d());

commands // Spawn a bevy sprite-sheet .spawnbundle(SpriteSheetBundle { textureatlas: textures.add(TextureAtlas::fromgrid(assetserver.load("coin.png"), Vec2::new(16.0, 16.0), 5, 1)), transform: Transform::fromscale(Vec3::splat(10.0)), ..Default::default() }) // Insert the animation component // Here we use an index-range (from 0 to 4) where each frame has the same duration .insert(SpriteSheetAnimation::fromrange(0..=4, Duration::from_millis(100))) // Start the animation immediately. Remove this component in order to pause the animation. .insert(Play); } ```

Here is the result:

Example result

For more details see the documentation

Installation

Add to Cargo.toml:

toml benimator = "0.1.1"

Bevy Version Compatibility

| bevy | benimator | |------|------------| | 0.5 | >= 0.1 |

Contribute / Contact

You can open issues/discussions here, or you can discuss with me (Jomag#2675) in the bevy discord