Map a range of number to another range of number

PHOTO EMBED

Tue May 11 2021 22:07:26 GMT+0000 (Coordinated Universal Time)

Saved by @minercreep #javascript

const scale = (num, in_min, in_max, out_min, out_max) => {
  return (num - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
content_copyCOPY