diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-03-12 01:42:41 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-03-12 01:42:41 +0100 |
| commit | 6a83c9b84f49d541f39726712b8a0331590555d2 (patch) | |
| tree | 51f5f29e35fa3af1f483ce8b1bb9829d281c13f0 /client/lib/util.js | |
| parent | 48f66e675f632d4ae837b3f8474569b3cfbceb56 (diff) | |
basic linear spectral manipulation!
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, } |
