Skip to content

Instantly share code, notes, and snippets.

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