-
-
Save mahdisoultana/4bb1d44c48d95c485033c204e8fc4d59 to your computer and use it in GitHub Desktop.
Map a number in one range to a number in 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 mapNumber = (number, in_min, in_max, out_min, out_max) => { | |
return (number - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very Handy Function Mapping rang of number to another Range Number