1 2 3 4 5 6 7 8 9 10 11 12 13
/// Types which can be linearly interpolated. pub trait Lerp: Copy { type T; fn lerp(self, other: Self, t: Self::T) -> Self; } /// Linearly interpolates between `from` and `to` by `t`. #[inline] pub fn lerp<T: Lerp>(from: T, to: T, t: T::T) -> T { from.lerp(to, t) }