-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
75 lines (68 loc) · 1.97 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Bouncing/colliding balls in 1D & 2D</title>
<link rel="stylesheet" type="text/css" media="screen" href="" />
<style>
* {
margin: 0;
padding: 0;
}
body {
background: gainsboro;
}
select {
position: fixed;
left: 10px;
top: 10px;
}
iframe {
width: 500px;
height: 400px;
margin: 0 auto;
display: block;
border: 0;
}
</style>
<head>
<body>
<select onchange="loadDemo(this)"></select>
<iframe id="iframe" src="Collisions in 1D/00 - one ball (simple)/index.html"></iframe>
<script>
var select = document.getElementsByTagName("select")[0];
var values = {
"Collisions in 1D" : [
"00 - one ball (simple)",
"01 - one ball (intersection with walls)",
"02 - one ball (snapping to walls)",
"03 - one ball (done)",
"04 - two balls (simple)",
"05 - two balls (collision detection)",
"06 - two balls (elastic collision)",
"07 - two balls (intersecting balls)",
"08 - two balls (snapping to balls)",
"09 - two balls (done)",
"10 - multiple balls (random positioning)",
"11 - multiple balls (with ui controls)",
],
"Collisions in 2D" : [],
};
for (var optgroup in values) {
var group = document.createElement("optgroup");
group.label = optgroup;
values[optgroup].forEach(function(value, index) {
var option = document.createElement("option");
option.innerText = values[optgroup][index];
option.value = optgroup + "/" + values[optgroup][index] + "/index.html";
group.appendChild(option);
});
select.appendChild(group);
}
var iframe = document.getElementById("iframe");
function loadDemo(select) {
iframe.src = select.options[select.selectedIndex].value;
}
</script>
</body>
</html>