-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFauxDwitter.html
49 lines (48 loc) · 1.45 KB
/
FauxDwitter.html
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
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=<device-width>, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
* {
font-family: 'Arial', san-serif;
}
body {
background-color: #f8f8f8;
}
canvas {
background-color: #fff;
transform: scale(0.5);
transform-origin: top left;
}
</style>
</head>
<body>
<h1>FauxDwitter</h1>
<p>A replication of the <a href="dwitter.net">Dwitter</a> API for local development.</p>
<pre>
u(t) is called 60 times per second.
t: Elapsed time in seconds.
S: Shorthand for Math.sin.
C: Shorthand for Math.cos.
T: Shorthand for Math.tan.
R: Function that generates rgba-strings, usage ex.: R(255, 255, 255, 0.5)
c: A 1920x1080 canvas.
x: A 2D context for that canvas.
</pre>
<button id="reset">Reset Dweet</button>
<span id="counter"></span>
<canvas id="dweet"></canvas>
<script src="FauxDwitter.js"></script>
<script>
FauxDwitter.init();
// Put your Dweet script here
function u(t) {
w=c.width=2e3;j=h=c.height=1e3;for(;--j;){p=j*C(t)*4;x.fillStyle=R(0,0,0,j*0.01);x.fillRect((j*S(t)*50)+w/2,h/2,p,p);}
/* Example dweet */
}
FauxDwitter.run(u);
</script>
</body>
</html>