Easing

Trait Easing 

Source
pub trait Easing: Debug {
    // Required method
    fn eval(&self, time: f64) -> f64;

    // Provided methods
    fn velocity(&self, time: f64) -> Option<f64> { ... }
    fn finished(&self, time: f64) -> bool { ... }
}
Expand description

A trait for easing functions used in animations.

Easing functions control how a value changes over time during an animation. They take a normalized time value (0.0 to 1.0) and return a progress value.

Required Methods§

Source

fn eval(&self, time: f64) -> f64

Evaluates the easing function at the given time.

§Arguments
  • time - A normalized time value, typically between 0.0 and 1.0
§Returns

The eased progress value, typically between 0.0 and 1.0

Provided Methods§

Source

fn velocity(&self, time: f64) -> Option<f64>

Returns the velocity at the given time, if available.

This is primarily used by spring animations to determine when motion has stopped.

Source

fn finished(&self, time: f64) -> bool

Returns whether the animation has finished at the given time.

By default, an animation is finished when time is outside the 0.0..1.0 range.

Implementors§