Skip to content

Instantly share code, notes, and snippets.

@jade-itworkswhy
Created October 6, 2020 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jade-itworkswhy/0f0a5c2f52425c73314ef50e5bc61598 to your computer and use it in GitHub Desktop.
Save jade-itworkswhy/0f0a5c2f52425c73314ef50e5bc61598 to your computer and use it in GitHub Desktop.
Number.prototype.map = function(in_min, in_max, out_min, out_max) {
return ((this - 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