forked from wwwtyro/canvas-video-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
48 lines (34 loc) · 943 Bytes
/
example.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
<html>
<head>
<script src='http://localhost:3172/cvg.js'></script>
<script>
window.onload = function() {
var canvas = document.createElement('canvas');
canvas.width = 640;
canvas.height = 360;
document.body.appendChild(canvas);
ctx = canvas.getContext('2d');
var count = 0;
function render() {
for (var i = 0; i < 640; i+=10) {
for (var j = 0; j < 360; j+=10) {
var c = Math.round(Math.random() * 255);
ctx.fillStyle = 'rgba(' + c + ', ' + c + ', ' + c + ', 1)';
ctx.fillRect(i, j, 10, 10);
}
}
cvg.addFrame(canvas);
count++;
if (count < 100) {
requestAnimationFrame(render);
} else {
cvg.render('example');
}
}
render();
}
</script>
</head>
<body>
</body>
</html>