Merge pull request #33 from lctrt/feat/clamp
add clamp and step function
This commit is contained in:
commit
97861dc3f3
@ -163,4 +163,12 @@ function Library (ronin) {
|
||||
this.mod = function (a, b) {
|
||||
return a % b
|
||||
}
|
||||
|
||||
this.clamp = function (val, min, max) {
|
||||
return Math.min(max, Math.max(min, val))
|
||||
}
|
||||
|
||||
this.step = function (val, step) {
|
||||
return Math.round(val / step) * step
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user