Created
April 23, 2020 15:34
-
-
Save gntlechaos/0b7ad1774d0354529bec9f70014eee21 to your computer and use it in GitHub Desktop.
Re-maps a number from one range to another.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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