-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
729 lines (680 loc) · 41.6 KB
/
Copy pathindex.html
File metadata and controls
729 lines (680 loc) · 41.6 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
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
<!DOCTYPE html>
<html lang="en" data-galaxy-theme="dark">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>GalaxyJS v3.4 "Optics" — Interactive Showcase</title>
<link rel="canonical" href="https://edwson.github.io/GalaxyJS/">
<meta name="description" content="GalaxyJS — a zero-dependency cosmic animation & UI component library. Live playground." />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet" />
<link rel="stylesheet" href="galaxy.css" onerror="this.onerror=null;this.href='https://cdn.jsdelivr.net/gh/Edwson/GalaxyJS@main/galaxy.min.css'" />
<style>
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--gx-font); background: var(--gx-bg); color: var(--gx-text); }
a { color: inherit; text-decoration: none; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
/* Top nav */
header.nav {
position: sticky; top: 0; z-index: var(--gx-z-sticky);
backdrop-filter: blur(14px);
background: color-mix(in srgb, var(--gx-bg) 78%, transparent);
border-bottom: 1px solid var(--gx-border);
}
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; }
.brand .dot { width: 22px; height: 22px; border-radius: 50%; background: conic-gradient(from 0deg, var(--gx-accent-2), var(--gx-accent), var(--gx-accent-3), var(--gx-accent-2)); box-shadow: var(--gx-glow); }
.nav__links { display: flex; gap: 4px; align-items: center; }
.nav__links a { padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--gx-text-soft); font-size: .9rem; font-weight: 600; }
.nav__links a:hover { background: var(--gx-surface-2); color: var(--gx-text); }
/* Cinematic scroll hero — powered by Galaxy.scrollScene() (v3.4.0) */
.cine { position: relative; }
.cine__pin { position: sticky; top: 0; height: 100vh; overflow: hidden; }
.cine__stage { position: absolute; inset: 0; z-index: 1; }
.cine__grad { position: absolute; inset: 0; z-index: 2; pointer-events: none;
background:
radial-gradient(130% 90% at 18% 100%, color-mix(in srgb, var(--gx-bg) 90%, transparent), transparent 58%),
linear-gradient(180deg, color-mix(in srgb, var(--gx-bg) 46%, transparent), transparent 26%, color-mix(in srgb, var(--gx-bg) 64%, transparent)); }
.cine__frame { position: absolute; inset: 16px; z-index: 3; pointer-events: none; border-radius: 14px;
border: 1px solid color-mix(in srgb, var(--gx-accent-2) 18%, transparent); }
.cine__frame::before, .cine__frame::after { content: ""; position: absolute; width: 18px; height: 18px; border: 2px solid var(--gx-accent-2); opacity: .7; }
.cine__frame::before { left: -1px; top: -1px; border-right: 0; border-bottom: 0; border-top-left-radius: 14px; }
.cine__frame::after { right: -1px; bottom: -1px; border-left: 0; border-top: 0; border-bottom-right-radius: 14px; }
.cine__hud { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.cine__copy { position: absolute; left: 0; bottom: 0; pointer-events: auto;
max-width: 720px; padding: 0 clamp(24px, 5vw, 72px) clamp(76px, 13vh, 124px); }
.cine__eyebrow { font-family: var(--gx-font-mono); font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--gx-accent-2); margin-bottom: 14px; }
.cine__h1 { font-size: clamp(2.4rem, 6.4vw, 4.6rem); line-height: 1.03; margin: 0 0 16px; font-weight: 800; letter-spacing: -0.02em; white-space: pre-line; min-height: 2em; }
.cine__lead { font-size: clamp(1rem, 2.1vw, 1.22rem); color: var(--gx-text-soft); margin: 0 0 24px; line-height: 1.6; max-width: 560px; min-height: 3em; }
.cine__cta { display: flex; gap: 12px; flex-wrap: wrap; }
.cine__pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.cine__tel { position: absolute; top: clamp(82px, 13vh, 116px); right: clamp(20px, 5vw, 60px); z-index: 5; width: 234px;
font-family: var(--gx-font-mono); font-size: .72rem; color: var(--gx-text-soft); pointer-events: none;
border: 1px solid color-mix(in srgb, var(--gx-accent-2) 24%, var(--gx-border)); border-radius: 12px;
background: color-mix(in srgb, var(--gx-bg) 60%, transparent); backdrop-filter: blur(8px); padding: 12px 15px; }
.cine__tel-row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px dashed color-mix(in srgb, var(--gx-accent-2) 16%, var(--gx-border)); }
.cine__tel-row:last-of-type { border-bottom: 0; }
.cine__tel-row b { color: var(--gx-accent-2); font-weight: 500; }
.cine__tel-bars { display: flex; gap: 3px; margin-top: 10px; }
.cine__tel-bar { flex: 1; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--gx-accent-2) 16%, var(--gx-border)); transition: background .25s; }
.cine__tel-bar.on { background: var(--gx-accent-2); }
@media (max-width: 820px) { .cine__tel { display: none; } }
.cine__scrub { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; padding: 0 clamp(24px, 5vw, 72px) 22px; pointer-events: none; }
.cine__scrub-track { position: relative; height: 2px; border-radius: 2px; background: color-mix(in srgb, var(--gx-text) 14%, transparent); }
.cine__scrub-fill { position: absolute; left: 0; top: 0; height: 100%; width: 0; border-radius: 2px; background: linear-gradient(90deg, var(--gx-accent), var(--gx-accent-2)); }
.cine__scrub-marks { display: flex; justify-content: space-between; margin-top: 10px; font-family: var(--gx-font-mono); font-size: .62rem; letter-spacing: .06em; color: var(--gx-text-muted); }
.cine__scrub-marks span.on { color: var(--gx-accent-2); }
.cine__hint { position: absolute; bottom: 50px; left: 50%; transform: translateX(-50%); z-index: 5; pointer-events: none;
font-family: var(--gx-font-mono); font-size: .7rem; letter-spacing: .1em; color: var(--gx-text-muted); transition: opacity .4s; animation: cineBob 1.9s ease-in-out infinite; }
@keyframes cineBob { 0%, 100% { transform: translateX(-50%) translateY(0); opacity: .65; } 50% { transform: translateX(-50%) translateY(5px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .cine__hint { animation: none; } }
section { padding: 80px 0; }
.section-head { text-align: center; max-width: 680px; margin: 0 auto 48px; }
.section-head h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 12px; font-weight: 800; letter-spacing: -0.01em; }
.section-head p { color: var(--gx-text-soft); font-size: 1.05rem; line-height: 1.6; margin: 0; }
.eyebrow { display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gx-accent); margin-bottom: 12px; }
/* Animation gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.demo-card { padding: 0; overflow: hidden; cursor: pointer; }
.demo-card .surface { height: 170px; }
.demo-card .meta { padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; }
.demo-card .meta h3 { margin: 0; font-size: 1rem; font-weight: 700; }
.demo-card .meta span { font-size: .75rem; color: var(--gx-text-muted); font-family: var(--gx-font-mono); }
/* Playground */
.play { display: grid; grid-template-columns: 1.6fr 1fr; gap: 22px; align-items: stretch; }
@media (max-width: 880px) { .play { grid-template-columns: 1fr; } .nav__links a:not(.cta) { display: none; } }
#play-stage { height: 420px; border-radius: var(--gx-radius-lg); }
.panel { display: flex; flex-direction: column; gap: 16px; }
.control { display: flex; flex-direction: column; gap: 6px; }
.control label { font-size: .8rem; font-weight: 600; color: var(--gx-text-soft); display: flex; justify-content: space-between; }
.control label b { color: var(--gx-accent); font-family: var(--gx-font-mono); font-weight: 600; }
input[type="range"] { width: 100%; accent-color: var(--gx-accent); }
select.gx-select { cursor: pointer; }
pre.code { margin: 0; padding: 16px; background: #070912; border: 1px solid var(--gx-border); border-radius: var(--gx-radius); overflow:auto; font-family: var(--gx-font-mono); font-size: .82rem; line-height: 1.6; color: #cdd6f4; }
pre.code .k { color: #c4b5ff; } pre.code .s { color: #a6e3a1; } pre.code .n { color: #fab387; } pre.code .c { color: #6b739c; font-style: italic; }
/* Components grid */
.comp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 18px; }
.comp-grid .gx-card { display: flex; flex-direction: column; gap: 14px; }
.comp-grid h3 { margin: 0; font-size: 1rem; }
.swatches { display:flex; gap:8px; }
.sw { width: 28px; height: 28px; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.sw.active { border-color: #fff; }
footer { padding: 60px 0 80px; border-top: 1px solid var(--gx-border); text-align: center; color: var(--gx-text-muted); }
footer a { color: var(--gx-text-soft); }
</style>
</head>
<body>
<!-- NAV -->
<header class="nav">
<div class="wrap nav__inner">
<div class="brand"><span class="dot"></span> GalaxyJS <span class="gx-badge gx-badge--accent">v3.4</span></div>
<nav class="nav__links">
<a href="#animations">Animations</a>
<a href="#playground">Playground</a>
<a href="#components">Components</a>
<a href="#start">Get Started</a>
<a href="https://github.com/Edwson/GalaxyJS" target="_blank" rel="noopener" class="gx-btn gx-btn--ghost gx-btn--sm cta">★ GitHub</a>
<a href="#" class="gx-btn gx-btn--ghost gx-btn--sm cta" id="themeBtn">☾ Theme</a>
</nav>
</div>
</header>
<!-- CINEMATIC HERO · powered by Galaxy.scrollScene() (v3.4.0) -->
<section class="cine" id="cine" style="height:360vh;">
<div class="cine__pin">
<div class="cine__stage" id="cine-stage"></div>
<div class="cine__grad"></div>
<div class="cine__frame"></div>
<div class="cine__hud">
<div class="cine__copy">
<div class="cine__eyebrow" id="cineEyebrow">Zero required dependencies · 86 animations · v3.4.0</div>
<h1 class="cine__h1 gx-text-gradient" id="cineH1">The universe,
one line of code.</h1>
<p class="cine__lead" id="cineLead">Cosmic canvas backdrops, a themeable UI kit, and one unified API: <code>Galaxy.create()</code>.</p>
<div class="cine__cta">
<a href="#playground" class="gx-btn gx-btn--primary gx-btn--lg">Try the playground</a>
<a href="#start" class="gx-btn gx-btn--ghost gx-btn--lg">Get started</a>
</div>
<div class="cine__pills">
<span class="gx-badge">⚡ One shared rAF</span>
<span class="gx-badge">♿ Reduced-motion safe</span>
<span class="gx-badge">📦 ~21 kB gzip · no build</span>
</div>
</div>
<div class="cine__tel" aria-hidden="true">
<div class="cine__tel-row"><span>SCENE</span><b id="telScene">galaxyMerge</b></div>
<div class="cine__tel-row"><span>PHASE</span><b id="telIdx">01 / 04</b></div>
<div class="cine__tel-row"><span>PROGRESS</span><b id="telPct">0%</b></div>
<div class="cine__tel-bars" id="telBars"></div>
</div>
<div class="cine__scrub" aria-hidden="true">
<div class="cine__scrub-track"><div class="cine__scrub-fill" id="scrubFill"></div></div>
<div class="cine__scrub-marks" id="scrubMarks"></div>
</div>
<div class="cine__hint" id="cineHint">↓ scroll to explore</div>
</div>
</div>
</section>
<!-- ANIMATIONS -->
<section id="animations" class="wrap">
<div class="section-head">
<span class="eyebrow">The Collection</span>
<h2><span id="animCount">86</span> cosmic animations</h2>
<p>Every animation is a surface auto-sized to its container, paused when off-screen, and rendered through one shared loop — canvas 2D, hand-written WebGL2, or an optional three.js scene. Click any card to load it in the playground.</p>
</div>
<div class="gallery" id="gallery"></div>
</section>
<!-- PLAYGROUND -->
<section id="playground" style="background: var(--gx-bg-soft);">
<div class="wrap">
<div class="section-head">
<span class="eyebrow">Live Playground</span>
<h2>Tweak it. Copy it. Ship it.</h2>
<p>Adjust parameters in real time and copy the exact code you need.</p>
</div>
<div class="play">
<div id="play-stage" class="gx-card" style="padding:0;"></div>
<div class="panel">
<div class="control">
<label for="animSel">Animation</label>
<select id="animSel" class="gx-select"></select>
</div>
<div class="control">
<label>Speed <b id="speedVal">1.0</b></label>
<input id="speed" type="range" min="0.1" max="3" step="0.1" value="1" />
</div>
<div class="control">
<label>Density <b id="densVal">1.0</b></label>
<input id="density" type="range" min="0.2" max="2.5" step="0.1" value="1" />
</div>
<div class="control">
<label>Accent palette</label>
<div class="swatches" id="swatches"></div>
</div>
<pre class="code" id="codeOut"></pre>
<button class="gx-btn gx-btn--accent gx-btn--block" id="copyBtn">Copy code</button>
</div>
</div>
</div>
</section>
<!-- COMPONENTS -->
<section id="components" class="wrap">
<div class="section-head">
<span class="eyebrow">UI Kit</span>
<h2>Components, fully themed</h2>
<p>Buttons, cards, modals, toasts, tooltips, tabs, accordions and more — all driven by the same design tokens, all wired with one call to <code>Galaxy.autoInit()</code>.</p>
</div>
<div class="comp-grid">
<div class="gx-card gx-card--spotlight">
<h3>Buttons</h3>
<div class="gx-row gx-row--wrap">
<button class="gx-btn gx-btn--primary">Primary</button>
<button class="gx-btn gx-btn--accent">Accent</button>
<button class="gx-btn gx-btn--ghost">Ghost</button>
<button class="gx-btn gx-btn--danger">Danger</button>
</div>
</div>
<div class="gx-card gx-card--spotlight">
<h3>Toasts</h3>
<div class="gx-row gx-row--wrap">
<button class="gx-btn gx-btn--ghost" onclick="Galaxy.toast('Star saved to your galaxy ✨', {type:'success'})">Success</button>
<button class="gx-btn gx-btn--ghost" onclick="Galaxy.toast('Solar flare detected', {type:'warning'})">Warning</button>
<button class="gx-btn gx-btn--ghost" onclick="Galaxy.toast('Signal lost', {type:'danger'})">Danger</button>
</div>
</div>
<div class="gx-card gx-card--spotlight">
<h3>Modal & Confirm</h3>
<div class="gx-row gx-row--wrap">
<button class="gx-btn gx-btn--ghost" id="modalBtn">Open modal</button>
<button class="gx-btn gx-btn--ghost" id="confirmBtn">Confirm</button>
</div>
</div>
<div class="gx-card gx-card--spotlight">
<h3>Tooltips</h3>
<div class="gx-row gx-row--wrap">
<button class="gx-btn gx-btn--ghost" data-gx-tooltip="I appear on top" data-gx-tooltip-pos="top">Top</button>
<button class="gx-btn gx-btn--ghost" data-gx-tooltip="I appear below" data-gx-tooltip-pos="bottom">Bottom</button>
<button class="gx-btn gx-btn--ghost" data-gx-tooltip="To the right →" data-gx-tooltip-pos="right">Right</button>
</div>
</div>
<div class="gx-card gx-card--spotlight" data-gx-tabs>
<h3>Tabs</h3>
<div class="gx-tabs__list" role="tablist">
<button class="gx-tab" aria-selected="true">Orbit</button>
<button class="gx-tab">Nebula</button>
<button class="gx-tab">Pulsar</button>
</div>
<div class="gx-tab-panel gx-soft">Planets trace clean elliptical paths around a star.</div>
<div class="gx-tab-panel gx-soft" hidden>Soft drifting clouds of ionized gas.</div>
<div class="gx-tab-panel gx-soft" hidden>A rotating neutron star beaming radiation.</div>
</div>
<div class="gx-card gx-card--spotlight">
<h3>Accordion</h3>
<div class="gx-accordion" data-gx-accordion style="border:none;">
<div class="gx-accordion__item">
<button class="gx-accordion__header">Is it really zero-dependency? <span class="gx-accordion__icon">⌄</span></button>
<div class="gx-accordion__panel"><div class="gx-accordion__panel-inner">Yes — pure vanilla JS and CSS. No React, no build step required.</div></div>
</div>
<div class="gx-accordion__item">
<button class="gx-accordion__header">Does it respect reduced motion? <span class="gx-accordion__icon">⌄</span></button>
<div class="gx-accordion__panel"><div class="gx-accordion__panel-inner">Always. Animations render a single static frame when the user prefers reduced motion.</div></div>
</div>
</div>
</div>
<div class="gx-card gx-card--spotlight">
<h3>Form controls</h3>
<div class="gx-stack">
<input class="gx-input" placeholder="your@email.com" />
<label class="gx-switch"><input type="checkbox" checked /><span class="gx-switch__track"></span><span class="gx-switch__thumb"></span></label>
<div class="gx-progress"><div class="gx-progress__bar" style="width:64%"></div></div>
</div>
</div>
<div class="gx-card gx-card--spotlight">
<h3>Badges & Avatars</h3>
<div class="gx-row gx-row--wrap">
<span class="gx-badge gx-badge--accent"><span class="gx-badge__dot"></span> New</span>
<span class="gx-badge gx-badge--success">Stable</span>
<span class="gx-badge gx-badge--warning">Beta</span>
</div>
<div class="gx-avatar-group" style="margin-top:14px">
<span class="gx-avatar gx-avatar--status">GX</span>
<span class="gx-avatar gx-avatar--status gx-avatar--busy" style="background:linear-gradient(135deg,#f472b6,#fbbf24)">AB</span>
<span class="gx-avatar gx-avatar--status gx-avatar--offline" style="background:linear-gradient(135deg,#34d399,#22d3ee)">CD</span>
</div>
</div>
<div class="gx-card gx-card--spotlight">
<h3>Alerts</h3>
<div class="gx-stack">
<div class="gx-alert gx-alert--success"><span class="gx-alert__icon">✓</span><div><p class="gx-alert__title">Launch ready</p><p class="gx-alert__body">All systems nominal.</p></div></div>
<div class="gx-alert gx-alert--danger"><span class="gx-alert__icon">⚠</span><div><p class="gx-alert__title">Hull breach</p><p class="gx-alert__body">Seal the airlock now.</p></div></div>
</div>
</div>
<div class="gx-card gx-card--spotlight">
<h3>Segmented & Drawer</h3>
<div class="gx-segmented" data-gx-segmented role="group">
<button class="gx-segmented__option" aria-checked="true">Day</button>
<button class="gx-segmented__option">Week</button>
<button class="gx-segmented__option">Month</button>
</div>
<div class="gx-row" style="margin-top:14px">
<button class="gx-btn gx-btn--ghost" id="drawerBtn">Open drawer</button>
<button class="gx-btn gx-btn--ghost" id="loadBtn">Loading…</button>
</div>
</div>
<div class="gx-card gx-card--spotlight">
<h3>Popover & Rating</h3>
<div class="gx-row gx-row--wrap" style="align-items:flex-start">
<span style="position:relative">
<button class="gx-btn gx-btn--ghost" data-gx-popover data-gx-popover-target="#pop1">Details ▾</button>
<div class="gx-popover" id="pop1"><strong>Orbit insertion</strong><p class="gx-soft" style="margin:6px 0 0;font-size:.85rem">Burn scheduled for T-minus 42s.</p></div>
</span>
<span class="gx-rating" data-gx-rating="5" data-gx-value="3"></span>
</div>
</div>
<div class="gx-card gx-card--spotlight">
<h3>Steps</h3>
<div class="gx-steps">
<div class="gx-step is-done"><div class="gx-step__dot">✓</div><div class="gx-step__label">Fuel</div></div>
<div class="gx-step is-done"><div class="gx-step__dot">✓</div><div class="gx-step__label">Ignite</div></div>
<div class="gx-step is-active"><div class="gx-step__dot">3</div><div class="gx-step__label">Launch</div></div>
<div class="gx-step"><div class="gx-step__dot">4</div><div class="gx-step__label">Orbit</div></div>
</div>
</div>
<div class="gx-card gx-card--spotlight">
<h3>Checkbox, Radio & Range</h3>
<div class="gx-stack">
<label class="gx-check"><input type="checkbox" checked /><span class="gx-check__box">✓</span> Enable thrusters</label>
<label class="gx-radio-c"><input type="radio" name="orbit" checked /><span class="gx-radio-c__box"></span> Low orbit</label>
<label class="gx-radio-c"><input type="radio" name="orbit" /><span class="gx-radio-c__box"></span> Geostationary</label>
<input class="gx-range" type="range" min="0" max="100" value="70" />
</div>
</div>
<div class="gx-card gx-card--spotlight">
<h3>Pagination & Chips</h3>
<div class="gx-pagination">
<button class="gx-page" disabled>‹</button>
<button class="gx-page is-active">1</button>
<button class="gx-page">2</button>
<button class="gx-page">3</button>
<button class="gx-page">›</button>
</div>
<div class="gx-row gx-row--wrap" style="margin-top:14px">
<span class="gx-chip">Mars <button class="gx-chip__close" aria-label="remove">✕</button></span>
<span class="gx-chip">Europa <button class="gx-chip__close" aria-label="remove">✕</button></span>
<span class="gx-chip">Titan <button class="gx-chip__close" aria-label="remove">✕</button></span>
</div>
</div>
<div class="gx-card gx-card--spotlight">
<h3>Ring progress & Copy</h3>
<div class="gx-row" style="gap:20px">
<div class="gx-ring" style="--gx-value:72"><span class="gx-ring__label">72%</span></div>
<div class="gx-stack">
<button class="gx-btn gx-btn--accent" data-gx-copy="npm install galaxyjs">Copy install</button>
<div><span class="gx-kbd">⌘</span> <span class="gx-kbd">K</span> to search</div>
</div>
</div>
</div>
<div class="gx-card gx-card--spotlight" style="grid-column: 1 / -1;">
<h3>Table</h3>
<table class="gx-table gx-table--striped">
<thead><tr><th>Body</th><th>Type</th><th>Distance (AU)</th></tr></thead>
<tbody>
<tr><td>Mercury</td><td>Terrestrial</td><td>0.39</td></tr>
<tr><td>Jupiter</td><td>Gas giant</td><td>5.20</td></tr>
<tr><td>Neptune</td><td>Ice giant</td><td>30.1</td></tr>
</tbody>
</table>
</div>
</div>
</section>
<template id="drawer-content">
<p class="gx-soft">This panel slid in from the side with one <code>Galaxy.drawer()</code> call. Press Esc or click the backdrop to dismiss.</p>
<label class="gx-check"><input type="checkbox" /><span class="gx-check__box">✓</span> Remember my choice</label>
</template>
<!-- GET STARTED -->
<section id="start" style="background: var(--gx-bg-soft);">
<div class="wrap">
<div class="section-head">
<span class="eyebrow">Get Started</span>
<h2>Use it your way</h2>
<p>Plain <code><script></code>, CDN, npm/ESM, zero-JS declarative — or let an AI agent wire it up for you. Same one-line API everywhere.</p>
</div>
<div class="comp-grid">
<div class="gx-card">
<div class="gx-row" style="justify-content:space-between"><h3 style="margin:0">Script tag</h3><span class="gx-badge">local files</span></div>
<pre class="code"><link rel="stylesheet" href="galaxy.css">
<script src="galaxy.js"></script>
<script>
Galaxy.<span class="k">create</span>(<span class="s">'nebula'</span>, <span class="s">'#hero'</span>)
</script></pre>
</div>
<div class="gx-card">
<div class="gx-row" style="justify-content:space-between"><h3 style="margin:0">CDN</h3><span class="gx-badge">no download</span></div>
<pre class="code"><link rel="stylesheet"
href="https://unpkg.com/galaxyjs@3/galaxy.css">
<script
src="https://unpkg.com/galaxyjs@3/galaxy.js"></script></pre>
</div>
<div class="gx-card">
<div class="gx-row" style="justify-content:space-between"><h3 style="margin:0">npm / ESM</h3><span class="gx-badge">bundlers</span></div>
<pre class="code"><span class="c">npm install galaxyjs</span>
<span class="k">import</span> Galaxy <span class="k">from</span> <span class="s">"galaxyjs"</span>;
<span class="k">import</span> <span class="s">"galaxyjs/galaxy.css"</span>;
Galaxy.<span class="k">create</span>(<span class="s">"nebula"</span>, <span class="s">"#hero"</span>);</pre>
</div>
<div class="gx-card">
<div class="gx-row" style="justify-content:space-between"><h3 style="margin:0">Declarative</h3><span class="gx-badge">zero JS</span></div>
<pre class="code"><span class="c"><!-- animation --></span>
<div data-galaxy=<span class="s">"warp"</span> data-galaxy-speed=<span class="s">"1.5"</span>></div>
<span class="c"><!-- components auto-wire too --></span>
<button data-gx-tooltip=<span class="s">"Hi!"</span>>Hover</button></pre>
</div>
</div>
<!-- AI / MCP -->
<div class="gx-card gx-card--glow" style="margin-top:22px; border-color: var(--gx-border-strong);">
<div class="gx-row" style="gap:10px; flex-wrap:wrap">
<span class="gx-badge gx-badge--accent"><span class="gx-badge__dot"></span> AI · MCP</span>
<h3 style="margin:0">Let an AI build it for you</h3>
</div>
<p class="gx-soft" style="margin:10px 0 0; max-width:760px;">
GalaxyJS ships a machine-readable <a href="galaxy.manifest.json" target="_blank" rel="noopener"><code>galaxy.manifest.json</code></a>,
an <a href="llms.txt" target="_blank" rel="noopener"><code>llms.txt</code></a> guide, and a
<a href="https://github.com/Edwson/GalaxyJS/tree/main/mcp" target="_blank" rel="noopener">Model Context Protocol server</a>.
Any AI agent can discover and use every animation & component in one line — at minimal token cost.
</p>
<div class="play" style="grid-template-columns: 1fr 1fr; margin-top:18px;">
<div>
<p class="gx-soft" style="margin:0 0 8px; font-size:.85rem">Add to your MCP client (e.g. Claude Desktop):</p>
<pre class="code">{
<span class="s">"mcpServers"</span>: {
<span class="s">"galaxyjs"</span>: {
<span class="s">"command"</span>: <span class="s">"npx"</span>,
<span class="s">"args"</span>: [<span class="s">"-y"</span>, <span class="s">"galaxyjs-mcp"</span>]
}
}
}</pre>
</div>
<div>
<p class="gx-soft" style="margin:0 0 8px; font-size:.85rem">Then just ask:</p>
<pre class="code"><span class="c">// you</span>
"Use GalaxyJS to add a slow
purple nebula to #hero"
<span class="c">// agent calls galaxy_snippet →</span>
Galaxy.<span class="k">create</span>(<span class="s">'nebula'</span>, <span class="s">'#hero'</span>, {
speed: <span class="n">0.6</span>,
colors: [<span class="s">'#7c5cff'</span>, <span class="s">'#4c1d95'</span>]
});</pre>
</div>
</div>
<div class="gx-row gx-row--wrap" style="margin-top:14px; gap:10px;">
<button class="gx-btn gx-btn--ghost gx-btn--sm" data-gx-copy='{ "mcpServers": { "galaxyjs": { "command": "npx", "args": ["-y", "galaxyjs-mcp"] } } }' data-gx-copy-msg="MCP config copied">Copy MCP config</button>
<a class="gx-btn gx-btn--subtle gx-btn--sm" href="docs/API.md" target="_blank" rel="noopener">API reference →</a>
</div>
</div>
</div>
</section>
<footer>
<div class="wrap">
<div class="gx-row" style="justify-content:center; gap:14px; flex-wrap:wrap; margin-bottom:18px;">
<a class="gx-btn gx-btn--ghost gx-btn--sm" href="https://github.com/Edwson/GalaxyJS" target="_blank" rel="noopener">★ GitHub</a>
<a class="gx-btn gx-btn--ghost gx-btn--sm" href="https://www.edwson.com" target="_blank" rel="noopener">🌐 edwson.com</a>
<a class="gx-btn gx-btn--ghost gx-btn--sm" href="https://www.linkedin.com/in/ed-chen-saas" target="_blank" rel="noopener">in LinkedIn</a>
</div>
<p><strong>GalaxyJS v3.4 "Optics"</strong> · MIT License · Zero required dependencies</p>
<p class="gx-muted" style="font-size:.92rem;">
Made by <a href="https://www.edwson.com" target="_blank" rel="noopener">Ed Chen</a>
·
<a href="https://www.linkedin.com/in/ed-chen-saas" target="_blank" rel="noopener">LinkedIn</a>
</p>
</div>
</footer>
<script src="galaxy.js?v=3.4.0"></script>
<!-- Self-host first (version-pinned so a new page never loads a stale cached engine). If the host blocks the file (mod_security 403) OR serves an out-of-date engine without the v3.4 API, fall back to the repo's jsDelivr CDN. Synchronous so Galaxy is defined before the boot script below. -->
<script>(window.Galaxy&&window.Galaxy.rendererOf)||document.write('<script src="https://cdn.jsdelivr.net/gh/Edwson/GalaxyJS@main/galaxy.min.js"><\/script>');</script>
<script>
// ---- Cinematic scroll hero · Galaxy.scrollScene() (v3.4.0) ----
// The hero IS the demo: scroll-bound scenes crossfade through the engine,
// and the page narrates the library as you go. One API call paints it.
var cineScenes = [
{ type: 'galaxyMerge',
eyebrow: 'Zero required dependencies · 86 animations · v3.4.0',
h1: 'The universe,\none line of code.',
lead: 'Cosmic canvas backdrops, a themeable UI kit, and one unified API: <code>Galaxy.create()</code>.' },
{ type: 'quasar',
eyebrow: 'The collection',
h1: '86 cosmic\nanimations.',
lead: 'Each is a canvas surface — auto-sized to its container, paused off-screen, drawn through one shared rAF loop.' },
{ type: 'supernova',
eyebrow: 'Accessible by contract',
h1: 'Beautiful,\nand behaved.',
lead: 'Reduced-motion safe, HiDPI-crisp, screen-reader-friendly. Motion off → every scene renders a single static frame.' },
{ type: 'eventHorizon',
eyebrow: 'New in v3.4.0 · Optics',
h1: 'Solved,\nnot painted.',
lead: 'Photons integrated through curved spacetime. Six new three.js scenes on an <b>optional</b> tier — loaded only if you mount one.' }
];
var elEye = document.getElementById('cineEyebrow'), elH1 = document.getElementById('cineH1'),
elLead = document.getElementById('cineLead'), telScene = document.getElementById('telScene'),
telIdx = document.getElementById('telIdx'), telPct = document.getElementById('telPct'),
telBars = document.getElementById('telBars'), scrubFill = document.getElementById('scrubFill'),
scrubMarks = document.getElementById('scrubMarks'), cineHint = document.getElementById('cineHint');
cineScenes.forEach(function (s) {
var b = document.createElement('div'); b.className = 'cine__tel-bar'; telBars.appendChild(b);
var m = document.createElement('span'); m.textContent = s.type; scrubMarks.appendChild(m);
});
var lastIdx = -1;
function setCopy(i) {
var s = cineScenes[i];
if (elEye) elEye.textContent = s.eyebrow;
if (elH1) elH1.textContent = s.h1;
if (elLead) elLead.innerHTML = s.lead;
if (telScene) telScene.textContent = s.type;
if (telIdx) telIdx.textContent = ('0' + (i + 1)).slice(-2) + ' / 0' + cineScenes.length;
[].forEach.call(telBars.children, function (b, j) { b.classList.toggle('on', j <= i); });
[].forEach.call(scrubMarks.children, function (m, j) { m.classList.toggle('on', j === i); });
}
setCopy(0);
// Graceful degradation: if an out-of-date cached engine lacks scrollScene,
// keep the hero alive with a static scene and never break the gallery below.
try {
if (typeof Galaxy.scrollScene !== 'function') throw new Error('scrollScene unavailable');
Galaxy.scrollScene('#cine-stage', {
scenes: cineScenes.map(function (s) { return { type: s.type }; }),
track: '#cine',
reducedScene: 0,
onProgress: function (p, i) {
if (scrubFill) scrubFill.style.width = (p * 100).toFixed(1) + '%';
if (telPct) telPct.textContent = Math.round(p * 100) + '%';
if (cineHint) cineHint.style.opacity = p > 0.02 ? '0' : '';
if (i !== lastIdx) { lastIdx = i; setCopy(i); }
}
});
} catch (e) {
Galaxy.create('galaxyMerge', '#cine-stage', { speed: 1 });
}
// ---- Animation gallery ----
var animals = [
['starfield','drifting stars'], ['warp','hyperspace'], ['blackHole','accretion disk'],
['nebula','gas clouds'], ['spiral','galaxy arms'], ['meteors','shooting stars'],
['constellation','network'], ['particles','interactive'], ['aurora','light ribbons'],
['wormhole','tunnel'], ['orbits','planets'], ['pulsar','neutron star'], ['gradient','mesh flow'],
['fireflies','wandering glow'], ['matrix','digital rain'], ['plasma','color field'],
['fireworks','bursts'], ['snow','snowfall'], ['waves','ocean'],
['dna','double helix'], ['lightning','bolts'], ['ripples','rings'], ['comets','tails'],
['confetti','celebration'], ['bubbles','rising'], ['fog','drifting mist'],
['grid','synthwave'], ['rain','rainfall'], ['vortex','spiral core'],
['sparkle','glints'], ['tunnel','neon tunnel'], ['swarm','flocking'], ['ribbons','silk'],
['flowfield','flow field'], ['globe','dotted globe'], ['heartbeat','ECG monitor'],
['equalizer','audio bars'], ['clock','analog clock'], ['rays','light rays'],
['radar','radar sweep'], ['embers','fire embers'], ['typewriter','typing'], ['spirograph','curves'],
['supernova','shockwave'], ['quasar','relativistic jets'], ['starcluster','3D cluster'],
['cosmicWeb','filaments'], ['eclipse','corona ring'], ['corona','roiling star'],
['galaxyMerge','tidal streams'], ['lattice','crystal'], ['moire','shimmer'],
['starburst','lens flare'], ['pillars','gas columns'], ['ionstorm','plasma arcs'],
['stardust','parallax dust'], ['orrery','armillary'], ['oscilloscope','Lissajous'],
['bokeh','depth of field'], ['magnetosphere','field lines'],
// v3.3 "Deep Field" — relativistic & gravitational
['lensing','Einstein ring'], ['accretionDisk','Doppler beaming'], ['nBody','n-body gravity'],
['tidalStream','tidal tails'], ['inspiral','gravitational waves'],
// v3.3 — volumetric & raymarched (WebGL2)
['volumetricNebula','raymarched gas'], ['starSurface','photosphere'], ['atmosphere','limb scattering'],
['dustLanes','self-shadowed dust'], ['protoplanetary','planet-carved gaps'],
// v3.3 — instruments
['spectrograph','absorption lines'], ['transitCurve','transit photometry'], ['waterfall','radio spectrogram'],
['hrDiagram','H-R diagram'], ['pulsarTiming','folded profile'],
// v3.3 — pointer-driven & generative
['gravityWell','drag a mass'], ['nebulaPaint','paint a nebula'], ['solarWind','bow shock'],
['starForge','seed systems'], ['relativisticJets','spin-axis jets'],
// v3.4 "Optics" — the optional three.js tier (loaded on demand)
['eventHorizon','curved-spacetime raytrace'], ['molecularCloud','3D volume + protostar'],
['spiralForge','340k instanced stars'], ['ringedWorld','mutual ring shadows'],
['gravitySim','GPGPU n-body'], ['starGlare','HDR bloom chain']
];
// Derive the headline count from the runtime — this heading read "60" for the
// whole of v3.3 because it was hand-maintained.
var animCountEl = document.getElementById('animCount');
if (animCountEl && window.Galaxy) animCountEl.textContent = Galaxy.list().length;
var gallery = document.getElementById('gallery');
animals.forEach(function (a) {
var card = document.createElement('div');
card.className = 'gx-card demo-card gx-card--interactive';
card.innerHTML = '<div class="surface" id="g-' + a[0] + '"></div><div class="meta"><h3>' + a[0] + '</h3><span>' + a[1] + '</span></div>';
gallery.appendChild(card);
Galaxy.create(a[0], '#g-' + a[0], {});
card.addEventListener('click', function () { loadAnim(a[0]); document.getElementById('playground').scrollIntoView({ behavior: 'smooth' }); });
});
// ---- Playground ----
var stage = null, current = 'nebula';
var palettes = [
['#7c5cff','#22d3ee','#f472b6'],
['#34d399','#22d3ee','#a3e635'],
['#fb7185','#f472b6','#fbbf24'],
['#ffffff','#9bd0ff','#c9b8ff'],
['#f59e0b','#ef4444','#7c5cff']
];
var activePalette = 0;
var sel = document.getElementById('animSel');
animals.forEach(function (a) { var o = document.createElement('option'); o.value = a[0]; o.textContent = a[0]; sel.appendChild(o); });
sel.value = current;
var swWrap = document.getElementById('swatches');
palettes.forEach(function (p, i) {
var s = document.createElement('div');
s.className = 'sw' + (i === 0 ? ' active' : '');
s.style.background = 'linear-gradient(135deg,' + p[0] + ',' + p[1] + ')';
s.addEventListener('click', function () {
activePalette = i;
[].forEach.call(swWrap.children, function (c) { c.classList.remove('active'); });
s.classList.add('active'); rebuild();
});
swWrap.appendChild(s);
});
function opts() {
var speed = parseFloat(document.getElementById('speed').value);
var dens = parseFloat(document.getElementById('density').value);
var d = Galaxy.defaults(current) || {};
var o = { speed: speed, colors: palettes[activePalette] };
// scale whatever density-like key the animation has
['count','stars','particles','bodies','rings','points','layers','lines'].forEach(function (k) {
if (d[k] != null) o[k] = Math.round(d[k] * dens);
});
return o;
}
function rebuild() {
if (stage) stage.destroy();
stage = Galaxy.create(current, '#play-stage', opts());
renderCode();
}
function loadAnim(name) { current = name; sel.value = name; rebuild(); }
function renderCode() {
var o = opts();
var lines = ["Galaxy.<span class='k'>create</span>(<span class='s'>'" + current + "'</span>, <span class='s'>'#stage'</span>, {"];
lines.push(" speed: <span class='n'>" + o.speed + "</span>,");
['count','stars','particles','bodies','rings','points','layers','lines'].forEach(function (k) {
if (o[k] != null) lines.push(" " + k + ": <span class='n'>" + o[k] + "</span>,");
});
lines.push(" colors: [" + o.colors.map(function (c) { return "<span class='s'>'" + c + "'</span>"; }).join(', ') + "]");
lines.push("});");
document.getElementById('codeOut').innerHTML = lines.join('\n');
}
document.getElementById('speed').addEventListener('input', function (e) { document.getElementById('speedVal').textContent = parseFloat(e.target.value).toFixed(1); rebuild(); });
document.getElementById('density').addEventListener('input', function (e) { document.getElementById('densVal').textContent = parseFloat(e.target.value).toFixed(1); rebuild(); });
sel.addEventListener('change', function (e) { loadAnim(e.target.value); });
document.getElementById('copyBtn').addEventListener('click', function () {
var txt = document.getElementById('codeOut').textContent;
navigator.clipboard && navigator.clipboard.writeText(txt);
Galaxy.toast('Code copied to clipboard', { type: 'success' });
});
rebuild();
// ---- Component demos ----
document.getElementById('modalBtn').addEventListener('click', function () {
Galaxy.modal({
title: 'Welcome aboard 🚀',
body: 'This modal was created with a single <code>Galaxy.modal()</code> call. Press Esc or click outside to close.',
actions: [
{ label: 'Maybe later', variant: 'ghost' },
{ label: 'Launch', variant: 'primary', onClick: function () { Galaxy.toast('Liftoff!', { type: 'success' }); } }
]
});
});
document.getElementById('confirmBtn').addEventListener('click', function () {
Galaxy.confirm('Eject the escape pod?', { okLabel: 'Eject', cancelLabel: 'Stay' }).then(function (ok) {
Galaxy.toast(ok ? 'Pod ejected 🛸' : 'Staying put', { type: ok ? 'info' : 'warning' });
});
});
document.getElementById('drawerBtn').addEventListener('click', function () {
Galaxy.drawer({ title: 'Mission control', side: 'right', html: document.getElementById('drawer-content').innerHTML,
actions: [{ label: 'Done', variant: 'primary' }] });
});
document.getElementById('loadBtn').addEventListener('click', function () {
var b = this; b.classList.add('is-loading');
setTimeout(function () { b.classList.remove('is-loading'); Galaxy.toast('Docking complete', { type: 'success' }); }, 1600);
});
// ---- Theme toggle ----
document.getElementById('themeBtn').addEventListener('click', function (e) {
e.preventDefault();
var t = Galaxy.toggleTheme();
this.innerHTML = (t === 'dark' ? '☾' : '☀') + ' Theme';
});
</script>
</body>
</html>