Merge pull request #33 from lctrt/feat/clamp

add clamp and step function
This commit is contained in:
Лu Лinveгa
2019-07-14 09:12:40 +12:00
committed by GitHub

View File

@@ -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
}
}