scale()

Scales a number using an input range and and an output range to give a proportional output.

This function is valid in v2.15.0 to v2.17.1. This function has been downloaded 11 times.

Parameters

{number} x
The value to be scaled.
{number} minX
The lower bound of x.
{number} maxX
The upper bound of x.
{number} minReturn
The lower bound of the return value which directly corresponds to minX.
{number} maxReturn
The upper bound of the return value which directly corresponds to maxX.

Returns

{number}
Returns x scaled based on the range of minX to maxX being proportional to minReturn to maxReturn. If x is within the range of minX and maxX the return value will be within the range of minReturn and maxReturn. If x is outside of the range of minX to maxX then the return value will also be outside of the minReturn to maxReturn range. If minReturn and maxReturn are the same minReturn will be returned.