@yesstudio/yes-utils
    Preparing search index...

    Function interpolate

    • Calculates a linear interpolation within the inclusive range specified by start and end based on ratio.

      Parameters

      • ratio: number

        The ratio between start and end.

      • start: number

        The start of the range.

      • end: number

        The end of the range.

      Returns number

      Returns the interpolated number.

      interpolate(0.5, 0, 10)
      // => 5

      interpolate(1.5, 0, 10)
      // => 15

      interpolate(-0.5, 0, 10)
      // => -5