Function inverseLerp

  • Compute the opposite of lerp. Given a and b and a value between a and b returns a value between 0 and 1. 0 if a, 1 if b. Note: no clamping is done.

    Parameters

    • a: number

      start value

    • b: number

      end value

    • v: number

      value between a and b

    Returns number

    (v - a) / (b - a)