-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgo.html
56 lines (53 loc) · 1.93 KB
/
go.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
<html>
<head>
<title>Go triangles!</title>
<meta charset="utf-8"/>
<script src="wasm_exec.js"></script>
<script>
const go = new Go();
WebAssembly.instantiateStreaming(fetch("main.wasm"), go.importObject).then((result) => {
go.run(result.instance);
});
</script>
<style>
#mycanvas {
position:fixed;
opacity:0.9;
width: 100%;
height:100%;
top:0;right:0;bottom:0;left:0;
}
.control-group {
display:flex;
align-items:center;
justify-content: flex-start;
}
.control-group label { flex:0; flex-basis: 150px; }
.control-group input { flex-grow:0; }
.control-group span { width:50px;}
.control {
position:fixed;
padding:20px;
background: rgba(0,0,0,0.2);
color:#FFF;
top:0;right:0;
}
body,pre { margin:0;padding:0; }
</style>
</head>
<body>
<canvas id="mycanvas"></canvas>
<div class="control">
<div id="fps">0</div>
<div class="control-group">
<label>Simulation Speed</label><input id="speed" type="range" min="1" max="16" step="1" value="12"> <span id="speed-value">12</span>
</div>
<div class="control-group">
<label>Num Balls</label><input id="num-balls" type="range" min="0" max="200" step="1" value="0"> <span id="num-balls-value">0</span>
</div>
<div class="control-group">
<label>Ball Spawn Rate</label><input id="ball-spawn-rate" type="range" min="0.01" max=".99" step=".01" value="0.10"> <span id="ball-spawn-rate-value">.10</span>
</div>
</div>
</body>
</html>