Skip to content

Instantly share code, notes, and snippets.

View carolina-vallejo's full-sized avatar

Carolina Vallejo carolina-vallejo

  • ITONICS, GmbH
  • Berlin
View GitHub Profile
@AugustMiller
AugustMiller / map.js
Last active October 2, 2021 14:14
Map a number in one range to a number in another.
function mapNumber (number, inMin, inMax, outMin, outMax) {
return (number - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
}