-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsprite-demo.html
More file actions
340 lines (297 loc) · 10.9 KB
/
sprite-demo.html
File metadata and controls
340 lines (297 loc) · 10.9 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GALAX Sprite Animation Demo</title>
<style>
:root {
--primary: #4ecdc4;
--primary-dark: #44a08d;
--accent: #ff6b47;
--background: #f8f9fa;
--text: #333;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
color: var(--text);
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 20px;
}
.demo-container {
background: white;
padding: 30px;
border-radius: 15px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
max-width: 800px;
width: 100%;
text-align: center;
}
h1 {
color: var(--primary);
margin-bottom: 20px;
font-size: 2.5rem;
}
.subtitle {
color: #666;
margin-bottom: 30px;
font-size: 1.2rem;
}
.info-section {
background: var(--background);
padding: 20px;
border-radius: 10px;
margin: 20px 0;
text-align: left;
}
.info-section h3 {
color: var(--primary);
margin-bottom: 10px;
}
.feature-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 20px;
margin: 20px 0;
}
.feature-card {
background: white;
padding: 20px;
border-radius: 10px;
border: 2px solid var(--primary);
transition: transform 0.3s ease;
}
.feature-card:hover {
transform: translateY(-5px);
}
.feature-card h4 {
color: var(--primary);
margin-bottom: 10px;
}
.btn {
background: var(--primary);
color: white;
border: none;
padding: 15px 30px;
border-radius: 8px;
cursor: pointer;
font-size: 18px;
transition: background 0.3s ease;
margin: 10px;
}
.btn:hover {
background: var(--primary-dark);
}
.btn:active {
transform: scale(0.98);
}
.animation-list {
display: flex;
flex-wrap: wrap;
gap: 10px;
justify-content: center;
margin: 20px 0;
}
.animation-tag {
background: var(--accent);
color: white;
padding: 5px 12px;
border-radius: 20px;
font-size: 12px;
font-weight: bold;
}
.credits {
font-size: 0.9rem;
color: #666;
margin-top: 30px;
padding-top: 20px;
border-top: 1px solid #eee;
}
.loading {
display: inline-block;
width: 20px;
height: 20px;
border: 3px solid #f3f3f3;
border-top: 3px solid var(--primary);
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.error {
color: #ff4444;
background: #ffebee;
padding: 10px;
border-radius: 5px;
margin: 10px 0;
display: none;
}
.success {
color: #00aa00;
background: #e8f5e8;
padding: 10px;
border-radius: 5px;
margin: 10px 0;
display: none;
}
@media (max-width: 768px) {
.demo-container {
padding: 20px;
}
h1 {
font-size: 2rem;
}
.feature-grid {
grid-template-columns: 1fr;
}
}
</style>
</head>
<body>
<div class="demo-container">
<h1>🎮 GALAX Sprite Animation Demo</h1>
<p class="subtitle">Interactive LPC Character Animation System</p>
<div class="info-section">
<h3>About This Demo</h3>
<p>This demo showcases the Liberated Pixel Cup (LPC) sprite animation system used in Project GALAX.
The character is composed of multiple layered sprites that can be animated independently,
allowing for complex character customization and smooth animations.</p>
</div>
<div class="feature-grid">
<div class="feature-card">
<h4>🎨 Layer System</h4>
<p>Character built from 14 different sprite layers including body, clothing, accessories, and weapons.</p>
</div>
<div class="feature-card">
<h4>🎭 15 Animations</h4>
<p>Complete animation set including combat moves, emotions, and movement cycles.</p>
</div>
<div class="feature-card">
<h4>🎯 Pixel Perfect</h4>
<p>Crisp pixel art rendering with smooth frame-by-frame animation at 64x64 resolution.</p>
</div>
<div class="feature-card">
<h4>⚡ Performance</h4>
<p>Optimized rendering with layer z-ordering and efficient sprite management.</p>
</div>
</div>
<div class="animation-list">
<span class="animation-tag">Spellcast</span>
<span class="animation-tag">Thrust</span>
<span class="animation-tag">Walk</span>
<span class="animation-tag">Slash</span>
<span class="animation-tag">Shoot</span>
<span class="animation-tag">Hurt</span>
<span class="animation-tag">Climb</span>
<span class="animation-tag">Idle</span>
<span class="animation-tag">Jump</span>
<span class="animation-tag">Sit</span>
<span class="animation-tag">Emote</span>
<span class="animation-tag">Run</span>
<span class="animation-tag">Combat Idle</span>
<span class="animation-tag">Backslash</span>
<span class="animation-tag">Halfslash</span>
</div>
<div class="error" id="error-msg">
Failed to load sprite animation system. Please check that all sprite files are present.
</div>
<div class="success" id="success-msg">
Sprite animation system loaded successfully!
</div>
<button class="btn" id="launch-demo">
<span id="btn-text">🚀 Launch Animation Demo</span>
<span class="loading" id="loading" style="display: none;"></span>
</button>
<div class="info-section">
<h3>Controls</h3>
<ul>
<li><strong>Animation Dropdown:</strong> Select different character animations</li>
<li><strong>Play/Pause:</strong> Control animation playback</li>
<li><strong>Speed Slider:</strong> Adjust animation speed (50-500ms per frame)</li>
<li><strong>Reset:</strong> Return to first frame of current animation</li>
<li><strong>Close:</strong> Close the animation viewer</li>
</ul>
</div>
<div class="credits">
<p><strong>Sprite Credits:</strong> Based on the Universal LPC Character Generator</p>
<p>Art by bluecarrot16, JaidynReiman, ElizaWy, Stephen Challener (Redshrike), and many others</p>
<p>Licensed under OGA-BY, CC-BY-SA, GPL, and CC0</p>
</div>
</div>
<!-- Load the sprite animation system -->
<script src="js/components/sprite-animation.js"></script>
<script>
// Demo page controller
class SpriteDemo {
constructor() {
this.initializeDemo();
}
initializeDemo() {
const launchBtn = document.getElementById('launch-demo');
const btnText = document.getElementById('btn-text');
const loading = document.getElementById('loading');
const errorMsg = document.getElementById('error-msg');
const successMsg = document.getElementById('success-msg');
launchBtn.addEventListener('click', async () => {
try {
// Show loading state
btnText.style.display = 'none';
loading.style.display = 'inline-block';
launchBtn.disabled = true;
errorMsg.style.display = 'none';
successMsg.style.display = 'none';
// Close existing demo if open
const existing = document.getElementById('sprite-animation-container');
if (existing) {
existing.remove();
}
// Small delay to show loading state
await new Promise(resolve => setTimeout(resolve, 500));
// Create sprite animation demo
const spriteManager = new SpriteAnimationManager();
// Show success message
successMsg.style.display = 'block';
setTimeout(() => {
successMsg.style.display = 'none';
}, 3000);
} catch (error) {
console.error('Failed to launch sprite demo:', error);
errorMsg.style.display = 'block';
setTimeout(() => {
errorMsg.style.display = 'none';
}, 5000);
} finally {
// Reset button state
btnText.style.display = 'inline';
loading.style.display = 'none';
launchBtn.disabled = false;
}
});
// Add keyboard shortcut
document.addEventListener('keydown', (e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
launchBtn.click();
}
});
}
}
// Initialize demo when page loads
document.addEventListener('DOMContentLoaded', () => {
new SpriteDemo();
});
</script>
</body>
</html>