Skip to main content

SpringScalar

Trait SpringScalar 

Source
pub trait SpringScalar: Lerp + Clone {
    // Required method
    fn to_f32(&self) -> f32;

    // Provided methods
    fn spring_progress(start: &Self, target: &Self, current: &Self) -> f32 { ... }
    fn is_near_target(current: &Self, target: &Self, threshold: f32) -> bool { ... }
}
Expand description

Trait for values that can participate in spring animations.

Required Methods§

Source

fn to_f32(&self) -> f32

Convert the value to f32 for physics calculations.

Provided Methods§

Source

fn spring_progress(start: &Self, target: &Self, current: &Self) -> f32

Compute the current progress between the start and target values.

Source

fn is_near_target(current: &Self, target: &Self, threshold: f32) -> bool

Determine whether the current value is close enough to the target to consider the spring finished.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl SpringScalar for f32

Source§

fn to_f32(&self) -> f32

Source§

impl SpringScalar for f64

Source§

fn to_f32(&self) -> f32

Implementors§