Last active
March 14, 2019 15:13
-
-
Save colormono/d5f3aa5a2fade8271a6f6f5469b33042 to your computer and use it in GitHub Desktop.
[MapNum] Map number between range #LensStudio #JS
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
| /** | |
| * Map number between range | |
| */ | |
| function mapNum(input, in_min, in_max, out_min, out_max) { | |
| return ((input - in_min) * (out_max - out_min)) / (in_max - in_min) + out_min; | |
| } | |
| // Example | |
| //var mapedNumber = mapNum(someNumVar, -15, 15, -1, 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment