Struct macroquad::experimental::animation::AnimatedSprite
source · pub struct AnimatedSprite {
pub playing: bool,
/* private fields */
}
Expand description
Main definition of all animations for specific image
Fields§
§playing: bool
Controls if frame should be updated on update
Implementations§
source§impl AnimatedSprite
impl AnimatedSprite
pub fn new( tile_width: u32, tile_height: u32, animations: &[Animation], playing: bool ) -> AnimatedSprite
sourcepub fn set_animation(&mut self, animation: usize)
pub fn set_animation(&mut self, animation: usize)
Choose animation to display
Note: the animations is not reset when switching, for this use set_frame
sourcepub fn current_animation(&self) -> usize
pub fn current_animation(&self) -> usize
Currently chosen animation
sourcepub fn is_last_frame(&self) -> bool
pub fn is_last_frame(&self) -> bool
Returns whether the last frame is being displayed
sourcepub fn update(&mut self)
pub fn update(&mut self)
Update current frame
Switches to the next frame every 1. / current_animation.fps
seconds
sourcepub fn frame(&self) -> AnimationFrame
pub fn frame(&self) -> AnimationFrame
Get current frame
Trait Implementations§
source§impl Clone for AnimatedSprite
impl Clone for AnimatedSprite
source§fn clone(&self) -> AnimatedSprite
fn clone(&self) -> AnimatedSprite
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl RefUnwindSafe for AnimatedSprite
impl Send for AnimatedSprite
impl Sync for AnimatedSprite
impl Unpin for AnimatedSprite
impl UnwindSafe for AnimatedSprite
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more