Crates.io | benimator |
lib.rs | benimator |
version | 4.1.3 |
source | src |
created_at | 2021-06-16 20:37:24.224334 |
updated_at | 2023-07-01 15:38:09.048177 |
description | A sprite animation library for rust game development |
homepage | |
repository | https://github.com/jcornaz/benimator |
max_upload_size | |
id | 411027 |
size | 125,876 |
A sprite animation library for rust game development.
Initially designed for bevy, it is now engine agnostic.
This project aim to provide the building the blocks to facilitate 2d sprite animation with any game engine.
Benimator is not rendering anything. It only keeps track of sprite indices.
One is expected to use benimator with a game engine such as bevy.
At its core benimator is an Animation
data structure
and a State
to track the frame-index as time pass.
// Create an animation
let animation = Animation::from_indices(0..=3, FrameRate::from_fps(10.0));
// Create a new animation state
let mut state = State::new();
// In the game loop, for each update, tell the state how much time has elapsed
let delta_time = Duration::from_millis(250);
state.update(&animation, delta_time);
// Then get the current frame index.
// (so that we can tell our engine to render the sprite at that index)
assert_eq!(state.frame_index(), 2);
Have a look at the examples for complete examples using the bevy game engine.
benimator is published on crates.io
You can add the dependency to your cargo file with:
cargo add benimator
Feature | Description |
---|---|
serde |
Implementations of Serialize and Deserialize |
Feature flags not mentioned here are NOT part of the public API and are subject to breaking changes!
The minimum supported rust version is currently 1.60
.
It can be updated to a newer stable version when required, and that will not be considered a breaking change (it can happen in for a minor or patch release).
Licensed under either of
at your option.