/
index.html
58 lines (56 loc) 路 1.53 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>HyperPixel</title>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
/>
<style>
body,
html {
margin: 0px;
overflow: hidden;
background: black;
height: 100%;
text-align: center;
}
#screen {
height: 100%;
image-rendering: -moz-crisp-edges;
image-rendering: -webkit-crisp-edges;
image-rendering: pixelated;
image-rendering: crisp-edges;
}
@media screen and (max-aspect-ratio:160/144) {
#screen {
height: auto;
width: 100%;
position: absolute;
top: 50%;
left: 0;
transform: translate(0%, -50%);
-ms-transform: translate(0%, -50%);
-webkit-transform: translate(0%, -50%);
}
}
</style>
</head>
<body>
<canvas width="800" height="600" id="screen"></canvas>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/109/three.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/richardanaya/hyperpixel/hyperpixel.js"></script>
<script>
var hp = new HyperPixel(document.getElementById("screen"));
function update() {
window.requestAnimationFrame(update);
for (i = 0; i < hp.width * hp.height * 3; i++) {
hp.colors[i] = Math.random()*.3;
}
hp.render();
}
update();
</script>
</body>
</html>