-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
345 lines (314 loc) · 14.2 KB
/
index.html
File metadata and controls
345 lines (314 loc) · 14.2 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>App Loading Simulator</title>
<style>
:root {
--bg: #0f172a; /* slate-900 */
--fg: #e2e8f0; /* slate-200 */
--muted: #94a3b8; /* slate-400 */
--accent: #38bdf8; /* sky-400 */
--accent-2: #f472b6; /* pink-400 */
}
html, body {
height: 100%;
}
body {
margin: 0;
font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
background: radial-gradient(1200px 800px at 10% 10%, rgba(56, 189, 248, 0.08), transparent),
radial-gradient(1200px 800px at 90% 90%, rgba(244, 114, 182, 0.08), transparent),
var(--bg);
color: var(--fg);
display: grid;
place-items: center;
}
.wrap {
display: grid;
gap: 16px;
justify-items: center;
text-align: center;
padding: 32px;
}
h1 {
font-size: 1.5rem;
margin: 0;
}
p { margin: 0; color: var(--muted); }
/* Loading view */
#loading { display: grid; gap: 16px; justify-items: center; }
/* Showcase grid for multiple indicators */
.showcase {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
gap: 16px;
width: min(1000px, 92vw);
margin-top: 8px;
}
.box {
border: 1px solid rgba(226, 232, 240, 0.14);
border-radius: 12px;
padding: 12px;
display: grid;
gap: 8px;
justify-items: center;
background: rgba(2, 6, 23, 0.2);
}
.label { font-size: 0.8rem; color: var(--muted); }
.spinner {
width: 56px;
height: 56px;
border-radius: 50%;
border: 6px solid rgba(226, 232, 240, 0.2);
border-top-color: var(--accent);
border-right-color: var(--accent-2);
animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* 1) Dual ring */
.dual-ring { display: inline-block; width: 56px; height: 56px; }
.dual-ring::after {
content: "";
display: block;
width: 44px; height: 44px; margin: 6px;
border-radius: 50%;
border: 6px solid transparent;
border-top-color: var(--accent);
border-right-color: var(--accent-2);
animation: spin 1s linear infinite;
}
/* 2) Bouncing dots */
.dots { display: inline-flex; gap: 8px; align-items: flex-end; height: 20px; }
.dots > div {
width: 10px; height: 10px; border-radius: 50%;
background: var(--fg);
animation: dots 0.9s infinite ease-in-out both;
}
.dots > div:nth-child(1) { animation-delay: 0s; }
.dots > div:nth-child(2) { animation-delay: 0.15s; }
.dots > div:nth-child(3) { animation-delay: 0.3s; }
@keyframes dots {
0%, 80%, 100% { transform: translateY(0) scale(0.8); opacity: 0.6; }
40% { transform: translateY(-10px) scale(1); opacity: 1; }
}
/* 3) Pulse */
.pulse { width: 56px; height: 56px; border-radius: 50%; background: var(--accent); opacity: 0.6; animation: pulse 1.5s infinite; }
@keyframes pulse {
0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(56,189,248,0.7); }
70% { transform: scale(1); box-shadow: 0 0 0 18px rgba(56,189,248,0); }
100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(56,189,248,0); }
}
/* 4) Indeterminate bar */
.bar { position: relative; width: 120px; height: 8px; border-radius: 999px; background: rgba(226,232,240,0.18); overflow: hidden; }
.bar::before {
content: ""; position: absolute; inset: 0; width: 40%; left: -40%;
background: linear-gradient(90deg, transparent, var(--accent), transparent);
animation: bar 1.2s infinite;
}
@keyframes bar { to { left: 100%; } }
/* 5) Ripple */
.ripple { position: relative; width: 56px; height: 56px; }
.ripple div { position: absolute; border: 4px solid var(--accent); opacity: 1; border-radius: 50%; animation: ripple 1.5s cubic-bezier(0,0.2,0.8,1) infinite; }
.ripple div:nth-child(2) { border-color: var(--accent-2); animation-delay: -0.75s; }
@keyframes ripple {
0% { top: 24px; left: 24px; width: 0; height: 0; opacity: 1; }
100% { top: -2px; left: -2px; width: 56px; height: 56px; opacity: 0; }
}
/* 6) Grid pulse */
.grid { width: 56px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.grid div { width: 16px; height: 16px; background: var(--accent); animation: grid 1.4s infinite ease-in-out; }
.grid div:nth-child(odd) { background: var(--accent-2); }
.grid div:nth-child(1) { animation-delay: 0.0s; }
.grid div:nth-child(2) { animation-delay: 0.1s; }
.grid div:nth-child(3) { animation-delay: 0.2s; }
.grid div:nth-child(4) { animation-delay: 0.1s; }
.grid div:nth-child(5) { animation-delay: 0.2s; }
.grid div:nth-child(6) { animation-delay: 0.3s; }
.grid div:nth-child(7) { animation-delay: 0.2s; }
.grid div:nth-child(8) { animation-delay: 0.3s; }
.grid div:nth-child(9) { animation-delay: 0.4s; }
@keyframes grid { 0%, 100% { transform: scale(0.7); opacity: 0.6; } 50% { transform: scale(1); opacity: 1; } }
/* 7) Wave bars */
.wave { display: inline-flex; align-items: flex-end; gap: 4px; height: 40px; }
.wave div { width: 6px; height: 12px; background: var(--accent); animation: wave 1.2s infinite ease-in-out; border-radius: 3px; }
.wave div:nth-child(2) { animation-delay: 0.1s; }
.wave div:nth-child(3) { animation-delay: 0.2s; }
.wave div:nth-child(4) { animation-delay: 0.3s; }
.wave div:nth-child(5) { animation-delay: 0.4s; }
@keyframes wave { 0%, 40%, 100% { height: 12px; opacity: 0.7; } 20% { height: 38px; opacity: 1; } }
/* 8) Roller dots */
.roller { display: inline-block; position: relative; width: 56px; height: 56px; }
.roller div { animation: roller 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite; transform-origin: 28px 28px; }
.roller div::after { content: " "; display: block; position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--fg); margin: -3px 0 0 -3px; }
.roller div:nth-child(1) { animation-delay: -0.036s; }
.roller div:nth-child(1)::after { top: 46px; left: 46px; }
.roller div:nth-child(2) { animation-delay: -0.072s; }
.roller div:nth-child(2)::after { top: 50px; left: 41px; }
.roller div:nth-child(3) { animation-delay: -0.108s; }
.roller div:nth-child(3)::after { top: 54px; left: 32px; }
.roller div:nth-child(4) { animation-delay: -0.144s; }
.roller div:nth-child(4)::after { top: 50px; left: 23px; }
.roller div:nth-child(5) { animation-delay: -0.18s; }
.roller div:nth-child(5)::after { top: 46px; left: 16px; }
.roller div:nth-child(6) { animation-delay: -0.216s; }
.roller div:nth-child(6)::after { top: 41px; left: 10px; }
.roller div:nth-child(7) { animation-delay: -0.252s; }
.roller div:nth-child(7)::after { top: 32px; left: 6px; }
.roller div:nth-child(8) { animation-delay: -0.288s; }
.roller div:nth-child(8)::after { top: 23px; left: 10px; }
@keyframes roller { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
/* 9) Hourglass (ring variant) */
.hourglass { width: 56px; height: 56px; border-radius: 50%; border: 6px solid rgba(226,232,240,0.2); border-top-color: var(--accent); border-bottom-color: var(--accent-2); animation: hourglass 1.2s linear infinite; }
@keyframes hourglass { 0% { transform: rotate(0deg);} 50% { transform: rotate(180deg);} 100% { transform: rotate(360deg);} }
/* 10) Flip square */
.flip { width: 36px; height: 36px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); animation: flip 1.2s infinite; }
@keyframes flip {
0% { transform: perspective(100px) rotateX(0) rotateY(0); }
50% { transform: perspective(100px) rotateX(-180deg) rotateY(0); }
100% { transform: perspective(100px) rotateX(-180deg) rotateY(-180deg); }
}
/* Loaded (static) view */
#content { display: none; }
/* Utility */
.hidden { display: none !important; }
.dim { color: var(--muted); font-size: 0.95rem; }
.badge {
display: inline-block;
padding: 2px 8px;
border: 1px solid rgba(226, 232, 240, 0.2);
border-radius: 999px;
font-size: 0.8rem;
color: var(--muted);
}
/* Controls */
#controls { display: grid; gap: 8px; justify-items: center; }
.controls-form { display: inline-grid; grid-auto-flow: column; gap: 8px; align-items: center; }
.controls-form input { width: 140px; padding: 6px 8px; border-radius: 8px; border: 1px solid rgba(226,232,240,0.25); background: rgba(2,6,23,0.25); color: var(--fg); }
.controls-form button { padding: 6px 10px; border-radius: 8px; border: 1px solid rgba(226,232,240,0.25); background: rgba(2,6,23,0.25); color: var(--fg); cursor: pointer; }
#quickLinks { display: flex; gap: 8px; flex-wrap: wrap; }
#quickLinks a { color: var(--fg); opacity: 0.85; text-decoration: none; border: 1px solid rgba(226,232,240,0.18); border-radius: 999px; padding: 4px 8px; }
#quickLinks a:hover { opacity: 1; border-color: rgba(226,232,240,0.35); }
</style>
</head>
<body>
<main class="wrap" aria-live="polite">
<section id="controls" aria-label="Controls">
<form id="durationForm" class="controls-form">
<label for="durationInput" class="dim">Duration (ms)</label>
<input id="durationInput" name="duration" type="number" min="0" step="100" inputmode="numeric" />
<button type="submit">Set</button>
</form>
<div class="dim">Quick links:</div>
<div id="quickLinks" aria-label="Preset durations"></div>
</section>
<section id="loading" role="status" aria-busy="true">
<div class="spinner" aria-hidden="true"></div>
<h1>Loading application…</h1>
<p class="dim">Simulating startup delay</p>
<div class="showcase" aria-hidden="true">
<div class="box">
<div class="dual-ring"></div>
<div class="label">Dual Ring</div>
</div>
<div class="box">
<div class="dots"><div></div><div></div><div></div></div>
<div class="label">Bouncing Dots</div>
</div>
<div class="box">
<div class="pulse"></div>
<div class="label">Pulse</div>
</div>
<div class="box">
<div class="bar"></div>
<div class="label">Indeterminate Bar</div>
</div>
<div class="box">
<div class="ripple"><div></div><div></div></div>
<div class="label">Ripple</div>
</div>
<div class="box">
<div class="grid">
<div></div><div></div><div></div>
<div></div><div></div><div></div>
<div></div><div></div><div></div>
</div>
<div class="label">Grid Pulse</div>
</div>
<div class="box">
<div class="wave"><div></div><div></div><div></div><div></div><div></div></div>
<div class="label">Wave Bars</div>
</div>
<div class="box">
<div class="roller">
<div></div><div></div><div></div><div></div>
<div></div><div></div><div></div><div></div>
</div>
<div class="label">Roller Dots</div>
</div>
<div class="box">
<div class="hourglass"></div>
<div class="label">Hourglass</div>
</div>
<div class="box">
<div class="flip"></div>
<div class="label">Flip</div>
</div>
</div>
</section>
<section id="content" aria-busy="false">
<h1>Application Loaded</h1>
<p class="dim">This is the static loaded state.</p>
</section>
</main>
<script>
(function () {
const params = new URLSearchParams(window.location.search);
const raw = params.get('duration');
// Parse duration in milliseconds; default to 0 if absent/invalid
let duration = Number.parseInt(raw, 10);
if (!Number.isFinite(duration) || duration < 0) duration = 0;
// Hard cap to avoid excessively long waits in case of mistakes
const MAX_MS = 10 * 60 * 1000; // 10 minutes
if (duration > MAX_MS) duration = MAX_MS;
const loading = document.getElementById('loading');
const content = document.getElementById('content');
const durationInput = document.getElementById('durationInput');
const durationForm = document.getElementById('durationForm');
const quickLinks = document.getElementById('quickLinks');
// Form field starts empty on load
// Handle form submit to set new duration param
if (durationForm && durationInput) {
durationForm.addEventListener('submit', (e) => {
e.preventDefault();
const next = Number.parseInt(durationInput.value, 10);
const ms = Number.isFinite(next) && next >= 0 ? next : 0;
const url = new URL(window.location.href);
url.searchParams.set('duration', String(ms));
window.location.href = url.pathname + url.search;
});
}
// Build quick links for common durations
if (quickLinks) {
const presets = [100, 250, 500, 1000, 2500, 5000, 10000, 15000, 20000, 30000];
presets.forEach((ms) => {
const a = document.createElement('a');
a.href = `?duration=${ms}`;
a.textContent = `${ms.toLocaleString()} ms`;
quickLinks.appendChild(a);
});
}
function showLoaded() {
loading.classList.add('hidden');
content.style.display = 'grid';
}
if (duration === 0) {
showLoaded();
} else {
setTimeout(showLoaded, duration);
}
})();
</script>
</body>
</html>