Last active
August 29, 2015 14:06
-
-
Save hongkheng/fb39d531ddb5087f40c2 to your computer and use it in GitHub Desktop.
Clamping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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