-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
81 lines (72 loc) · 2.71 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>bu.js Examples</title>
<link rel="icon" type="image/png" href="logo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="examples/css/index.css">
<script type="text/javascript">
let SOURCE_URL_BASE = 'https://github.com/jarvisniu/bu.js/blob/master/examples/'
let hashPath, frame, source, links
document.addEventListener('DOMContentLoaded', function () {
frame = document.querySelector('iframe')
source = document.querySelector('#source')
links = document.querySelectorAll('#side a')
window.addEventListener('hashchange', onHashChanged)
onHashChanged()
if (!window.location.hash) window.location.hash = '#!/hello_bu.html'
})
function onHashChanged () {
let hash = window.location.hash
hashPath = hash.replace('#!/', '')
if (hashPath.length > 0) {
frame.src = 'examples/' + hashPath
source.setAttribute('href', SOURCE_URL_BASE + hashPath)
}
for (let i = 0; i < links.length; i++) {
if (hash.length > 0 && links[i].href.indexOf(hash) > -1) {
links[i].style.backgroundColor = '#CCC'
} else {
links[i].style.backgroundColor = ''
}
}
}
</script>
</head>
<body>
<div id="side">
<a href="https://github.com/jarvisniu/bu.js" target="_blank">
<img id="logo" src="logo.png">
</a>
<h1>bu.js Examples</h1>
<h2>Graphics</h2>
<a href="#!/hello_bu.html">Hello bu.js</a>
<a href="#!/all_shapes.html">All Shapes</a>
<a href="#!/all_styles.html">All Styles</a>
<a href="#!/bitmap_font.html">Bitmap Font</a>
<a href="#!/animation.html">Animation</a>
<h2>Interactive</h2>
<a href="#!/keyboard_control.html">Keyboard Control</a>
<a href="#!/camera_control.html">Camera Control</a>
<a href="#!/drag_point.html">Drag to Move Point</a>
<a href="#!/draw_shapes.html">Draw Shapes</a>
<h2>Geometry</h2>
<a href="#!/hit_testing.html">Hit Testing</a>
<a href="#!/line_near_point.html">Point Near Line Test</a>
<a href="#!/point_to_line_distance.html">Distance of Point To Line</a>
<h2>Algorithm Visualization</h2>
<a href="#!/bubble_sort.html">Bubble Sort</a>
<a href="#!/indoor_navigation.html">Indoor Navigation</a>
<a href="#!/a_star_grid.html">A Star Grid</a>
<a href="#!/a_star_honeycomb.html">A Star Honeycomb</a>
<a href="#!/delaunay_triangulation.html">Delaunay Triangulation</a>
<h2>Game</h2>
<a href="#!/tank.html">Tank (In Progress)</a>
</div>
<div id="container">
<iframe name="web" src="about:blank" frameborder="0"></iframe>
<a id="source" href="https://github.com/jarvisniu" target="_blank">Source</a>
</div>
</body>
</html>