Function lerp

  • Returns a linear interpolation function for given pivot points.

    Notes: Don't mutate xs and ys arrays after creating this function since data from these arrays is read during interpolation.

    Parameters

    • xs: ArrayLike<number>

      The array of X coordinates of pivot points in ascending order.

    • ys: ArrayLike<number>

      The array of corresponding Y coordinates of pivot points.

    Returns Mapper<number>

    The function that takes X coordinate and returns an interpolated Y coordinate.

    const f = lerp(xs, ys);
    const y = f(x);
MMNEPVFCICPMFPCPTTAAATR