-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
153 lines (124 loc) · 10.6 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<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>GO BOOTH</title>
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Bubblegum+Sans">
<link href='http://fonts.googleapis.com/css?family=Merienda+One' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<div class="content">
<div class="top">
<div class="video">
<h2 id="loading">GIMME CAM</h2>
<div class="controls right">
<div class="switch-option">
<label class="switch-light switch-material">
<input id="grey_on" type="checkbox">
<strong>Greyscale</strong>
<span>
<span>Off</span>
<span>On</span>
<a></a>
</span>
</label>
</div>
<div class="switch-option">
<label class="switch-light switch-material">
<input id="invert_on" type="checkbox">
<strong>Invert</strong>
<span>
<span>Off</span>
<span>On</span>
<a></a>
</span>
</label>
</div>
<div class="switch-option">
<label class="switch-light switch-material">
<input id="noise_on" type="checkbox">
<strong>Noise</strong>
<span>
<span>Off</span>
<span>On</span>
<a></a>
</span>
</label>
</div>
<div class="switch-option">
<label class="switch-light switch-material">
<input id="red_on" type="checkbox">
<strong>RedScale</strong>
<span>
<span>Off</span>
<span>On</span>
<a></a>
</span>
</label>
</div>
</div>
<canvas id="canvas" width="800" height="800"></canvas>
<canvas id="capture" width="850" height="890"></canvas>
<video id="video" autoplay></video>
<img id="template" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcIAAAHqCAMAAACgOb4sAAAAyVBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///9CNME5LrnJxuz8/P7V0/DMye3HxOzs6/ijnd708/s/Nbvd2/Pv7/r39/1kW8jo5/f6+f3Oy+69uuhCN7zX1fHCv+rFwus7MLrSz+/h3/RSSMKMhtfb2fLf3fTj4fVNQ8DZ1/JgV8dYTsS4tOZGPL6HgNW0r+V/eNJvaM1mXsnx8Pqrp+KRi9h2bs9rY8vl5PZ6c9CwrOOfmd2Vj9qmoeCaldxdVMby8fphWMjQ6YmZAAAACXRSTlMAzAaWNsYoy24/n6DDAAAPoUlEQVR42uzRyw3CMABAsbZJymf/gWEDxC1PslfwAQAAAMAeXoQozFOYd30pTJtz3pfCsjHG874Uhq21xlRYdj4Uxp2nwjiFeT8K32xKYZ7CPIV5CvP+KzzYisI8hXkK8xTmKcxTmKcwT2GewjyFeQrzFOYpzFOYpzBPYZ7CPIV5CvMU5inMU5inME9hnsI8hXkK8xTmKcxTmKcwT2GewjyFeQrzFOYpzFOYpzBPYZ7CPIV5CvMU5inMU5inME9hnsI8hXkK8xTmKcxTmKcwT2GewjyFeQrzFOYpzFOYpzBPYZ7CPIV5CvMU5inMU5inME9hnsI8hXkK8xTmKcxTmKcwT2GewjyFeQrzFOYpzFOYpzBPYZ7CPIV5CvMU5inMU5inME9hnsI8hXkK8xTmKcxTmKcwT2GewjyFeQrzFOYpzFP4YY8OSAAAAAAE/X/dDiEvyLuQdyHvQt6FvAt5F/Iu5F3Iu5B3Ie9C3oW8C3kX8i7kXci7kHch70LehbwLeRfyLuRdyLuQdyHvQt6FvAt5F/Iu5F3Iu5B3Ie9C3oW8C3kX8i7kXci7kHch70LehbwLeRfyLuRdy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SgrTBdQYay6I+ONcigo7Jrwpp1ohVJvsQOdBmiFzehGokWlN4Q7YgJ9ZLjTnVcOc+l9BvCQwikjRn1Q6GKu4n/zcXioswLvjp75FcdchEq3use6CQI/ZUWevfPaZK5SXN6n+eKdZ5wYUCUYiU2JkKm1uJhf/iwtVqcYLaRIf0RqdZURpPDO8GYie6Wr3e8g4buJKn+LAe515w3ogZMYZPCgQrNnWdbQBEmlaA5x2APBwdI09Ew5dqnsgCJona3sWdX9da3PQXFxn54HJRpU5HAJkw4dAOLQyoCohMdVfBq6eiFBrsPq90X08UXLvJfIj7Yv0+5uEZZCBdnirTt92UY5IHe64+jDBaD4/1+B/wH+K/zZHh3dABBBARDkcei/4vMlERSwyU4Lg2chnoV4FuJZiGchnoV4FuJZiGchnoV4q3AXtXxZEM/CnoXQn4XCuBa2UYQxWqTLYRXGHDyFSJIkSZp+e3slUexEbhMAAAAASUVORK5CYII="
alt="">
<p id="fps"></p>
</div>
</div>
</div>
</div>
</div>
<footer>
<a href="https://twitter.com/aarushikansal">slide into my dms: @aarushikansal<a/>
</a>
</footer>
<script src="web_exec.js"></script>
<script src="main.js"></script>
<script>
if (!WebAssembly.instantiateStreaming) {
// polyfill
WebAssembly.instantiateStreaming = async (resp, importObject) => {
const source = await (await resp).arrayBuffer();
return await WebAssembly.instantiate(source, importObject);
};
}
const go = new Go();
let mod, inst;
WebAssembly.instantiateStreaming(fetch("main.wasm"), go.importObject).then(
result => {
mod = result.module;
inst = result.instance;
go.run(inst).then()
// Setup FPS indicator
const fps = new Fps(250, elements.fps);
let render = () => {
fps.tick();
elements.canvas.ctx.hidden.drawImage(elements.canvas.video, (elements.canvas.video.videoWidth - WIDTH) / 2, (elements.canvas.video.videoHeight - HEIGHT) / 2, WIDTH, HEIGHT, 0, 0, WIDTH, HEIGHT);
// get image from canvas
const imageData = elements.canvas.ctx.hidden.getImageData(0, 0, WIDTH, HEIGHT);
const imgUint8Arr = new Uint8Array(imageData.data.buffer)
// apply filters with option
const updatedData = applyFilter(getOptions(), imgUint8Arr);
const data = new Uint8ClampedArray(updatedData, 4 * WIDTH * HEIGHT);
const imageDataUpdated = new ImageData(data, WIDTH, HEIGHT);
// write image back to canvas
elements.canvas.ctx.visible.putImageData(imageDataUpdated, 0, 0);
requestAnimationFrame(render);
};
render();
}
);
</script>
</body>
</html></title>
</head>
<body>
</body>
</html>