diff --git a/src/lib.rs b/src/lib.rs index a01f0b1..9ad55be 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -106,6 +106,39 @@ //! } //! } //! ``` +//! +//! ## **(Unstable)** Load animation from file +//! +//! By enabling the cargo feature: `unstable-load-from-file` you can write the animation in an asset file with the extension `.animation.yml` +//! then load with the asset-server. +//! +//! Here is how the animation file looks like: +//! ```yaml +//! # The mode can be one of: 'once', 'repeat', 'ping-pong' +//! # or 'repeatFrom(n)' (where 'n' is the frame-index to repeat from) +//! # The default is 'repeat' +//! mode: ping-pong +//! frames: +//! - index: 0 # index in the sprite sheet for that frame +//! duration: 100 # duration of the frame in milliseconds +//! - index: 1 +//! duration: 100 +//! - index: 2 +//! duration: 120 +//! ``` +//! +//! And how to load it with the asset server +//! ``` +//! # use bevy::prelude::*; +//! # use benimator::*; +//! fn load(mut commands: Commands, asset_server: Res) { +//! +//! // Load animation from the asset server +//! let animation_handle: Handle = asset_server.load("player_run.animation.yml"); +//! +//! // TODO insert the handle in an entity... +//! } +//! ``` #[cfg(test)] #[macro_use]