Spaces:
Running
Running
update index.html
Browse files- BallChase.html +0 -247
- index.html +244 -21
BallChase.html
DELETED
@@ -1,247 +0,0 @@
|
|
1 |
-
<!DOCTYPE html>
|
2 |
-
<html xmlns='http://www.w3.org/1999/xhtml' lang='' xml:lang=''>
|
3 |
-
<head>
|
4 |
-
<meta charset='utf-8' />
|
5 |
-
<meta name='viewport' content='width=device-width, user-scalable=no' />
|
6 |
-
<title>BallChase</title>
|
7 |
-
<style type='text/css'>
|
8 |
-
|
9 |
-
body {
|
10 |
-
touch-action: none;
|
11 |
-
margin: 0;
|
12 |
-
border: 0 none;
|
13 |
-
padding: 0;
|
14 |
-
text-align: center;
|
15 |
-
background-color: black;
|
16 |
-
}
|
17 |
-
|
18 |
-
#canvas {
|
19 |
-
display: block;
|
20 |
-
margin: 0;
|
21 |
-
color: white;
|
22 |
-
}
|
23 |
-
|
24 |
-
#canvas:focus {
|
25 |
-
outline: none;
|
26 |
-
}
|
27 |
-
|
28 |
-
.godot {
|
29 |
-
font-family: 'Noto Sans', 'Droid Sans', Arial, sans-serif;
|
30 |
-
color: #e0e0e0;
|
31 |
-
background-color: #3b3943;
|
32 |
-
background-image: linear-gradient(to bottom, #403e48, #35333c);
|
33 |
-
border: 1px solid #45434e;
|
34 |
-
box-shadow: 0 0 1px 1px #2f2d35;
|
35 |
-
}
|
36 |
-
|
37 |
-
|
38 |
-
/* Status display
|
39 |
-
* ============== */
|
40 |
-
|
41 |
-
#status {
|
42 |
-
position: absolute;
|
43 |
-
left: 0;
|
44 |
-
top: 0;
|
45 |
-
right: 0;
|
46 |
-
bottom: 0;
|
47 |
-
display: flex;
|
48 |
-
justify-content: center;
|
49 |
-
align-items: center;
|
50 |
-
/* don't consume click events - make children visible explicitly */
|
51 |
-
visibility: hidden;
|
52 |
-
}
|
53 |
-
|
54 |
-
#status-progress {
|
55 |
-
width: 366px;
|
56 |
-
height: 7px;
|
57 |
-
background-color: #38363A;
|
58 |
-
border: 1px solid #444246;
|
59 |
-
padding: 1px;
|
60 |
-
box-shadow: 0 0 2px 1px #1B1C22;
|
61 |
-
border-radius: 2px;
|
62 |
-
visibility: visible;
|
63 |
-
}
|
64 |
-
|
65 |
-
@media only screen and (orientation:portrait) {
|
66 |
-
#status-progress {
|
67 |
-
width: 61.8%;
|
68 |
-
}
|
69 |
-
}
|
70 |
-
|
71 |
-
#status-progress-inner {
|
72 |
-
height: 100%;
|
73 |
-
width: 0;
|
74 |
-
box-sizing: border-box;
|
75 |
-
transition: width 0.5s linear;
|
76 |
-
background-color: #202020;
|
77 |
-
border: 1px solid #222223;
|
78 |
-
box-shadow: 0 0 1px 1px #27282E;
|
79 |
-
border-radius: 3px;
|
80 |
-
}
|
81 |
-
|
82 |
-
#status-indeterminate {
|
83 |
-
visibility: visible;
|
84 |
-
position: relative;
|
85 |
-
}
|
86 |
-
|
87 |
-
#status-indeterminate > div {
|
88 |
-
width: 4.5px;
|
89 |
-
height: 0;
|
90 |
-
border-style: solid;
|
91 |
-
border-width: 9px 3px 0 3px;
|
92 |
-
border-color: #2b2b2b transparent transparent transparent;
|
93 |
-
transform-origin: center 21px;
|
94 |
-
position: absolute;
|
95 |
-
}
|
96 |
-
|
97 |
-
#status-indeterminate > div:nth-child(1) { transform: rotate( 22.5deg); }
|
98 |
-
#status-indeterminate > div:nth-child(2) { transform: rotate( 67.5deg); }
|
99 |
-
#status-indeterminate > div:nth-child(3) { transform: rotate(112.5deg); }
|
100 |
-
#status-indeterminate > div:nth-child(4) { transform: rotate(157.5deg); }
|
101 |
-
#status-indeterminate > div:nth-child(5) { transform: rotate(202.5deg); }
|
102 |
-
#status-indeterminate > div:nth-child(6) { transform: rotate(247.5deg); }
|
103 |
-
#status-indeterminate > div:nth-child(7) { transform: rotate(292.5deg); }
|
104 |
-
#status-indeterminate > div:nth-child(8) { transform: rotate(337.5deg); }
|
105 |
-
|
106 |
-
#status-notice {
|
107 |
-
margin: 0 100px;
|
108 |
-
line-height: 1.3;
|
109 |
-
visibility: visible;
|
110 |
-
padding: 4px 6px;
|
111 |
-
visibility: visible;
|
112 |
-
}
|
113 |
-
</style>
|
114 |
-
<link id='-gd-engine-icon' rel='icon' type='image/png' href='BallChase.icon.png' />
|
115 |
-
<link rel='apple-touch-icon' href='BallChase.apple-touch-icon.png'/>
|
116 |
-
|
117 |
-
</head>
|
118 |
-
<body>
|
119 |
-
<canvas id='canvas'>
|
120 |
-
HTML5 canvas appears to be unsupported in the current browser.<br />
|
121 |
-
Please try updating or use a different browser.
|
122 |
-
</canvas>
|
123 |
-
<div id='status'>
|
124 |
-
<div id='status-progress' style='display: none;' oncontextmenu='event.preventDefault();'><div id ='status-progress-inner'></div></div>
|
125 |
-
<div id='status-indeterminate' style='display: none;' oncontextmenu='event.preventDefault();'>
|
126 |
-
<div></div>
|
127 |
-
<div></div>
|
128 |
-
<div></div>
|
129 |
-
<div></div>
|
130 |
-
<div></div>
|
131 |
-
<div></div>
|
132 |
-
<div></div>
|
133 |
-
<div></div>
|
134 |
-
</div>
|
135 |
-
<div id='status-notice' class='godot' style='display: none;'></div>
|
136 |
-
</div>
|
137 |
-
|
138 |
-
<script type='text/javascript' src='BallChase.js'></script>
|
139 |
-
<script type='text/javascript'>//<![CDATA[
|
140 |
-
|
141 |
-
const GODOT_CONFIG = {"args":[],"canvasResizePolicy":2,"executable":"BallChase","experimentalVK":false,"fileSizes":{"BallChase.pck":228064,"BallChase.wasm":17472981},"focusCanvas":true,"gdnativeLibs":[]};
|
142 |
-
var engine = new Engine(GODOT_CONFIG);
|
143 |
-
|
144 |
-
(function() {
|
145 |
-
const INDETERMINATE_STATUS_STEP_MS = 100;
|
146 |
-
var statusProgress = document.getElementById('status-progress');
|
147 |
-
var statusProgressInner = document.getElementById('status-progress-inner');
|
148 |
-
var statusIndeterminate = document.getElementById('status-indeterminate');
|
149 |
-
var statusNotice = document.getElementById('status-notice');
|
150 |
-
|
151 |
-
var initializing = true;
|
152 |
-
var statusMode = 'hidden';
|
153 |
-
|
154 |
-
var animationCallbacks = [];
|
155 |
-
function animate(time) {
|
156 |
-
animationCallbacks.forEach(callback => callback(time));
|
157 |
-
requestAnimationFrame(animate);
|
158 |
-
}
|
159 |
-
requestAnimationFrame(animate);
|
160 |
-
|
161 |
-
function setStatusMode(mode) {
|
162 |
-
|
163 |
-
if (statusMode === mode || !initializing)
|
164 |
-
return;
|
165 |
-
[statusProgress, statusIndeterminate, statusNotice].forEach(elem => {
|
166 |
-
elem.style.display = 'none';
|
167 |
-
});
|
168 |
-
animationCallbacks = animationCallbacks.filter(function(value) {
|
169 |
-
return (value != animateStatusIndeterminate);
|
170 |
-
});
|
171 |
-
switch (mode) {
|
172 |
-
case 'progress':
|
173 |
-
statusProgress.style.display = 'block';
|
174 |
-
break;
|
175 |
-
case 'indeterminate':
|
176 |
-
statusIndeterminate.style.display = 'block';
|
177 |
-
animationCallbacks.push(animateStatusIndeterminate);
|
178 |
-
break;
|
179 |
-
case 'notice':
|
180 |
-
statusNotice.style.display = 'block';
|
181 |
-
break;
|
182 |
-
case 'hidden':
|
183 |
-
break;
|
184 |
-
default:
|
185 |
-
throw new Error('Invalid status mode');
|
186 |
-
}
|
187 |
-
statusMode = mode;
|
188 |
-
}
|
189 |
-
|
190 |
-
function animateStatusIndeterminate(ms) {
|
191 |
-
var i = Math.floor(ms / INDETERMINATE_STATUS_STEP_MS % 8);
|
192 |
-
if (statusIndeterminate.children[i].style.borderTopColor == '') {
|
193 |
-
Array.prototype.slice.call(statusIndeterminate.children).forEach(child => {
|
194 |
-
child.style.borderTopColor = '';
|
195 |
-
});
|
196 |
-
statusIndeterminate.children[i].style.borderTopColor = '#dfdfdf';
|
197 |
-
}
|
198 |
-
}
|
199 |
-
|
200 |
-
function setStatusNotice(text) {
|
201 |
-
while (statusNotice.lastChild) {
|
202 |
-
statusNotice.removeChild(statusNotice.lastChild);
|
203 |
-
}
|
204 |
-
var lines = text.split('\n');
|
205 |
-
lines.forEach((line) => {
|
206 |
-
statusNotice.appendChild(document.createTextNode(line));
|
207 |
-
statusNotice.appendChild(document.createElement('br'));
|
208 |
-
});
|
209 |
-
};
|
210 |
-
|
211 |
-
function displayFailureNotice(err) {
|
212 |
-
var msg = err.message || err;
|
213 |
-
console.error(msg);
|
214 |
-
setStatusNotice(msg);
|
215 |
-
setStatusMode('notice');
|
216 |
-
initializing = false;
|
217 |
-
};
|
218 |
-
|
219 |
-
if (!Engine.isWebGLAvailable()) {
|
220 |
-
displayFailureNotice('WebGL not available');
|
221 |
-
} else {
|
222 |
-
setStatusMode('indeterminate');
|
223 |
-
engine.startGame({
|
224 |
-
'onProgress': function (current, total) {
|
225 |
-
if (total > 0) {
|
226 |
-
statusProgressInner.style.width = current/total * 100 + '%';
|
227 |
-
setStatusMode('progress');
|
228 |
-
if (current === total) {
|
229 |
-
// wait for progress bar animation
|
230 |
-
setTimeout(() => {
|
231 |
-
setStatusMode('indeterminate');
|
232 |
-
}, 500);
|
233 |
-
}
|
234 |
-
} else {
|
235 |
-
setStatusMode('indeterminate');
|
236 |
-
}
|
237 |
-
},
|
238 |
-
}).then(() => {
|
239 |
-
setStatusMode('hidden');
|
240 |
-
initializing = false;
|
241 |
-
}, displayFailureNotice);
|
242 |
-
}
|
243 |
-
})();
|
244 |
-
//]]></script>
|
245 |
-
</body>
|
246 |
-
</html>
|
247 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
index.html
CHANGED
@@ -1,24 +1,247 @@
|
|
1 |
<!DOCTYPE html>
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
</div>
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
</html>
|
|
|
|
1 |
<!DOCTYPE html>
|
2 |
+
<html xmlns='http://www.w3.org/1999/xhtml' lang='' xml:lang=''>
|
3 |
+
<head>
|
4 |
+
<meta charset='utf-8' />
|
5 |
+
<meta name='viewport' content='width=device-width, user-scalable=no' />
|
6 |
+
<title>BallChase</title>
|
7 |
+
<style type='text/css'>
|
8 |
+
|
9 |
+
body {
|
10 |
+
touch-action: none;
|
11 |
+
margin: 0;
|
12 |
+
border: 0 none;
|
13 |
+
padding: 0;
|
14 |
+
text-align: center;
|
15 |
+
background-color: black;
|
16 |
+
}
|
17 |
+
|
18 |
+
#canvas {
|
19 |
+
display: block;
|
20 |
+
margin: 0;
|
21 |
+
color: white;
|
22 |
+
}
|
23 |
+
|
24 |
+
#canvas:focus {
|
25 |
+
outline: none;
|
26 |
+
}
|
27 |
+
|
28 |
+
.godot {
|
29 |
+
font-family: 'Noto Sans', 'Droid Sans', Arial, sans-serif;
|
30 |
+
color: #e0e0e0;
|
31 |
+
background-color: #3b3943;
|
32 |
+
background-image: linear-gradient(to bottom, #403e48, #35333c);
|
33 |
+
border: 1px solid #45434e;
|
34 |
+
box-shadow: 0 0 1px 1px #2f2d35;
|
35 |
+
}
|
36 |
+
|
37 |
+
|
38 |
+
/* Status display
|
39 |
+
* ============== */
|
40 |
+
|
41 |
+
#status {
|
42 |
+
position: absolute;
|
43 |
+
left: 0;
|
44 |
+
top: 0;
|
45 |
+
right: 0;
|
46 |
+
bottom: 0;
|
47 |
+
display: flex;
|
48 |
+
justify-content: center;
|
49 |
+
align-items: center;
|
50 |
+
/* don't consume click events - make children visible explicitly */
|
51 |
+
visibility: hidden;
|
52 |
+
}
|
53 |
+
|
54 |
+
#status-progress {
|
55 |
+
width: 366px;
|
56 |
+
height: 7px;
|
57 |
+
background-color: #38363A;
|
58 |
+
border: 1px solid #444246;
|
59 |
+
padding: 1px;
|
60 |
+
box-shadow: 0 0 2px 1px #1B1C22;
|
61 |
+
border-radius: 2px;
|
62 |
+
visibility: visible;
|
63 |
+
}
|
64 |
+
|
65 |
+
@media only screen and (orientation:portrait) {
|
66 |
+
#status-progress {
|
67 |
+
width: 61.8%;
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
#status-progress-inner {
|
72 |
+
height: 100%;
|
73 |
+
width: 0;
|
74 |
+
box-sizing: border-box;
|
75 |
+
transition: width 0.5s linear;
|
76 |
+
background-color: #202020;
|
77 |
+
border: 1px solid #222223;
|
78 |
+
box-shadow: 0 0 1px 1px #27282E;
|
79 |
+
border-radius: 3px;
|
80 |
+
}
|
81 |
+
|
82 |
+
#status-indeterminate {
|
83 |
+
visibility: visible;
|
84 |
+
position: relative;
|
85 |
+
}
|
86 |
+
|
87 |
+
#status-indeterminate > div {
|
88 |
+
width: 4.5px;
|
89 |
+
height: 0;
|
90 |
+
border-style: solid;
|
91 |
+
border-width: 9px 3px 0 3px;
|
92 |
+
border-color: #2b2b2b transparent transparent transparent;
|
93 |
+
transform-origin: center 21px;
|
94 |
+
position: absolute;
|
95 |
+
}
|
96 |
+
|
97 |
+
#status-indeterminate > div:nth-child(1) { transform: rotate( 22.5deg); }
|
98 |
+
#status-indeterminate > div:nth-child(2) { transform: rotate( 67.5deg); }
|
99 |
+
#status-indeterminate > div:nth-child(3) { transform: rotate(112.5deg); }
|
100 |
+
#status-indeterminate > div:nth-child(4) { transform: rotate(157.5deg); }
|
101 |
+
#status-indeterminate > div:nth-child(5) { transform: rotate(202.5deg); }
|
102 |
+
#status-indeterminate > div:nth-child(6) { transform: rotate(247.5deg); }
|
103 |
+
#status-indeterminate > div:nth-child(7) { transform: rotate(292.5deg); }
|
104 |
+
#status-indeterminate > div:nth-child(8) { transform: rotate(337.5deg); }
|
105 |
+
|
106 |
+
#status-notice {
|
107 |
+
margin: 0 100px;
|
108 |
+
line-height: 1.3;
|
109 |
+
visibility: visible;
|
110 |
+
padding: 4px 6px;
|
111 |
+
visibility: visible;
|
112 |
+
}
|
113 |
+
</style>
|
114 |
+
<link id='-gd-engine-icon' rel='icon' type='image/png' href='BallChase.icon.png' />
|
115 |
+
<link rel='apple-touch-icon' href='BallChase.apple-touch-icon.png'/>
|
116 |
+
|
117 |
+
</head>
|
118 |
+
<body>
|
119 |
+
<canvas id='canvas'>
|
120 |
+
HTML5 canvas appears to be unsupported in the current browser.<br />
|
121 |
+
Please try updating or use a different browser.
|
122 |
+
</canvas>
|
123 |
+
<div id='status'>
|
124 |
+
<div id='status-progress' style='display: none;' oncontextmenu='event.preventDefault();'><div id ='status-progress-inner'></div></div>
|
125 |
+
<div id='status-indeterminate' style='display: none;' oncontextmenu='event.preventDefault();'>
|
126 |
+
<div></div>
|
127 |
+
<div></div>
|
128 |
+
<div></div>
|
129 |
+
<div></div>
|
130 |
+
<div></div>
|
131 |
+
<div></div>
|
132 |
+
<div></div>
|
133 |
+
<div></div>
|
134 |
</div>
|
135 |
+
<div id='status-notice' class='godot' style='display: none;'></div>
|
136 |
+
</div>
|
137 |
+
|
138 |
+
<script type='text/javascript' src='BallChase.js'></script>
|
139 |
+
<script type='text/javascript'>//<![CDATA[
|
140 |
+
|
141 |
+
const GODOT_CONFIG = {"args":[],"canvasResizePolicy":2,"executable":"BallChase","experimentalVK":false,"fileSizes":{"BallChase.pck":228064,"BallChase.wasm":17472981},"focusCanvas":true,"gdnativeLibs":[]};
|
142 |
+
var engine = new Engine(GODOT_CONFIG);
|
143 |
+
|
144 |
+
(function() {
|
145 |
+
const INDETERMINATE_STATUS_STEP_MS = 100;
|
146 |
+
var statusProgress = document.getElementById('status-progress');
|
147 |
+
var statusProgressInner = document.getElementById('status-progress-inner');
|
148 |
+
var statusIndeterminate = document.getElementById('status-indeterminate');
|
149 |
+
var statusNotice = document.getElementById('status-notice');
|
150 |
+
|
151 |
+
var initializing = true;
|
152 |
+
var statusMode = 'hidden';
|
153 |
+
|
154 |
+
var animationCallbacks = [];
|
155 |
+
function animate(time) {
|
156 |
+
animationCallbacks.forEach(callback => callback(time));
|
157 |
+
requestAnimationFrame(animate);
|
158 |
+
}
|
159 |
+
requestAnimationFrame(animate);
|
160 |
+
|
161 |
+
function setStatusMode(mode) {
|
162 |
+
|
163 |
+
if (statusMode === mode || !initializing)
|
164 |
+
return;
|
165 |
+
[statusProgress, statusIndeterminate, statusNotice].forEach(elem => {
|
166 |
+
elem.style.display = 'none';
|
167 |
+
});
|
168 |
+
animationCallbacks = animationCallbacks.filter(function(value) {
|
169 |
+
return (value != animateStatusIndeterminate);
|
170 |
+
});
|
171 |
+
switch (mode) {
|
172 |
+
case 'progress':
|
173 |
+
statusProgress.style.display = 'block';
|
174 |
+
break;
|
175 |
+
case 'indeterminate':
|
176 |
+
statusIndeterminate.style.display = 'block';
|
177 |
+
animationCallbacks.push(animateStatusIndeterminate);
|
178 |
+
break;
|
179 |
+
case 'notice':
|
180 |
+
statusNotice.style.display = 'block';
|
181 |
+
break;
|
182 |
+
case 'hidden':
|
183 |
+
break;
|
184 |
+
default:
|
185 |
+
throw new Error('Invalid status mode');
|
186 |
+
}
|
187 |
+
statusMode = mode;
|
188 |
+
}
|
189 |
+
|
190 |
+
function animateStatusIndeterminate(ms) {
|
191 |
+
var i = Math.floor(ms / INDETERMINATE_STATUS_STEP_MS % 8);
|
192 |
+
if (statusIndeterminate.children[i].style.borderTopColor == '') {
|
193 |
+
Array.prototype.slice.call(statusIndeterminate.children).forEach(child => {
|
194 |
+
child.style.borderTopColor = '';
|
195 |
+
});
|
196 |
+
statusIndeterminate.children[i].style.borderTopColor = '#dfdfdf';
|
197 |
+
}
|
198 |
+
}
|
199 |
+
|
200 |
+
function setStatusNotice(text) {
|
201 |
+
while (statusNotice.lastChild) {
|
202 |
+
statusNotice.removeChild(statusNotice.lastChild);
|
203 |
+
}
|
204 |
+
var lines = text.split('\n');
|
205 |
+
lines.forEach((line) => {
|
206 |
+
statusNotice.appendChild(document.createTextNode(line));
|
207 |
+
statusNotice.appendChild(document.createElement('br'));
|
208 |
+
});
|
209 |
+
};
|
210 |
+
|
211 |
+
function displayFailureNotice(err) {
|
212 |
+
var msg = err.message || err;
|
213 |
+
console.error(msg);
|
214 |
+
setStatusNotice(msg);
|
215 |
+
setStatusMode('notice');
|
216 |
+
initializing = false;
|
217 |
+
};
|
218 |
+
|
219 |
+
if (!Engine.isWebGLAvailable()) {
|
220 |
+
displayFailureNotice('WebGL not available');
|
221 |
+
} else {
|
222 |
+
setStatusMode('indeterminate');
|
223 |
+
engine.startGame({
|
224 |
+
'onProgress': function (current, total) {
|
225 |
+
if (total > 0) {
|
226 |
+
statusProgressInner.style.width = current/total * 100 + '%';
|
227 |
+
setStatusMode('progress');
|
228 |
+
if (current === total) {
|
229 |
+
// wait for progress bar animation
|
230 |
+
setTimeout(() => {
|
231 |
+
setStatusMode('indeterminate');
|
232 |
+
}, 500);
|
233 |
+
}
|
234 |
+
} else {
|
235 |
+
setStatusMode('indeterminate');
|
236 |
+
}
|
237 |
+
},
|
238 |
+
}).then(() => {
|
239 |
+
setStatusMode('hidden');
|
240 |
+
initializing = false;
|
241 |
+
}, displayFailureNotice);
|
242 |
+
}
|
243 |
+
})();
|
244 |
+
//]]></script>
|
245 |
+
</body>
|
246 |
</html>
|
247 |
+
|