scale_exp() function
Transforms a given value from an input domain to an output range using an exponential curve. This function can be used to ease values in or out
of the specified output range.
Syntax
scale_exp(val,domain_min,domain_max,range_min,range_max,exponent)
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.
exponent → a positive value (greater than 0), which dictates the way input values are mapped to the output range. Large exponents will cause the output values to 'ease in', starting slowly before
accelerating as the input values approach the domain maximum. Smaller exponents (less than 1) will cause output values to 'ease out', where the mapping starts quickly but slows as it approaches the domain maximum.
Example
Easing in, using an exponent of 2:
scale_exp(5,0,10,0,100,2) → 25
scale_exp(7.5,0,10,0,100,2) → 56.25
scale_exp(9.5,0,10,0,100,2) → 90.25
Easing out, using an exponent of 0.5:
scale_exp(3,0,10,0,100,0.5) → 54.772
scale_exp(6,0,10,0,100,0.5) → 77.459
scale_exp(9,0,10,0,100,0.5) → 94.868