Created
May 23, 2012 18:34
-
-
Save jkosoy/2776908 to your computer and use it in GitHub Desktop.
Port of Processing's map() function to JS. See: http://processing.org/reference/map_.html
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, a1, a2, b1, b2) { return ((val - a1) * (b2 -b1)/(a2 - a1)) + b1; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment