-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
79 lines (72 loc) · 1.73 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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>WebAssembly Spectrogram</title>
<style>
html, body, #splash, #spectrogram {
height: 100%;
width: 100%;
margin: 0;
}
#splash {
position: fixed;
display: flex;
align-items: center;
justify-content: center;
background-color: white;
}
#splash #button {
font-size: 200%;
font-weight: bold;
font-family: monospace;
padding: 10px;
border: 4px solid black;
background-color: transparent;
color: black;
cursor: pointer;
}
#splash #button.enabled:hover {
background-color: black;
color: white;
}
#splash #button.disabled {
border: none;
}
#spectrogram {
display: flex;
flex-direction: column;
}
#spectrogram canvas {
flex-grow: 1;
flex-shrink: 1;
}
#spectrogram img {
width: 100%;
}
</style>
<script type="module">
import {main, default as init} from "./bin/index.js";
init("./bin/index_bg.wasm").then(() => {
const splash = document.getElementById("splash");
const button = document.getElementById("button");
button.innerText = "click to start";
button.className = "enabled";
button.onclick = function () {
splash.remove();
main();
}
});
</script>
</head>
<body>
<div id="splash">
<span id="button" class="disabled">loading...</span>
</div>
<div id="spectrogram">
<canvas id="canvas"></canvas>
<img src="piano-keyboard-40-87.svg"
alt="Piano Keyboard" />
</div>
</body>
</html>