@jossmac/lil-libs
    Preparing search index...

    Function unlerp

    • Inverse interpolation that returns a clamped factor in the 0..1 range.

      • from: number

        Range start mapped to 0.

      • to: number

        Range end mapped to 1.

      • value: number

        Number to express as a factor within the range.

      A factor in 0..1 for where value falls between from and to; clamped at the ends. When from === to, returns 1 if value > to, otherwise 0.

      unlerp(0, 100, 25); // 0.25
      unlerp(0, 10, -5); // 0 (clamped)
      unlerp(0, 10, 15); // 1 (clamped)