-
Notifications
You must be signed in to change notification settings - Fork 0
/
static2.html
48 lines (39 loc) · 898 Bytes
/
static2.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Attempt 2</title>
<style type="text/css">
html, body {
margin: 0px;
background-color: #000000;
width: 100%;
height: 100%;
overflow: hidden;
}
</style>
</head>
<body>
<canvas id='canvas'></canvas>
</body>
<script type="text/javascript">
function noise() {
let h = window.innerHeight;
let w = window.innerWidth;
let canvas = document.getElementById('canvas');
canvas.height = h;
canvas.width = w;
let ctx = canvas.getContext('2d');
for (let y=0; y < h; y+=1) {
for (let x=0; x < w; x+=1) {
let color = Math.random().toString(16).slice(-6);
ctx.fillStyle = '#' + color;
ctx.fillRect(x, y, 1, 1);
}
}
}
window.onload = noise;
window.onresize = noise;
window.onclick = noise;
</script>
</html>