Skip to content

Instantly share code, notes, and snippets.

@davydka
Last active December 4, 2015 19:34
Show Gist options
  • Save davydka/f58f7fc8b71551f7bc47 to your computer and use it in GitHub Desktop.
Save davydka/f58f7fc8b71551f7bc47 to your computer and use it in GitHub Desktop.
constrain values
scale(x, in_min, in_max, out_min, out_max){
return (x - 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