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§
Provided Methods§
Sourcefn spring_progress(start: &Self, target: &Self, current: &Self) -> f32
fn spring_progress(start: &Self, target: &Self, current: &Self) -> f32
Compute the current progress between the start and target values.
Sourcefn is_near_target(current: &Self, target: &Self, threshold: f32) -> bool
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".