Last active
April 12, 2018 15:29
-
-
Save nkint/a1486134930db6b1415c1a9d42a5f20d to your computer and use it in GitHub Desktop.
map P5
This file contains hidden or 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
/* | |
FAMOUS MAP FUNCITON FROM PROCESSING.ORG PROGRAMMING LANGUAGE | |
Taken from: https://stackoverflow.com/a/17135426 | |
*/ | |
export function map(value, istart, istop, ostart, ostop) { | |
return ostart + (ostop - ostart) * ((value - istart) / (istop - istart)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment