// Scales 50% to a range of 0-10% scalePercentages(0.5, 0, 0.10); // 0.05 - 5%
An error is thrown if any parameter is outside of percentage range. This added
safety is useful for catching bugs. Otherwise, you could just as well call
scale(percentage, 0, 1, outMin, outMax).
If you want to scale some input range to percentage output range, just use scale:
Scales an input percentage to a new percentage range.
If you have an input percentage (0-1),
scalePercentageOutput
maps it to an output percentage ofoutMin
-outMax
.An error is thrown if any parameter is outside of percentage range. This added safety is useful for catching bugs. Otherwise, you could just as well call
scale(percentage, 0, 1, outMin, outMax)
.If you want to scale some input range to percentage output range, just use
scale
: