Created
November 17, 2015 09:21
-
-
Save stekhn/f5150f8b7e5b3d6056e0 to your computer and use it in GitHub Desktop.
Map value to range
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 mapValue(value, fromMin, toMin, fromMax, toMax) { | |
return (value - fromMin) / (toMin - fromMin) * (toMax - fromMax) + fromMax; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment