Skip to content

Instantly share code, notes, and snippets.

@gntlechaos
Created April 23, 2020 15:34
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Re-maps a number from one range to another.
//This function acts like java Processing's map()
function mapMinMax(value,oldMin,oldMax,newMin, newMax) {
return (newMax-newMin)*(value-oldMin)/(oldMax-oldMin)+newMin;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment