[−][src]Function soy::lerp
pub fn lerp<T, D>(lerper: T, start: D, end: D, t: f32) -> D where
T: Lerper,
D: Copy,
D: Add<Output = D>,
D: Sub<Output = D>,
D: Mul<f32, Output = D>,
Interpolate between two values given an interpolation method.
Arguments:
lerper
: Interpolation method to use.start
: Initial data point.end
: Final data point.t
: Amount to interpolate between the values.
Usage
fn main() { let start = 5.0; let end = 10.0; let quarter = soy::lerp(soy::Linear, start, end, 0.25); assert_eq!(quarter, 6.25); let half_way = soy::lerp(soy::Linear, start, end, 0.5); assert_eq!(half_way, 7.5); }