pub trait AsepriteAnimation: Sized + FromWorld {
// Required methods
fn get_tag_name(&self) -> &str;
fn get_dimensions() -> UVec2;
// Provided method
fn get_anchor_pixel() -> Vec2 { ... }
}Expand description
This trait will allow you to animate a sprite with an aseprite animation file.
Required Methods§
Sourcefn get_tag_name(&self) -> &str
fn get_tag_name(&self) -> &str
Animations are defined by tags inside of asesprite files. This function will tell bevy what animation to use based on the current state of the struct that implements this trait. This is intended to allow Enums to be used to have animation states.
Sourcefn get_dimensions() -> UVec2
fn get_dimensions() -> UVec2
This is the size of each frame of the animation. With asesprite, all frames are the same size.
Provided Methods§
Sourcefn get_anchor_pixel() -> Vec2
fn get_anchor_pixel() -> Vec2
This should return the pixel that the sprite should be anchored to. This defaults to the middle of the sprite.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.