-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
122 lines (122 loc) · 3.18 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
<!DOCTYPE html>
<html>
<head>
<title>ScreenFuzz</title>
<script>
var screenWidth = window.screen.width >>> 0;
var screenHeight = window.screen.height >>> 0;
var FrameDelay = 1;
var counter = 0;
var frameOffset = 0;
var frames = null;
var destHandle = null;
var DelayLUT = [
1,
2,
3,
4,
5,
6,
7,
8,
16,
32,
64,
128,
256,
512,
1024,
2048
];
function generateFrame(elementId) {
elementId = elementId | 0;
var elementHandle = document.getElementById("_" + elementId);
var contextHandle = elementHandle.getContext("2d");
elementHandle.width = screenWidth >>> 0;
elementHandle.height = screenHeight >>> 0;
var imageBuffer = contextHandle.getImageData(0, 0, screenWidth >>> 0, screenHeight >>> 0);
var data = imageBuffer.data;
var frameLength = data.length | 0;
var z = elementId;
var xx = 0;
var z = elementId | 0;
while ((xx | 0) < (frameLength | 0)) {
var zz = z | 0;
for (var x = 0; (x | 0) < (screenWidth >>> 0); x = ((x | 0) + 1) | 0) {
switch (zz | 0) {
case 0:
data[xx | 0] = 0xFF;
data[((xx | 0) + 1) | 0] = 0;
data[((xx | 0) + 2) | 0] = 0;
zz = 1;
break;
case 1:
data[(xx | 0)] = 0;
data[((xx | 0) + 1) | 0] = 0xFF;
data[((xx | 0) + 2) | 0] = 0;
zz = 2;
break;
case 2:
data[(xx | 0)] = 0;
data[((xx | 0) + 1) | 0] = 0;
data[((xx | 0) + 2) | 0] = 0xFF;
zz = 0;
}
data[((xx | 0) + 3) | 0] = 0xFF;
xx = ((xx | 0) + 4) | 0;
}
z = (((z | 0) + 1) % 3) | 0;
}
contextHandle.putImageData(imageBuffer, 0, 0);
return elementHandle;
}
function screenfuzz() {
frames = [generateFrame(0), generateFrame(1), generateFrame(2)];
document.getElementById("speed").value = 0;
elementHandle = document.getElementById("destination");
destHandle = elementHandle.getContext("2d");
elementHandle.width = screenWidth >>> 0;
elementHandle.height = screenHeight >>> 0;
drawFrame();
}
function drawFrame() {
destHandle.drawImage(frames[frameOffset | 0], 0, 0);
counter = ((counter | 0) + 1) | 0;
if ((counter | 0) == (FrameDelay | 0)) {
frameOffset = (((frameOffset | 0) + 1) % 3) | 0;
counter = 0;
}
window.requestAnimationFrame(drawFrame);
}
function updateCounter(newValue) {
newValue = newValue >>> 0;
FrameDelay = DelayLUT[newValue >>> 0] >>> 0;
counter = 0;
}
</script>
<style>
html, body {
overflow: hidden;
margin: 0px;
padding: 0px;
width: 100%;
height: 100%;
}
canvas {
margin: 0px;
padding: 0px;
overflow: hidden;
cursor: none;
}
.hiddenBuffers {
display: none;
}
input {
top: 10px;
left: 10px;
position: fixed;
}
</style>
</head>
<body onload="screenfuzz();"><input type="range" id="speed" min="0" max="15" step="1" value="0" onchange="updateCounter(this.value >>> 0);"><canvas id="_0" class="hiddenBuffers"></canvas><canvas id="_1" class="hiddenBuffers"></canvas><canvas id="_2" class="hiddenBuffers"></canvas><canvas id="destination"></canvas></body>
</html>