pub struct AnimationState { /* private fields */ }Implementations§
Source§impl AnimationState
impl AnimationState
Sourcepub fn new(frames: Vec<(RgbaImage, Duration)>, loop_count: Option<u32>) -> Self
pub fn new(frames: Vec<(RgbaImage, Duration)>, loop_count: Option<u32>) -> Self
Build from decoded frames + loop count. Starts playing at frame 0.
pub fn current_frame(&self) -> &RgbaImage
pub fn frame_index(&self) -> usize
pub fn frame_count(&self) -> usize
pub fn is_playing(&self) -> bool
pub fn is_finished(&self) -> bool
Sourcepub fn advance(&mut self, dt: Duration) -> bool
pub fn advance(&mut self, dt: Duration) -> bool
Accumulate dt, flipping to later frames as each delay elapses (a large
dt may cross several frames). On wrapping past the last frame, count a
loop; if a finite loop count is then reached, finish and rest on the last
frame. No-op when paused, finished, or single-frame. Returns whether the
displayed frame changed.
Sourcepub fn next_deadline(&self) -> Option<Duration>
pub fn next_deadline(&self) -> Option<Duration>
Time until the next frame flip, or None when paused/finished/single-frame.
Sourcepub fn toggle_pause(&mut self)
pub fn toggle_pause(&mut self)
Play/pause toggle. Reviving a finished animation restarts it (so the play key brings a stopped GIF back to life).
Auto Trait Implementations§
impl Freeze for AnimationState
impl RefUnwindSafe for AnimationState
impl Send for AnimationState
impl Sync for AnimationState
impl Unpin for AnimationState
impl UnsafeUnpin 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