Skip to content

Instantly share code, notes, and snippets.

@hongkheng
Last active August 29, 2015 14:06
Show Gist options
  • Save hongkheng/fb39d531ddb5087f40c2 to your computer and use it in GitHub Desktop.
Save hongkheng/fb39d531ddb5087f40c2 to your computer and use it in GitHub Desktop.
Clamping
function clamp(val:Number, min:Number = MIN, max:Number = MAX){
return Math.max(min, Math.min(max, val))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment