Skip to content

Instantly share code, notes, and snippets.

@nishinoshake
Created May 17, 2016 23:33
Show Gist options
  • Save nishinoshake/639aff1828803b8d5e994b9ac84c314a to your computer and use it in GitHub Desktop.
Save nishinoshake/639aff1828803b8d5e994b9ac84c314a to your computer and use it in GitHub Desktop.
値のマッピング
mapValue(num, from_min, from_max, to_min, to_max) {
return ((num - from_min) / (from_max - from_min)) * (to_max - to_min) + to_min;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment