Skip to content

Instantly share code, notes, and snippets.

@colormono
Last active March 14, 2019 15:13
Show Gist options
  • Select an option

  • Save colormono/d5f3aa5a2fade8271a6f6f5469b33042 to your computer and use it in GitHub Desktop.

Select an option

Save colormono/d5f3aa5a2fade8271a6f6f5469b33042 to your computer and use it in GitHub Desktop.
[MapNum] Map number between range #LensStudio #JS
/**
* 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