pub trait Lerpable<T> {
    fn lerp(&self, other: T, pct: f32) -> T;
}
Expand description

Linearly interpolates between two values by a given percentage.

pct should be between 0.0 and 1.0, but it is up to the trait implementor to ensure that the value is clamped.

Examples

assert_eq!(0.0_f32.lerp(1.0, 0.5), 0.5);
assert_eq!(Color::WHITE.lerp(Color::BLACK, 0.5), Color::rgba(0.5, 0.5, 0.5, 1.0));

Required Methods

Linearly interpolate between the current value and the other value by pct percent.

Implementations on Foreign Types

Implementors