forked from sebleedelisle/live-coding-presentations
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SmashingConf2014.html
62 lines (42 loc) · 1021 Bytes
/
SmashingConf2014.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
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE HTML>
<html lang="en">
<meta charset="utf-8">
<head>
<title> Particles!</title>
<style type="text/css">
body {
background-color:black;
margin:0px;
overflow : hidden;
}
</style>
</head>
<body>
<script>
var canvas = document.createElement('canvas');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
var ctx = canvas.getContext('2d');
document.body.appendChild(canvas);
var rotation = 0;
setInterval(loop, 16);
function loop() {
ctx.fillStyle = 'black';
ctx.fillRect(0,0,canvas.width, canvas.height);
ctx.save();
ctx.translate(canvas.width/2, canvas.height/2);
ctx.rotate(rotation * Math.PI/180);
ctx.globalCompositeOperation = 'lighter';
for(var i = 0; i< 36; i++) {
ctx.lineWidth = 5;
ctx.scale(0.96,0.96);
ctx.rotate(rotation *0.1 * Math.PI/180);
ctx.strokeStyle = 'hsla('+i*10+',100%, 70%, 1)';
ctx.strokeRect(50,0,300,300);
}
rotation +=0.1;
ctx.restore();
}
</script>
</body>
</html>