[][src]Function pareen::lerp

pub fn lerp<T, V, W, F, G, A, B>(a: A, b: B) -> Anim<impl Fun<T = T, V = V>> where
    T: Copy + Mul<W, Output = W>,
    V: Copy + Add<W, Output = V> + Sub<Output = W>,
    F: Fun<T = T, V = V>,
    G: Fun<T = T, V = V>,
    A: Into<Anim<F>>,
    B: Into<Anim<G>>, 

Linearly interpolate between two animations, starting at time zero and finishing at time one.

This is a wrapper around Anim::lerp for convenience, allowing automatic conversion into Anim for both a and b.

Example

Linearly interpolate between two constant values:

let anim = pareen::lerp(5.0f32, 10.0);

assert_approx_eq!(anim.eval(0.0f32), 5.0);
assert_approx_eq!(anim.eval(0.5), 7.5);
assert_approx_eq!(anim.eval(1.0), 10.0);
assert_approx_eq!(anim.eval(2.0), 15.0);