summaryrefslogtreecommitdiff
path: root/instructions.html
blob: 25f6e32dc04407101f90becec5f34e60b473bd56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!doctype html>
<html>
<head>
<title>instructions</title>
<style type="text/css">
html,body{margin:0;padding:5px; }
pre { font-family: serif; font-size: 14px; margin:0;padding:0;}
u{ color: #866; }
i{ color: #666; }
</style>
</head>
<body>
<pre id="pre"><u>function parameters</u>
w, h, x, y
t = current time (ms)
d[] = imageData array
r, g, b, a = color values
mousex, mousey

<u>Math aliases</u>
floor, ceil, round
abs, sign, mod(n,m)
pow, exp, sqrt
cos, sin, tan
acos, asin, atan, atan2
random()
E, PI, PHI

<u>convenience functions</u>
clamp(n,min,max)
lerp(n,a,b)
mix(n,a,b)
step(n,a,b)
smoothstep(n,a,b)
cosp, sinp (mapped to [0,1])
pixel(x,y) == 4*(y*w+h)
rand(n), randint(n)
choice(array)
deg(radians), rad(degrees)

<u>color functions</u>
rgb(x,y,z) (setter)
rgb2xyz(rgb)
xyz2rgb(xyz)
xyz2hunterlab(xyz)
hunterlab2xyz(Lab)
xyz2cielab(xyz)
cielab2xyz(Lab)
rgb2hsl (rgb)
hsl2rgb (hsl)
rgb2cmy (rgb)
cmy2rgb (cmy)
cmy2cmyk (cmy)
cmyk2cmy (cmyk)
(not all have been tested)
</pre>
</body>
<script>
pre.innerHTML = pre.innerHTML.replace(/\(/g,"(<i>").replace(/\)/g,"</i>)")
</script>
</html>