Skip to main content

AnimationSequence

Struct AnimationSequence 

Source
pub struct AnimationSequence { /* private fields */ }
Expand description

A playing multi-step animation.

The caller drives it with tick and reads current_frame. Pauses, actions, and completed sequences hold the last frame reached during playback, including frames crossed within a single tick. The frame is None only until playback first reaches a frame after construction or reset.

Implementations§

Source§

impl AnimationSequence

Source

pub fn builder() -> SequenceBuilder

Start building a sequence.

Source

pub fn tick(&mut self, dt: f32, rng: &mut Rng) -> bool

Advance by dt seconds, drawing random-pause durations from rng. Returns true only on the tick where a SequenceLoop::Once or SequenceLoop::PingPongOnce sequence completes (a completion edge, once).

Large dt steps through as many frames and steps as it covers and carries the remainder, so long-run timing never drifts. Zero-duration steps (actions, zero-length pauses) cannot spin: a tick stops after one full pass over the steps without consuming time, dropping the remainder.

Source

pub fn current_frame(&self) -> Option<usize>

The sheet-frame index to display right now. Pauses, actions, and completed sequences hold the last frame reached during playback. Returns None only before the first frame is reached after construction or reset.

Source

pub fn just_completed(&self) -> bool

Whether the sequence completed on the most recent tick.

Source

pub fn is_finished(&self) -> bool

Whether a Once or PingPongOnce sequence has played out.

Source

pub fn take_action(&mut self) -> Option<u32>

Take the next action id queued by the most recent tick, oldest first. Drain it in a loop: one tick can cross several SequenceStep::Action steps. The queue is cleared at the start of every tick.

Source

pub fn reset(&mut self)

Rewind to the first frame of the first step (restarts a finished sequence).

Trait Implementations§

Source§

impl Clone for AnimationSequence

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AnimationSequence

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.