pub trait Lerp: Clone {
// Required method
fn lerp(&self, to: &Self, t: f64) -> Self;
}Expand description
A value that can be interpolated: a.lerp(&b, 0.0) is a, a.lerp(&b, 1.0) is b.
t may leave 0..=1: an under-damped spring overshoots, and a numeric value follows it past
the target and back. Implementations that cannot extrapolate (a color’s alpha, a count) clamp
the parts that must stay in range.
Required Methods§
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 Lerp for Color
Colors blend in OKLab (Björn Ottosson’s perceptual space), alpha linearly: the midpoint of blue
and yellow is a clean mid-lightness color rather than sRGB’s dim gray, and a sequential scale’s
in-between cells read as in-between values. The endpoints are exact.
impl Lerp for Color
Colors blend in OKLab (Björn Ottosson’s perceptual space), alpha linearly: the midpoint of blue and yellow is a clean mid-lightness color rather than sRGB’s dim gray, and a sequential scale’s in-between cells read as in-between values. The endpoints are exact.
Source§impl<T: Lerp> Lerp for Option<T>
Both present: interpolate. Otherwise there is nothing to move between, so the value switches at
the midpoint.
impl<T: Lerp> Lerp for Option<T>
Both present: interpolate. Otherwise there is nothing to move between, so the value switches at the midpoint.
Source§impl<T: Lerp> Lerp for Vec<T>
Element-wise over the common prefix; the target’s extra elements (or the source’s missing ones)
take the target’s values, so a series that grew draws its new tail where it is headed. A caller
that wants entering elements to grow in matches them up first; Vec has no idea what they mean.
impl<T: Lerp> Lerp for Vec<T>
Element-wise over the common prefix; the target’s extra elements (or the source’s missing ones)
take the target’s values, so a series that grew draws its new tail where it is headed. A caller
that wants entering elements to grow in matches them up first; Vec has no idea what they mean.