pub struct AnimationState { /* private fields */ }
Expand description
Animation state
Implementations§
Source§impl AnimationState
impl AnimationState
Sourcepub fn from_frame_duration(frame_count: usize, frame_duration: Duration) -> Self
pub fn from_frame_duration(frame_count: usize, frame_duration: Duration) -> Self
Creates a new animation from total number of frame and duration for each frame
The frame_duration
must be bigger than zero.
§Panics
Panics if frame_duration
is zero
Sourcepub fn from_frame_duration_secs(frame_count: usize, frame_duration: f32) -> Self
pub fn from_frame_duration_secs(frame_count: usize, frame_duration: f32) -> Self
Creates a new animation from total number of frame and duration (expressed in seconds, using a f32
) for each frame
The frame_duration
must be bigger than zero.
§Panics
Panics if frame_duration
is zero
Sourcepub fn update(&mut self, delta_time: Duration)
pub fn update(&mut self, delta_time: Duration)
Update the animation state with the elapsed delta_time
Sourcepub fn update_secs(&mut self, delta_time: f32)
pub fn update_secs(&mut self, delta_time: f32)
Update the animation state with the elapsed delta_time
where delta_time
is a fractional number of seconds
Sourcepub fn current_frame(&self) -> usize
pub fn current_frame(&self) -> usize
Returns the current frame index
Trait Implementations§
Source§impl Clone for AnimationState
impl Clone for AnimationState
Source§fn clone(&self) -> AnimationState
fn clone(&self) -> AnimationState
Returns a duplicate 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 Freeze for AnimationState
impl RefUnwindSafe for AnimationState
impl Send for AnimationState
impl Sync for AnimationState
impl Unpin for AnimationState
impl UnwindSafe for AnimationState
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