@blinkk/degu
    Preparing search index...

    Function interpolateRange

    • Lerps within a given range.

      Let's say you have to ranges that you want to make a linear association to.

      The easiest way to imagine this is imagine two ranges.

      0     Range1        100
      |------10------------|

      0 Range2 200
      |-------------?-------------------------|

      range1: 0 - 100 range2: 0 - 200

      You have the value of 20 on range1 and want to know what the value would be on range2.

      The above would return 20 since 10% of 200 = 20.

      mathf.interpolateRange(0, 0, 100, 0, 200); // 0
      mathf.interpolateRange(10, 0, 100, 0, 200); // 20
      mathf.interpolateRange(30, 0, 100, 0, 200); // 60

      A practical example. Here when the screen width is 300, the padding is 0 and when it's 1200, the padding is 500 and everything it clculates everything between.


      let padding = mathf.interpolateRange(
      screenWidth,
      300, 1200,
      0, 500
      );

      Parameters

      • range1Value: number
      • range1Min: number
      • range1Max: number
      • range2Min: number
      • range2Max: number

      Returns number