From 3afa0b70b17a30b58a1884efdacc5f91e903f543 Mon Sep 17 00:00:00 2001 From: Jonathan Cornaz Date: Mon, 6 Jun 2022 09:27:31 +0200 Subject: [PATCH] docs(unstable-load-from-file): minor documentation improvement --- src/lib.rs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 9ad55be..3485b4c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -107,12 +107,11 @@ //! } //! ``` //! -//! ## **(Unstable)** Load animation from file +//! ## Load animation from file **(Unstable)** //! -//! 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. +//! By enabling the cargo feature: `unstable-load-from-file` you can write the animation in an asset file. //! -//! Here is how the animation file looks like: +//! First, create an asset file with the extension `.animation.yml`: //! ```yaml //! # The mode can be one of: 'once', 'repeat', 'ping-pong' //! # or 'repeatFrom(n)' (where 'n' is the frame-index to repeat from) @@ -127,17 +126,13 @@ //! duration: 120 //! ``` //! -//! And how to load it with the asset server +//! And then load it with bevy's `AssetServer`: //! ``` //! # 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... -//! } +//! # fn load(mut commands: Commands, asset_server: Res) { +//! let handle: Handle = asset_server.load("player_run.animation.yml"); +//! # } //! ``` #[cfg(test)]