scale_linear() function

Transforms a given value from an input domain to an output range using linear interpolation.

Syntax

scale_linear(val,domain_min,domain_max,range_min,range_max)

Arguments

val → is a value in the input domain. The function will return a corresponding scaled value in the output range.
domain_min, domain_max → specify the input domain, the smallest and largest values the input val should take.
range_min, range_max → specify the output range, the smallest and largest values which should be output by the function.

Example

scale_linear(5,0,10,0,100) → 50
scale_linear(0.2,0,1,0,360) → 72 (eg, scaling a value between 0 and 1 to an angle between 0 and 360)
scale_linear(1500,1000,10000,9,20) → 10.22 (eg, scaling a population which varies between 1000 and 10000 to a font size between 9 and 20)