Function egui::lerp

source ·
pub fn lerp<R, T>(range: RangeInclusive<R>, t: T) -> Rwhere
    T: Real<Output = R> + Mul<R>,
    R: Copy + Add<R, Output = R>,
Expand description

Linear interpolation.

assert_eq!(lerp(1.0..=5.0, 0.0), 1.0);
assert_eq!(lerp(1.0..=5.0, 0.5), 3.0);
assert_eq!(lerp(1.0..=5.0, 1.0), 5.0);
assert_eq!(lerp(1.0..=5.0, 2.0), 9.0);