-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
133 lines (111 loc) · 3.96 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<!doctype html>
<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>...and the forest began to sing</title>
<style>
body {
margin: 0 auto;
padding: 0 auto;
background: black;
overflow: hidden;
}
.video-container {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
video {
max-height: 80vh;
max-width: 80%;
}
#canv {
position: absolute;
z-index: -10000;
width: 100vw;
height: 100vh;
}
#autoclick {
display: none;
color: white;
position: absolute;
bottom: 8%;
left: 0%;
right: 0%;
font-family: monospace;
text-align: center
}
</style>
<script type="text/javascript">
document.addEventListener('touchstart', function () {
document.getElementsByTagName('audio')[0] &&
document.getElementsByTagName('audio')[0].play();
document.getElementById("autoclick").style.display = "none";
});
document.addEventListener('click', function () {
document.getElementsByTagName('audio')[0] &&
document.getElementsByTagName('audio')[0].play();
document.getElementById("autoclick").style.display = "none";
});
let processor = {
doLoad: function doLoad() {
this.video = document.getElementById('video');
this.c1 = document.getElementById('canv');
this.ctx1 = this.c1.getContext('2d');
let self = this;
self.timerCallback();
},
timerCallback: function timerCallback() {
if (this.video.paused || this.video.ended) {
console.log("ended");
setTimeout(function () {
self.timerCallback();
}, 2000);
}
this.computeFrame();
let self = this;
setTimeout(function () {
self.timerCallback();
}, 0);
},
computeFrame: function computeFrame() {
this.ctx1.drawImage(this.video, 0, 0, 32, 32);
let frame = this.ctx1.getImageData(0, 0, 32, 32);
let r = frame.data[0];
let g = frame.data[1];
let b = frame.data[2];
let a = (r + g + b) / 16;
this.ctx1.fillStyle = 'rgb(' + a + ', ' + a + ', ' + a + ')';
this.ctx1.fillRect(0, 0, 16, 16);
},
};
</script>
</head>
<body onload="processor.doLoad()">
<div class="video-container">
<audio autoplay loop>
<source src="ass/royksopp_smol.mp3" type="audio/mp3">
</audio>
<video id="video" autoplay loop muted playsinline>
<source src="ass/mado.webm" type="video/webm">
<source src="ass/mado.mp4" type="video/mp4">
</video>
<canvas id="canv" width="16" height="16"></canvas>
</div>
<div id="autoclick" style="display: none">
clicktodieinstantly
</div>
<script type="text/javascript">
let audio = document.getElementsByTagName('audio')[0];
this.setTimeout(() => {
if (audio.paused || audio.currentTime === 0) {
document.getElementById("autoclick").style.display = "block";
console.log("i was told to stop");
}
}, 3000);
</script>
</body>
</html>