Skip to main content

Animation

Trait Animation 

Source
pub trait Animation {
    // Required methods
    fn tick(&mut self, dt: Duration);
    fn is_complete(&self) -> bool;
    fn value(&self) -> f32;
    fn reset(&mut self);

    // Provided method
    fn overshoot(&self) -> Duration { ... }
}
Expand description

A time-based animation producing values in [0.0, 1.0].

Required Methods§

Source

fn tick(&mut self, dt: Duration)

Advance the animation by dt.

Source

fn is_complete(&self) -> bool

Whether the animation has reached its end.

Source

fn value(&self) -> f32

Current output value, clamped to [0.0, 1.0].

Source

fn reset(&mut self)

Reset the animation to its initial state.

Provided Methods§

Source

fn overshoot(&self) -> Duration

Time elapsed past completion. Used by composition types to forward remaining time (e.g., Sequence forwards overshoot from first to second). Returns Duration::ZERO for animations that never complete.

Implementors§