pub fn linear_interpolate<T>(
    input: f32,
    inputs: &[f32],
    outputs: &[T],
    normalize: bool
) -> Twhere
    T: InterpolationPrimitive + Clone,
Expand description

Do linear interpolation.

f(t) = p0 + (p1 - p0) * d d = (t - t0) / (t1 - t0) p0 = output at left keyframe p1 = output at right keyframe t0 = input at left keyframe t1 = input at right keyframe

Parameters:

  • input: the input value to the function
  • inputs: list of discrete input values for each keyframe
  • outputs: list of output values to interpolate between, for linear interpolation this should be the same size as inputs
  • normalize: if true, normalize the interpolated value before returning it