diff options
Diffstat (limited to 'client/lib/util.js')
| -rw-r--r-- | client/lib/util.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/client/lib/util.js b/client/lib/util.js index fd48768..1bbee9d 100644 --- a/client/lib/util.js +++ b/client/lib/util.js @@ -21,6 +21,7 @@ function lerp(n,a,b){ return (b-a)*n+a } function angle(x0,y0,x1,y1){ return Math.atan2(y1-y0,x1-x0) } function dist(x0,y0,x1,y1){ return Math.sqrt(Math.pow(x1-x0,2)+Math.pow(y1-y0,2)) } function xor(a,b){ a=!!a; b=!!b; return (a||b) && !(a&&b) } +function quantize(a,b){ return Math.floor(a/b)*b } function shuffle(a){ for (var i = a.length; i > 0; i--){ var r = randint(i) @@ -104,7 +105,7 @@ function requestAudioContext (fn) { } export { - clamp, choice, mod, lerp, angle, dist, xor, + clamp, choice, mod, lerp, angle, dist, xor, quantize, randint, randrange, randsign, shuffle, gaussian, browser, requestAudioContext, } |
