Created
September 29, 2017 14:49
-
-
Save ryanramage/d89e856e37eb6ef4be35aa3ef35f1166 to your computer and use it in GitHub Desktop.
Make a scaling function that maps 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
const scale = (inMin, inMax, outMin, outMax) => (input) => outMin + ((outMax - outMin) * ((input - inMin) / (inMax - inMin))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment