I am currently working on mapping a rotation angle scale in degrees to a light intensity scale representing the movement of a rotating sun, with values ranging from 0.0 to 0.9. To accomplish this, I have implemented a custom mapping function as shown below:
function map (num, in_min, in_max, out_min, out_max)
{
return (num - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
//(degree, degree in min, degree in max, light intensity out min, light intensity out max
var fade = map(30, 180, 360, 0.0, 0.9);
Despite this functionality, I find that the fading effect is too slow, resulting in a limited duration where the light intensity reaches its maximum value. I seek for more versatility in defining the scale mapping process – how can I achieve this customization?