Created
September 3, 2017 08:00
-
-
Save bohnacker/890893dfddb4b5521a031f532df64944 to your computer and use it in GitHub Desktop.
Map a value 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
function map(val, low1, high1, low2, high2) { | |
return (val - low1) / (high1 - low1) * (high2 - low2) + low2; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment