diff options
| author | jules <jules@okfoc.us> | 2013-12-17 02:21:02 -0500 |
|---|---|---|
| committer | jules <jules@okfoc.us> | 2013-12-17 02:21:02 -0500 |
| commit | 52615cba1b4d14345f7df97cf0a63a6b39829398 (patch) | |
| tree | 0b280f518f444216cf1efda200ee58531b6ea169 | |
| parent | 23c37629c05dd09a0f607f38937d130ca95fb087 (diff) | |
proper modulo function
| -rw-r--r-- | instructions.html | 3 | ||||
| -rw-r--r-- | js/util.js | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/instructions.html b/instructions.html index 39bf3bf..25f6e32 100644 --- a/instructions.html +++ b/instructions.html @@ -18,7 +18,8 @@ r, g, b, a = color values mousex, mousey <u>Math aliases</u> -floor, ceil, round, abs, sign +floor, ceil, round +abs, sign, mod(n,m) pow, exp, sqrt cos, sin, tan acos, asin, atan, atan2 @@ -41,6 +41,7 @@ function choice(a){ return a[randint(a.length)] } function deg(n){ return n*180/PI } function rad(n){ return n*PI/180 } function pixel(x,y){ return 4*(y*w+x) } +function mod(n,m){ return n-(m * Math.floor(n/m)) } function step (n,a,b) { return clamp((n - a) / (b - a), 0.0, 1.0); |
