@idle-screens/savers-classic 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,367 @@
1
+ // src/dvd.ts
2
+ import {
3
+ sampleTrack,
4
+ defaultParams
5
+ } from "@idle-screens/core";
6
+ var MARKS = ["dvd", "idle-screens", "diamond", "ring"];
7
+ var PARAM_SPACE = {
8
+ /** Which shape bounces. 'dvd' = the classic wordmark-in-a-pill. */
9
+ mark: { type: "enum", default: "dvd", options: [...MARKS] },
10
+ /** Multiplies both axis speeds (and therefore the wall-hit rate). */
11
+ speed: { type: "number", default: 1, min: 0.25, max: 3, ease: "smooth" },
12
+ /** Multiplies the mark's box size. */
13
+ scale: { type: "number", default: 1, min: 0.5, max: 2, ease: "smooth" },
14
+ /** Base hue (0-360); each wall hit steps it deterministically from here. */
15
+ hue: { type: "number", default: 110, min: 0, max: 360, ease: "smooth" },
16
+ /** Phosphor glow around the mark. */
17
+ glow: { type: "number", default: 0.25, min: 0, max: 1, ease: "smooth" },
18
+ /** Burst intensity when both axes hit a wall at once (a corner hit). */
19
+ cornerParty: { type: "number", default: 0.6, min: 0, max: 1, ease: "smooth" }
20
+ };
21
+ var dvdManifest = {
22
+ id: "dvd",
23
+ label: "Bouncing Logo",
24
+ passthrough: false,
25
+ minBackend: "canvas2d",
26
+ costTier: "low",
27
+ motionIntensity: "calm",
28
+ reducedMotionFallback: "static",
29
+ paramSpace: PARAM_SPACE,
30
+ a11y: {
31
+ flashSafe: true,
32
+ notes: "Hue steps once per wall hit and a brief corner burst on exact corner hits; no strobing."
33
+ },
34
+ attribution: {
35
+ source: "DVD player idle screen + After Dark logo bounce \u2014 concepts. The DVD-Video logo is a trademark of DVD FLLC",
36
+ license: "MIT, original implementation; logo drawn from scratch as nostalgic homage (the bouncing-DVD meme) \u2014 no third-party assets"
37
+ },
38
+ workerReady: true
39
+ };
40
+ var BASE_SPEED_X = 144;
41
+ var BASE_SPEED_Y = 120;
42
+ var BASE_MARK_W = 200;
43
+ var BASE_MARK_H = 84;
44
+ var HUE_STEP_DEG = 47;
45
+ var CORNER_BURST_MS = 220;
46
+ var clamp = (v, lo, hi) => Math.max(lo, Math.min(hi, v));
47
+ function tri(t, p) {
48
+ const cycle = p * 2;
49
+ const k = (t % cycle + cycle) % cycle;
50
+ return k < p ? k / p : 2 - k / p;
51
+ }
52
+ function hitCount(t, p) {
53
+ return Math.floor(Math.max(0, t) / p);
54
+ }
55
+ function distToNearestHit(t, p) {
56
+ const r = (t % p + p) % p;
57
+ return Math.min(r, p - r);
58
+ }
59
+ var DvdInstance = class {
60
+ ctxSaver;
61
+ canvas;
62
+ c2d;
63
+ w = 0;
64
+ h = 0;
65
+ frameId = null;
66
+ paused = false;
67
+ startT = 0;
68
+ /** Logical time the next rAF origin resumes from.
69
+ *
70
+ * `start()` re-anchors `startT` to the next frame's timestamp, so on its own
71
+ * `now - startT` always begins at zero. Mount wants that; resuming from a
72
+ * pause does not — without carrying the frozen `t` forward, every
73
+ * pause/resume (and every reduced-motion toggle) snaps the scene back to its
74
+ * opening frame and restarts any applied control track. Set only in
75
+ * `setPaused(false)`, so first mount still starts at 0. */
76
+ resumeFrom = 0;
77
+ t = 0;
78
+ params = defaultParams(PARAM_SPACE);
79
+ track = null;
80
+ constructor(ctx) {
81
+ this.ctxSaver = ctx;
82
+ if (ctx.surface) {
83
+ this.canvas = ctx.surface;
84
+ } else {
85
+ const el = document.createElement("canvas");
86
+ el.style.cssText = "display:block;width:100%;height:100%;background:#04050a";
87
+ ctx.host.appendChild(el);
88
+ this.canvas = el;
89
+ }
90
+ const c2d = this.canvas.getContext("2d", { alpha: false });
91
+ if (!c2d) throw new Error("dvd: no 2d context");
92
+ this.c2d = c2d;
93
+ this.w = ctx.width;
94
+ this.h = ctx.height;
95
+ this.sizeCanvas();
96
+ this.paused = ctx.reducedMotion;
97
+ if (this.paused) this.renderStill();
98
+ else this.start();
99
+ }
100
+ // ---- params ----
101
+ applyParams(t) {
102
+ const p = this.track ? sampleTrack(PARAM_SPACE, this.track, t) : this.params;
103
+ for (const k of Object.keys(PARAM_SPACE)) {
104
+ const v = p[k];
105
+ if (v !== void 0) this.params[k] = v;
106
+ }
107
+ }
108
+ sizeCanvas() {
109
+ const dpr = Math.min(this.ctxSaver.dpr, 2);
110
+ this.canvas.width = Math.max(1, Math.round(this.w * dpr));
111
+ this.canvas.height = Math.max(1, Math.round(this.h * dpr));
112
+ this.c2d.setTransform(dpr, 0, 0, dpr, 0, 0);
113
+ }
114
+ // ---- closed-form geometry ----
115
+ markSize() {
116
+ const s = this.params.scale;
117
+ return {
118
+ markW: clamp(BASE_MARK_W * s, 60, this.w * 0.7),
119
+ markH: clamp(BASE_MARK_H * s, 26, this.h * 0.7)
120
+ };
121
+ }
122
+ /** One-way traversal periods (ms) for each axis at the current box size
123
+ * and speed. Pure function of (w, h, markW, markH, speed). */
124
+ periods(markW, markH) {
125
+ const distX = Math.max(1, this.w - markW);
126
+ const distY = Math.max(1, this.h - markH);
127
+ const speedX = BASE_SPEED_X * Math.max(0.05, this.params.speed);
128
+ const speedY = BASE_SPEED_Y * Math.max(0.05, this.params.speed);
129
+ return { px: distX / speedX * 1e3, py: distY / speedY * 1e3 };
130
+ }
131
+ // ---- loop ----
132
+ start() {
133
+ if (this.frameId !== null || typeof requestAnimationFrame === "undefined") return;
134
+ this.startT = 0;
135
+ this.frameId = requestAnimationFrame((now) => this.loop(now));
136
+ }
137
+ stop() {
138
+ if (this.frameId !== null) {
139
+ cancelAnimationFrame(this.frameId);
140
+ this.frameId = null;
141
+ }
142
+ }
143
+ loop(now) {
144
+ this.frameId = requestAnimationFrame((n) => this.loop(n));
145
+ if (this.startT === 0) this.startT = now;
146
+ this.renderFrame(now - this.startT + this.resumeFrom, this.ctxSaver.seed);
147
+ }
148
+ renderStill() {
149
+ this.renderFrame(this.t, this.ctxSaver.seed);
150
+ }
151
+ // ---- draw ----
152
+ /** Rounded-rect path built from `arc` + `lineTo` only (no `quadraticCurveTo`/
153
+ * `roundRect`, to stay inside the minimal Canvas2D surface classic savers
154
+ * rely on). */
155
+ roundRectPath(c, x, y, w, h, r) {
156
+ const rr = Math.max(0, Math.min(r, w / 2, h / 2));
157
+ c.beginPath();
158
+ c.moveTo(x + rr, y);
159
+ c.lineTo(x + w - rr, y);
160
+ c.arc(x + w - rr, y + rr, rr, -Math.PI / 2, 0);
161
+ c.lineTo(x + w, y + h - rr);
162
+ c.arc(x + w - rr, y + h - rr, rr, 0, Math.PI / 2);
163
+ c.lineTo(x + rr, y + h);
164
+ c.arc(x + rr, y + h - rr, rr, Math.PI / 2, Math.PI);
165
+ c.lineTo(x, y + rr);
166
+ c.arc(x + rr, y + rr, rr, Math.PI, Math.PI * 1.5);
167
+ c.closePath();
168
+ }
169
+ /** The classic mark, as the meme remembers it: heavy italic "DVD" letters
170
+ * over the wide disc ellipse with its centre hole. Drawn entirely from
171
+ * text + ellipse paths — no imported asset. The DVD-Video logo shape is a
172
+ * trademark of the DVD Format/Logo Licensing Corp; it appears here as the
173
+ * nostalgic bouncing-logo homage (see CREDITS.md). */
174
+ drawDvd(c, x, y, w, h, color) {
175
+ c.save();
176
+ c.fillStyle = color;
177
+ c.font = `italic 900 ${Math.round(h * 0.66)}px "Arial Black", Arial, sans-serif`;
178
+ c.textAlign = "center";
179
+ c.textBaseline = "middle";
180
+ c.fillText("DVD", x + w / 2, y + h * 0.32);
181
+ c.restore();
182
+ const cx = x + w / 2;
183
+ const cy = y + h * 0.8;
184
+ c.fillStyle = color;
185
+ c.beginPath();
186
+ c.ellipse(cx, cy, w * 0.5, h * 0.155, 0, 0, Math.PI * 2);
187
+ c.fill();
188
+ c.fillStyle = "#04050a";
189
+ c.beginPath();
190
+ c.ellipse(cx, cy, w * 0.115, h * 0.052, 0, 0, Math.PI * 2);
191
+ c.fill();
192
+ }
193
+ drawWordmark(c, x, y, w, h, color) {
194
+ c.fillStyle = color;
195
+ c.textAlign = "center";
196
+ c.textBaseline = "middle";
197
+ c.font = `700 ${Math.round(h * 0.32)}px ui-rounded, "Avenir Next", system-ui, sans-serif`;
198
+ c.fillText("idle-screens", x + w / 2, y + h / 2);
199
+ }
200
+ drawDiamond(c, x, y, w, h, color) {
201
+ const cx = x + w / 2;
202
+ const cy = y + h / 2;
203
+ const s = Math.min(w, h) * 0.62;
204
+ c.save();
205
+ c.translate(cx, cy);
206
+ c.rotate(Math.PI / 4);
207
+ c.fillStyle = color;
208
+ c.fillRect(-s / 2, -s / 2, s, s);
209
+ c.restore();
210
+ }
211
+ drawRing(c, x, y, w, h, color) {
212
+ const cx = x + w / 2;
213
+ const cy = y + h / 2;
214
+ const r = Math.min(w, h) * 0.4;
215
+ c.beginPath();
216
+ c.arc(cx, cy, r, 0, Math.PI * 2);
217
+ c.strokeStyle = color;
218
+ c.lineWidth = Math.max(4, r * 0.34);
219
+ c.stroke();
220
+ }
221
+ drawMark(mark, c, x, y, w, h, color) {
222
+ switch (mark) {
223
+ case "idle-screens":
224
+ this.drawWordmark(c, x, y, w, h, color);
225
+ break;
226
+ case "diamond":
227
+ this.drawDiamond(c, x, y, w, h, color);
228
+ break;
229
+ case "ring":
230
+ this.drawRing(c, x, y, w, h, color);
231
+ break;
232
+ case "dvd":
233
+ default:
234
+ this.drawDvd(c, x, y, w, h, color);
235
+ break;
236
+ }
237
+ }
238
+ /** A tiny sparkle burst — the "corner party" — purely a function of how
239
+ * close both axes are to hitting simultaneously right now. */
240
+ drawBurst(c, cx, cy, intensity, hue) {
241
+ const rays = 8;
242
+ const radius = 10 + 46 * intensity;
243
+ c.save();
244
+ c.globalCompositeOperation = "lighter";
245
+ for (let i = 0; i < rays; i++) {
246
+ const a = i / rays * Math.PI * 2;
247
+ c.strokeStyle = `hsla(${hue.toFixed(1)}, 92%, 72%, ${(0.85 * intensity).toFixed(3)})`;
248
+ c.lineWidth = 1.5 + 3 * intensity;
249
+ c.beginPath();
250
+ c.moveTo(cx, cy);
251
+ c.lineTo(cx + Math.cos(a) * radius, cy + Math.sin(a) * radius);
252
+ c.stroke();
253
+ }
254
+ c.restore();
255
+ }
256
+ /** Pure render at logical time `t` for `seed`: everything below is a closed
257
+ * -form function of (t, seed, this.w, this.h, this.params) — nothing is
258
+ * read from or written to accumulated instance state. */
259
+ render(t, seed) {
260
+ const c = this.c2d;
261
+ c.fillStyle = "#04050a";
262
+ c.fillRect(0, 0, this.w, this.h);
263
+ const { markW, markH } = this.markSize();
264
+ const { px, py } = this.periods(markW, markH);
265
+ const shifted = t + Math.abs(seed) * 233 % 5e3;
266
+ const x = tri(shifted, px) * Math.max(0, this.w - markW);
267
+ const y = tri(shifted, py) * Math.max(0, this.h - markH);
268
+ const hits = hitCount(shifted, px) + hitCount(shifted, py);
269
+ const hue = ((this.params.hue + hits * HUE_STEP_DEG) % 360 + 360) % 360;
270
+ const color = `hsl(${hue.toFixed(1)}, 78%, 56%)`;
271
+ if (this.params.glow > 0.02) {
272
+ c.shadowColor = color;
273
+ c.shadowBlur = 26 * this.params.glow;
274
+ } else {
275
+ c.shadowBlur = 0;
276
+ }
277
+ this.drawMark(this.params.mark, c, x, y, markW, markH, color);
278
+ c.shadowBlur = 0;
279
+ const ax = Math.max(0, 1 - distToNearestHit(shifted, px) / CORNER_BURST_MS);
280
+ const ay = Math.max(0, 1 - distToNearestHit(shifted, py) / CORNER_BURST_MS);
281
+ const cornerIntensity = this.params.cornerParty * ax * ax * ay * ay;
282
+ if (cornerIntensity > 2e-3) {
283
+ this.drawBurst(c, x + markW / 2, y + markH / 2, cornerIntensity, hue);
284
+ }
285
+ }
286
+ // ---- SaverInstance ----
287
+ setPaused(paused) {
288
+ this.paused = paused;
289
+ if (paused) {
290
+ this.stop();
291
+ this.renderStill();
292
+ } else {
293
+ this.resumeFrom = this.t;
294
+ this.start();
295
+ }
296
+ }
297
+ resize(width, height, dpr) {
298
+ this.w = width;
299
+ this.h = height;
300
+ if (dpr !== void 0) this.ctxSaver.dpr = dpr;
301
+ this.sizeCanvas();
302
+ if (this.paused) this.renderStill();
303
+ }
304
+ applyTrack(track) {
305
+ this.track = track;
306
+ if (this.paused) this.renderStill();
307
+ }
308
+ /** Pure, frame-addressable render: draw the state at logical time `t` for `seed`. */
309
+ renderFrame(t, seed) {
310
+ this.t = t;
311
+ this.applyParams(t);
312
+ this.render(t, seed);
313
+ }
314
+ dispose() {
315
+ this.stop();
316
+ if (typeof HTMLCanvasElement !== "undefined" && this.canvas instanceof HTMLCanvasElement) {
317
+ this.canvas.remove();
318
+ }
319
+ }
320
+ };
321
+ var dvd = {
322
+ manifest: dvdManifest,
323
+ mount: (ctx) => new DvdInstance(ctx)
324
+ };
325
+ var dvdDemoTrack = {
326
+ program: "dvd",
327
+ seed: 7,
328
+ duration: 16e3,
329
+ loop: true,
330
+ deltas: [
331
+ // The DVD logo IS the act; the other marks get a quick tour at the end.
332
+ { t: 0, path: "mark", value: "dvd" },
333
+ { t: 1e4, path: "mark", value: "diamond" },
334
+ { t: 12e3, path: "mark", value: "ring" },
335
+ { t: 14e3, path: "mark", value: "idle-screens" },
336
+ { t: 0, path: "hue", value: 110 },
337
+ { t: 8e3, path: "hue", value: 280, ease: "smooth" },
338
+ { t: 16e3, path: "hue", value: 110, ease: "smooth" },
339
+ { t: 0, path: "speed", value: 0.8 },
340
+ { t: 8e3, path: "speed", value: 1.7, ease: "smooth" },
341
+ { t: 16e3, path: "speed", value: 0.8, ease: "smooth" }
342
+ ]
343
+ };
344
+
1
345
  // src/warp.ts
346
+ import {
347
+ sampleTrack as sampleTrack2,
348
+ defaultParams as defaultParams2
349
+ } from "@idle-screens/core";
350
+ var PARAM_SPACE2 = {
351
+ /** Star count basis. Read only at build time — rebuilding the field live
352
+ * would reshuffle star identity and break renderFrame purity, so steer
353
+ * the other knobs to change the feel while live; density only takes
354
+ * effect on (re)mount. */
355
+ density: { type: "number", default: 520, min: 120, max: 1400 },
356
+ speed: { type: "number", default: 1, min: 0.25, max: 3, ease: "smooth" },
357
+ /** Star color. '#ffffff' is the classic white starfield. */
358
+ tint: { type: "color", default: "#ffffff" },
359
+ /** Elongation of the per-star motion streak. */
360
+ streak: { type: "number", default: 0.4, min: 0, max: 1, ease: "smooth" },
361
+ /** Subtle per-star brightness shimmer. No strobe: each star's shimmer
362
+ * period is fixed at build (800-1800ms), well under any flash threshold. */
363
+ twinkle: { type: "number", default: 0.3, min: 0, max: 1, ease: "smooth" }
364
+ };
2
365
  var warpManifest = {
3
366
  id: "warp",
4
367
  label: "Warp",
@@ -7,11 +370,31 @@ var warpManifest = {
7
370
  costTier: "low",
8
371
  motionIntensity: "energetic",
9
372
  reducedMotionFallback: "static",
10
- a11y: { flashSafe: true },
373
+ paramSpace: PARAM_SPACE2,
374
+ a11y: { flashSafe: true, notes: "Streaming star field; brightness shimmer is subtle and >=800ms per cycle." },
11
375
  workerReady: true
12
376
  };
13
- var STAR_COUNT = 520;
14
- var SPEED = 0.012;
377
+ var BASE_RATE = 727e-6;
378
+ var frac = (x) => x - Math.floor(x);
379
+ function smoothstep01(x) {
380
+ const c = Math.max(0, Math.min(1, x));
381
+ return c * c * (3 - 2 * c);
382
+ }
383
+ var FADE_IN_END = 0.15;
384
+ var FADE_OUT_START = 0.94;
385
+ function fadeEnvelope(p) {
386
+ let e = 1;
387
+ if (p < FADE_IN_END) e *= smoothstep01(p / FADE_IN_END);
388
+ if (p > FADE_OUT_START) e *= smoothstep01((1 - p) / (1 - FADE_OUT_START));
389
+ return e;
390
+ }
391
+ function hexToRgb(hex) {
392
+ const m = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(hex.trim());
393
+ if (!m) return [255, 255, 255];
394
+ const h = m[1].length === 3 ? m[1].split("").map((c) => c + c).join("") : m[1];
395
+ const n = parseInt(h, 16);
396
+ return [n >> 16 & 255, n >> 8 & 255, n & 255];
397
+ }
15
398
  var WarpInstance = class {
16
399
  ctxSaver;
17
400
  canvas;
@@ -21,6 +404,19 @@ var WarpInstance = class {
21
404
  stars = [];
22
405
  frameId = null;
23
406
  paused = false;
407
+ startT = 0;
408
+ /** Logical time the next rAF origin resumes from.
409
+ *
410
+ * `start()` re-anchors `startT` to the next frame's timestamp, so on its own
411
+ * `now - startT` always begins at zero. Mount wants that; resuming from a
412
+ * pause does not — without carrying the frozen `t` forward, every
413
+ * pause/resume (and every reduced-motion toggle) snaps the scene back to its
414
+ * opening frame and restarts any applied control track. Set only in
415
+ * `setPaused(false)`, so first mount still starts at 0. */
416
+ resumeFrom = 0;
417
+ t = 0;
418
+ params = defaultParams2(PARAM_SPACE2);
419
+ track = null;
24
420
  constructor(ctx) {
25
421
  this.ctxSaver = ctx;
26
422
  let canvas;
@@ -45,31 +441,43 @@ var WarpInstance = class {
45
441
  if (this.paused) this.renderStill();
46
442
  else this.start();
47
443
  }
444
+ // ---- params ----
445
+ applyParams(t) {
446
+ const p = this.track ? sampleTrack2(PARAM_SPACE2, this.track, t) : this.params;
447
+ for (const k of Object.keys(PARAM_SPACE2)) {
448
+ const v = p[k];
449
+ if (v !== void 0) this.params[k] = v;
450
+ }
451
+ }
48
452
  sizeCanvas() {
49
453
  const dpr = Math.min(this.ctxSaver.dpr, 2);
50
454
  this.canvas.width = Math.max(1, Math.round(this.w * dpr));
51
455
  this.canvas.height = Math.max(1, Math.round(this.h * dpr));
52
456
  this.ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
53
457
  }
458
+ /** Build the star field's fixed identity from forked streams. Deterministic
459
+ * regardless of how much of `ctx.rng` other code has consumed, and safe
460
+ * to call again (e.g. a future density change on remount) without
461
+ * reshuffling existing star identities. */
54
462
  buildStars() {
55
- const rng = this.ctxSaver.rng;
56
- this.stars = new Array(STAR_COUNT);
57
- for (let i = 0; i < STAR_COUNT; i++) {
58
- this.stars[i] = this.spawn(rng.range(0.01, 1));
463
+ const count = Math.max(1, Math.round(this.params.density));
464
+ this.stars = new Array(count);
465
+ for (let i = 0; i < count; i++) {
466
+ const r = this.ctxSaver.rng.fork(i);
467
+ this.stars[i] = {
468
+ x: r.range(-1, 1),
469
+ y: r.range(-1, 1),
470
+ phase: r.next(),
471
+ twinklePhase: r.range(0, Math.PI * 2),
472
+ twinklePeriod: r.range(800, 1800)
473
+ };
59
474
  }
60
475
  }
61
- spawn(z) {
62
- const rng = this.ctxSaver.rng;
63
- return {
64
- x: rng.range(-1, 1),
65
- y: rng.range(-1, 1),
66
- z,
67
- pz: z
68
- };
69
- }
476
+ // ---- loop ----
70
477
  start() {
71
478
  if (this.frameId !== null || typeof requestAnimationFrame === "undefined") return;
72
- this.loop();
479
+ this.startT = 0;
480
+ this.frameId = requestAnimationFrame((now) => this.loop(now));
73
481
  }
74
482
  stop() {
75
483
  if (this.frameId !== null) {
@@ -77,44 +485,54 @@ var WarpInstance = class {
77
485
  this.frameId = null;
78
486
  }
79
487
  }
80
- loop() {
81
- this.frameId = requestAnimationFrame(() => this.loop());
82
- this.step();
83
- this.render();
488
+ loop(now) {
489
+ this.frameId = requestAnimationFrame((n) => this.loop(n));
490
+ if (this.startT === 0) this.startT = now;
491
+ this.renderFrame(now - this.startT + this.resumeFrom, this.ctxSaver.seed);
84
492
  }
85
- step() {
86
- for (const s of this.stars) {
87
- s.pz = s.z;
88
- s.z -= SPEED;
89
- if (s.z <= 0.01) {
90
- const respawned = this.spawn(1);
91
- s.x = respawned.x;
92
- s.y = respawned.y;
93
- s.z = 1;
94
- s.pz = 1;
95
- }
96
- }
493
+ renderStill() {
494
+ this.renderFrame(this.t, this.ctxSaver.seed);
97
495
  }
98
- render() {
496
+ // ---- closed-form travel + draw ----
497
+ /** A star's travel progress at time `t`: 0 = just spawned (near center,
498
+ * dim), approaches 1 as it nears the eye and is about to recycle. Pure
499
+ * function of `t` and the star's fixed phase — no accumulation. */
500
+ progress(star, t, rate) {
501
+ return frac(star.phase + t * rate);
502
+ }
503
+ render(t) {
99
504
  const ctx = this.ctx;
100
505
  const w = this.w;
101
506
  const h = this.h;
102
507
  const cx = w / 2;
103
508
  const cy = h / 2;
104
509
  const focal = Math.min(w, h) * 0.9;
510
+ const p = this.params;
511
+ const rate = BASE_RATE * p.speed;
512
+ const [tr, tg, tb] = hexToRgb(p.tint);
513
+ const streakDt = 16 * (1 + p.streak * 5);
105
514
  ctx.fillStyle = "rgba(17,17,17,0.45)";
106
515
  ctx.fillRect(0, 0, w, h);
107
516
  ctx.lineCap = "round";
108
517
  for (const s of this.stars) {
109
- const sx = cx + s.x / s.z * focal;
110
- const sy = cy + s.y / s.z * focal;
111
- const px = cx + s.x / s.pz * focal;
112
- const py = cy + s.y / s.pz * focal;
113
- if (sx < -50 || sx > w + 50 || sy < -50 || sy > h + 50) continue;
114
- const depth = 1 - s.z;
115
- const alpha = Math.min(1, 0.15 + depth * 1.1);
116
- const size = Math.max(0.4, depth * 2.6);
117
- ctx.strokeStyle = `rgba(220,235,255,${alpha.toFixed(3)})`;
518
+ const prog = this.progress(s, t, rate);
519
+ const z = 1 - prog * 0.99;
520
+ const sx = cx + s.x / z * focal;
521
+ const sy = cy + s.y / z * focal;
522
+ let progPrev = this.progress(s, t - streakDt, rate);
523
+ if (progPrev > prog) progPrev = prog;
524
+ const zPrev = 1 - progPrev * 0.99;
525
+ const px = cx + s.x / zPrev * focal;
526
+ const py = cy + s.y / zPrev * focal;
527
+ const headOut = sx < -50 || sx > w + 50 || sy < -50 || sy > h + 50;
528
+ const tailOut = px < -50 || px > w + 50 || py < -50 || py > h + 50;
529
+ if (headOut && tailOut) continue;
530
+ const envelope = fadeEnvelope(prog);
531
+ const shimmer = 1 + p.twinkle * 0.4 * Math.sin(2 * Math.PI * t / s.twinklePeriod + s.twinklePhase);
532
+ const alpha = Math.max(0, Math.min(1, (0.15 + prog * 1.1) * envelope * shimmer));
533
+ if (alpha <= 2e-3) continue;
534
+ const size = Math.max(0.4, prog * 2.6);
535
+ ctx.strokeStyle = `rgba(${tr},${tg},${tb},${alpha.toFixed(3)})`;
118
536
  ctx.lineWidth = size;
119
537
  ctx.beginPath();
120
538
  ctx.moveTo(px, py);
@@ -122,32 +540,14 @@ var WarpInstance = class {
122
540
  ctx.stroke();
123
541
  }
124
542
  }
125
- renderStill() {
126
- const ctx = this.ctx;
127
- ctx.fillStyle = "#111";
128
- ctx.fillRect(0, 0, this.w, this.h);
129
- const cx = this.w / 2;
130
- const cy = this.h / 2;
131
- const focal = Math.min(this.w, this.h) * 0.9;
132
- for (const s of this.stars) {
133
- const sx = cx + s.x / s.z * focal;
134
- const sy = cy + s.y / s.z * focal;
135
- if (sx < 0 || sx > this.w || sy < 0 || sy > this.h) continue;
136
- const depth = 1 - s.z;
137
- const alpha = Math.min(1, 0.15 + depth * 1.1);
138
- const size = Math.max(0.4, depth * 2.6);
139
- ctx.fillStyle = `rgba(220,235,255,${alpha.toFixed(3)})`;
140
- ctx.beginPath();
141
- ctx.arc(sx, sy, size, 0, Math.PI * 2);
142
- ctx.fill();
143
- }
144
- }
543
+ // ---- SaverInstance ----
145
544
  setPaused(paused) {
146
545
  this.paused = paused;
147
546
  if (paused) {
148
547
  this.stop();
149
548
  this.renderStill();
150
549
  } else {
550
+ this.resumeFrom = this.t;
151
551
  this.start();
152
552
  }
153
553
  }
@@ -158,6 +558,18 @@ var WarpInstance = class {
158
558
  this.sizeCanvas();
159
559
  if (this.paused) this.renderStill();
160
560
  }
561
+ applyTrack(track) {
562
+ this.track = track;
563
+ if (this.paused) this.renderStill();
564
+ }
565
+ /** Pure, frame-addressable render: draw the state at logical time `t` for
566
+ * `seed`. Identical (t, seed, applied track) always produces the same
567
+ * frame — safe to seek forward or backward. */
568
+ renderFrame(t, _seed) {
569
+ this.t = t;
570
+ this.applyParams(t);
571
+ this.render(t);
572
+ }
161
573
  dispose() {
162
574
  this.stop();
163
575
  if (typeof HTMLCanvasElement !== "undefined" && this.canvas instanceof HTMLCanvasElement) this.canvas.remove();
@@ -167,6 +579,25 @@ var warp = {
167
579
  manifest: warpManifest,
168
580
  mount: (ctx) => new WarpInstance(ctx)
169
581
  };
582
+ var warpDemoTrack = {
583
+ program: "warp",
584
+ seed: 7,
585
+ duration: 14e3,
586
+ loop: true,
587
+ deltas: [
588
+ { t: 0, path: "speed", value: 0.6 },
589
+ { t: 5e3, path: "speed", value: 2.4, ease: "smooth" },
590
+ { t: 9e3, path: "speed", value: 0.6, ease: "smooth" },
591
+ { t: 14e3, path: "speed", value: 0.6 },
592
+ { t: 0, path: "streak", value: 0.15 },
593
+ { t: 5e3, path: "streak", value: 0.9, ease: "smooth" },
594
+ { t: 9e3, path: "streak", value: 0.15, ease: "smooth" },
595
+ { t: 14e3, path: "streak", value: 0.15 },
596
+ { t: 0, path: "tint", value: "#ffffff" },
597
+ { t: 7e3, path: "tint", value: "#8fd8ff", ease: "smooth" },
598
+ { t: 14e3, path: "tint", value: "#ffffff", ease: "smooth" }
599
+ ]
600
+ };
170
601
 
171
602
  // src/hard-rain.ts
172
603
  var hardRainManifest = {
@@ -326,7 +757,7 @@ var DROP_SPECS = [
326
757
  "t1 p5-4 s250 yellow",
327
758
  "t24 p5-5 s200 ltgray"
328
759
  ];
329
- function hexToRgb(hex) {
760
+ function hexToRgb2(hex) {
330
761
  const n = parseInt(hex.slice(1), 16);
331
762
  return `${n >> 16 & 255},${n >> 8 & 255},${n & 255}`;
332
763
  }
@@ -373,7 +804,7 @@ var HardRainInstance = class {
373
804
  fx: pos[0],
374
805
  fy: pos[1],
375
806
  maxR: SIZES[sCls] ?? 100,
376
- rgb: hexToRgb(COLOURS[cCls] ?? "#c2c2c2"),
807
+ rgb: hexToRgb2(COLOURS[cCls] ?? "#c2c2c2"),
377
808
  phase: timingPhase(tCls)
378
809
  };
379
810
  });
@@ -641,6 +1072,35 @@ var rainstorm = {
641
1072
  };
642
1073
 
643
1074
  // src/globe.ts
1075
+ import {
1076
+ sampleTrack as sampleTrack3,
1077
+ defaultParams as defaultParams3
1078
+ } from "@idle-screens/core";
1079
+ var RADIUS = 120;
1080
+ var SPIN_BASE = 0.9;
1081
+ var BOUNCE_SPEED = 90;
1082
+ var SEG_LAT = 24;
1083
+ var SEG_LON = 48;
1084
+ var LINE_W_DEVICE = 0.85;
1085
+ var TAU = Math.PI * 2;
1086
+ var PARAM_SPACE3 = {
1087
+ /** Meridian count (longitude lines); parallel count is derived proportionally
1088
+ * (11 parallels : 21 meridians, the original's ratio). Read once at mount —
1089
+ * the lattice is built at construction time and does not respond to a
1090
+ * control-track delta, same convention as `bubbleCount` in saver-tide. */
1091
+ density: { type: "number", default: 21, min: 8, max: 42 },
1092
+ /** Rotation-rate multiplier on the preserved 0.9 rad/s base. */
1093
+ spin: { type: "number", default: 1, min: 0.25, max: 3, ease: "smooth" },
1094
+ /** DVD-bounce amplitude. 1 = the original's full corner-to-corner bounce;
1095
+ * 0 = the globe floats motionless at viewport center. */
1096
+ bounce: { type: "number", default: 1, min: 0, max: 1, ease: "smooth" },
1097
+ /** Wireframe stroke color. */
1098
+ wire: { type: "color", default: "#78c8ff" },
1099
+ /** Soft additive glow on the globe's limb. */
1100
+ glow: { type: "number", default: 0.35, min: 0, max: 1, ease: "smooth" },
1101
+ /** How much the far (back) hemisphere dims relative to the near hemisphere. */
1102
+ depthFade: { type: "number", default: 0.8, min: 0, max: 1, ease: "smooth" }
1103
+ };
644
1104
  var globeManifest = {
645
1105
  id: "globe",
646
1106
  label: "Globe",
@@ -649,37 +1109,59 @@ var globeManifest = {
649
1109
  costTier: "low",
650
1110
  motionIntensity: "calm",
651
1111
  reducedMotionFallback: "static",
1112
+ paramSpace: PARAM_SPACE3,
652
1113
  attribution: {
653
1114
  source: 'After Dark "Globe" \u2014 concept by Berkeley Systems',
654
1115
  license: "MIT port; reference CSS MIT (Bryan Braun)",
655
1116
  url: "https://github.com/bryanbraun/after-dark-css"
656
1117
  },
657
- a11y: { flashSafe: true, notes: "A slowly spinning dotted globe drifting on black; no flashing." },
1118
+ a11y: { flashSafe: true, notes: "A slowly spinning wireframe globe drifting on black; no flashing." },
658
1119
  workerReady: true
659
1120
  };
660
- var RADIUS = 120;
661
- var SPIN = 0.9;
662
- var LAT_LINES = 11;
663
- var LON_LINES = 21;
1121
+ function reflect(pos, size) {
1122
+ const period = size * 2;
1123
+ const k = (pos % period + period) % period;
1124
+ return k <= size ? k : period - k;
1125
+ }
1126
+ function lerp(a, b, p) {
1127
+ return a + (b - a) * p;
1128
+ }
1129
+ function parseHex(c) {
1130
+ const m = /^#?([0-9a-f]{6})$/i.exec(c.trim());
1131
+ if (!m) return [120, 200, 255];
1132
+ const n = parseInt(m[1], 16);
1133
+ return [n >> 16 & 255, n >> 8 & 255, n & 255];
1134
+ }
1135
+ var rgba = (r, g, b, a) => `rgba(${r.toFixed(0)},${g.toFixed(0)},${b.toFixed(0)},${Math.max(0, Math.min(1, a)).toFixed(3)})`;
1136
+ function depthAlpha(depth, depthFade) {
1137
+ const front = 0.82;
1138
+ const backMin = 0.04;
1139
+ const back = front - depthFade * (front - backMin);
1140
+ return back + (front - back) * depth;
1141
+ }
664
1142
  var GlobeInstance = class {
665
- ctx;
1143
+ ctxSaver;
666
1144
  canvas;
667
1145
  c2d;
668
1146
  w = 0;
669
1147
  h = 0;
670
- // globe centre + velocity (DVD bounce)
671
- cx = 0;
672
- cy = 0;
673
- vx = 0;
674
- vy = 0;
675
- spinPhase = 0;
676
- // precomputed unit-sphere lattice (spun about Y at render time)
677
- lattice = [];
1148
+ t = 0;
678
1149
  frameId = null;
679
1150
  paused = false;
680
- last = 0;
1151
+ startT = 0;
1152
+ params = defaultParams3(PARAM_SPACE3);
1153
+ track = null;
1154
+ // Seeded once at construction (never rebuilt on resize) — the exact analog
1155
+ // of saver-tide's `build()`. Determinism only requires the SAME instance to
1156
+ // reproduce a given t; these constants make the DVD-bounce path pure in t.
1157
+ x0Frac;
1158
+ y0Frac;
1159
+ dirAngle;
1160
+ // Lattice, built once from the manifest-default `density` (build-time param).
1161
+ meridians = [];
1162
+ parallels = [];
681
1163
  constructor(ctx) {
682
- this.ctx = ctx;
1164
+ this.ctxSaver = ctx;
683
1165
  let canvas;
684
1166
  if (ctx.surface) {
685
1167
  canvas = ctx.surface;
@@ -693,51 +1175,85 @@ var GlobeInstance = class {
693
1175
  const c2d = canvas.getContext("2d", { alpha: false });
694
1176
  if (!c2d) throw new Error("globe: no 2d context");
695
1177
  this.c2d = c2d;
696
- this.buildLattice();
1178
+ this.buildLattice(PARAM_SPACE3.density.default);
697
1179
  this.w = ctx.width;
698
1180
  this.h = ctx.height;
699
1181
  this.sizeCanvas();
700
1182
  const rng = ctx.rng;
701
- this.cx = rng.range(RADIUS, Math.max(RADIUS + 1, this.w - RADIUS));
702
- this.cy = rng.range(RADIUS, Math.max(RADIUS + 1, this.h - RADIUS));
703
- const dir = rng.range(0, Math.PI * 2);
704
- const speed = 90;
705
- this.vx = Math.cos(dir) * speed;
706
- this.vy = Math.sin(dir) * speed;
707
- this.setPaused(ctx.reducedMotion);
1183
+ this.x0Frac = rng.next();
1184
+ this.y0Frac = rng.next();
1185
+ this.dirAngle = rng.range(0, TAU);
1186
+ this.paused = ctx.reducedMotion;
708
1187
  if (this.paused) this.renderStill();
1188
+ else this.start();
709
1189
  }
710
- /** Dotted lat/long lattice on the unit sphere. */
711
- buildLattice() {
712
- for (let i = 1; i < LAT_LINES; i++) {
713
- const lat = -Math.PI / 2 + Math.PI * i / LAT_LINES;
714
- const ringR = Math.cos(lat);
715
- const y = Math.sin(lat);
716
- const dots = Math.max(6, Math.round(LON_LINES * ringR + 4));
717
- for (let j = 0; j < dots; j++) {
718
- const lon = Math.PI * 2 * j / dots;
719
- this.lattice.push({ x: ringR * Math.cos(lon), y, z: ringR * Math.sin(lon) });
1190
+ /** Meridian half-ellipses + parallel rings on the unit sphere. Pure geometry,
1191
+ * no randomness — `density` is read once, at build time, per the paramSpace
1192
+ * comment; a later control-track delta on `density` updates `params.density`
1193
+ * but does not re-tessellate the lattice. */
1194
+ buildLattice(density) {
1195
+ const meridianCount = Math.max(4, Math.round(density));
1196
+ const parallelCount = Math.max(3, Math.round(density * (11 / 21)));
1197
+ for (let m = 0; m < meridianCount; m++) {
1198
+ const lon = TAU * m / meridianCount;
1199
+ const line = [];
1200
+ for (let s = 0; s <= SEG_LAT; s++) {
1201
+ const lat = -Math.PI / 2 + Math.PI * s / SEG_LAT;
1202
+ const ringR = Math.cos(lat);
1203
+ line.push({ x: ringR * Math.cos(lon), y: Math.sin(lat), z: ringR * Math.sin(lon) });
720
1204
  }
1205
+ this.meridians.push(line);
721
1206
  }
722
- for (let m = 0; m < LON_LINES; m++) {
723
- const lon = Math.PI * 2 * m / LON_LINES;
724
- for (let s = 0; s <= 24; s++) {
725
- const lat = -Math.PI / 2 + Math.PI * s / 24;
726
- const ringR = Math.cos(lat);
727
- this.lattice.push({ x: ringR * Math.cos(lon), y: Math.sin(lat), z: ringR * Math.sin(lon) });
1207
+ for (let i = 1; i < parallelCount; i++) {
1208
+ const lat = -Math.PI / 2 + Math.PI * i / parallelCount;
1209
+ const ringR = Math.cos(lat);
1210
+ const y = Math.sin(lat);
1211
+ const line = [];
1212
+ for (let k = 0; k <= SEG_LON; k++) {
1213
+ const lon = TAU * k / SEG_LON;
1214
+ line.push({ x: ringR * Math.cos(lon), y, z: ringR * Math.sin(lon) });
728
1215
  }
1216
+ this.parallels.push(line);
729
1217
  }
730
1218
  }
731
1219
  sizeCanvas() {
732
- const dpr = Math.min(this.ctx.dpr, 2);
1220
+ const dpr = Math.min(this.ctxSaver.dpr, 2);
733
1221
  this.canvas.width = Math.max(1, Math.round(this.w * dpr));
734
1222
  this.canvas.height = Math.max(1, Math.round(this.h * dpr));
735
1223
  this.c2d.setTransform(dpr, 0, 0, dpr, 0, 0);
736
1224
  }
1225
+ applyParams(t) {
1226
+ const p = this.track ? sampleTrack3(PARAM_SPACE3, this.track, t) : this.params;
1227
+ for (const k of Object.keys(PARAM_SPACE3)) {
1228
+ const v = p[k];
1229
+ if (v !== void 0) this.params[k] = v;
1230
+ }
1231
+ }
1232
+ // ---- closed-form placement ----
1233
+ /** Globe center at time `t` (ms). `bounce` blends between the full
1234
+ * DVD-bounce path and a fixed viewport center. Pure in `t` given the
1235
+ * instance's current w/h and the seeded x0Frac/y0Frac/dirAngle. */
1236
+ center(t) {
1237
+ const p = this.params;
1238
+ const rangeX = Math.max(1, this.w - RADIUS * 2);
1239
+ const rangeY = Math.max(1, this.h - RADIUS * 2);
1240
+ const tSec = t / 1e3;
1241
+ const vx = Math.cos(this.dirAngle) * BOUNCE_SPEED;
1242
+ const vy = Math.sin(this.dirAngle) * BOUNCE_SPEED;
1243
+ const bx = RADIUS + reflect(this.x0Frac * rangeX + vx * tSec, rangeX);
1244
+ const by = RADIUS + reflect(this.y0Frac * rangeY + vy * tSec, rangeY);
1245
+ return [lerp(this.w / 2, bx, p.bounce), lerp(this.h / 2, by, p.bounce)];
1246
+ }
1247
+ /** Rotation angle at time `t` (ms). Pure: the instantaneous `spin` sample
1248
+ * times the preserved base rate, times elapsed seconds — same convention
1249
+ * as saver-tide's `waveSpeed * t` (no integration across changing spin). */
1250
+ angle(t) {
1251
+ return t / 1e3 * SPIN_BASE * this.params.spin;
1252
+ }
737
1253
  // ---- loop ----
738
1254
  start() {
739
1255
  if (this.frameId !== null || typeof requestAnimationFrame === "undefined") return;
740
- this.last = 0;
1256
+ this.startT = 0;
741
1257
  this.frameId = requestAnimationFrame((now) => this.loop(now));
742
1258
  }
743
1259
  stop() {
@@ -748,76 +1264,90 @@ var GlobeInstance = class {
748
1264
  }
749
1265
  loop(now) {
750
1266
  this.frameId = requestAnimationFrame((n) => this.loop(n));
751
- if (this.last === 0) this.last = now;
752
- const dt = Math.min(0.05, (now - this.last) / 1e3);
753
- this.last = now;
754
- this.update(dt);
755
- this.render();
1267
+ if (this.startT === 0) this.startT = now;
1268
+ this.renderFrame(now - this.startT, this.ctxSaver.seed);
756
1269
  }
757
- update(dt) {
758
- this.spinPhase += SPIN * dt;
759
- this.cx += this.vx * dt;
760
- this.cy += this.vy * dt;
761
- const minX = RADIUS;
762
- const maxX = this.w - RADIUS;
763
- const minY = RADIUS;
764
- const maxY = this.h - RADIUS;
765
- if (this.cx < minX) {
766
- this.cx = minX;
767
- this.vx = Math.abs(this.vx);
768
- } else if (this.cx > maxX) {
769
- this.cx = maxX;
770
- this.vx = -Math.abs(this.vx);
771
- }
772
- if (this.cy < minY) {
773
- this.cy = minY;
774
- this.vy = Math.abs(this.vy);
775
- } else if (this.cy > maxY) {
776
- this.cy = maxY;
777
- this.vy = -Math.abs(this.vy);
1270
+ renderStill() {
1271
+ this.renderFrame(this.t, this.ctxSaver.seed);
1272
+ }
1273
+ /** Stroke one lattice polyline (a meridian or a parallel ring), rotated and
1274
+ * projected at render time. `ctx.strokeStyle` is set by the caller;
1275
+ * per-segment alpha/width vary with `depthFade`/`lineW` for a sense of
1276
+ * depth on the back hemisphere. */
1277
+ strokeLine(line, cx, cy, cosA, sinA, lineW, depthFade) {
1278
+ const ctx = this.c2d;
1279
+ let prevX = 0;
1280
+ let prevY = 0;
1281
+ let prevDepth = 0;
1282
+ for (let i = 0; i < line.length; i++) {
1283
+ const p = line[i];
1284
+ const rx = p.x * cosA + p.z * sinA;
1285
+ const rz = -p.x * sinA + p.z * cosA;
1286
+ const x = cx + rx * RADIUS;
1287
+ const y = cy + p.y * RADIUS;
1288
+ const depth = (rz + 1) / 2;
1289
+ if (i > 0) {
1290
+ const avgDepth = (prevDepth + depth) / 2;
1291
+ ctx.globalAlpha = depthAlpha(avgDepth, depthFade);
1292
+ ctx.lineWidth = lineW * (0.55 + 0.65 * avgDepth);
1293
+ ctx.beginPath();
1294
+ ctx.moveTo(prevX, prevY);
1295
+ ctx.lineTo(x, y);
1296
+ ctx.stroke();
1297
+ }
1298
+ prevX = x;
1299
+ prevY = y;
1300
+ prevDepth = depth;
778
1301
  }
1302
+ ctx.globalAlpha = 1;
779
1303
  }
780
- render() {
1304
+ render(t) {
781
1305
  const ctx = this.c2d;
1306
+ const p = this.params;
1307
+ const [cx, cy] = this.center(t);
1308
+ const a = this.angle(t);
1309
+ const cosA = Math.cos(a);
1310
+ const sinA = Math.sin(a);
1311
+ const dpr = Math.min(this.ctxSaver.dpr, 2);
1312
+ const lineW = LINE_W_DEVICE / dpr;
1313
+ const [wr, wg, wb] = parseHex(p.wire);
782
1314
  ctx.fillStyle = "#000";
783
1315
  ctx.fillRect(0, 0, this.w, this.h);
784
1316
  const body = ctx.createRadialGradient(
785
- this.cx - RADIUS * 0.35,
786
- this.cy - RADIUS * 0.35,
1317
+ cx - RADIUS * 0.35,
1318
+ cy - RADIUS * 0.35,
787
1319
  RADIUS * 0.1,
788
- this.cx,
789
- this.cy,
1320
+ cx,
1321
+ cy,
790
1322
  RADIUS
791
1323
  );
792
- body.addColorStop(0, "rgba(30,60,90,0.55)");
793
- body.addColorStop(1, "rgba(6,14,26,0.15)");
1324
+ body.addColorStop(0, rgba(wr * 0.35, wg * 0.4, wb * 0.5, 0.5));
1325
+ body.addColorStop(1, rgba(wr * 0.1, wg * 0.14, wb * 0.2, 0.15));
794
1326
  ctx.fillStyle = body;
795
1327
  ctx.beginPath();
796
- ctx.arc(this.cx, this.cy, RADIUS, 0, Math.PI * 2);
1328
+ ctx.arc(cx, cy, RADIUS, 0, TAU);
797
1329
  ctx.fill();
798
- const cos = Math.cos(this.spinPhase);
799
- const sin = Math.sin(this.spinPhase);
800
- for (const p of this.lattice) {
801
- const rx = p.x * cos + p.z * sin;
802
- const rz = -p.x * sin + p.z * cos;
803
- const x = this.cx + rx * RADIUS;
804
- const y = this.cy + p.y * RADIUS;
805
- const depth = (rz + 1) / 2;
806
- const alpha = 0.12 + depth * 0.7;
807
- const size = 0.7 + depth * 1.2;
808
- ctx.fillStyle = `rgba(120,200,255,${alpha.toFixed(3)})`;
1330
+ ctx.strokeStyle = rgba(wr, wg, wb, 1);
1331
+ for (const line of this.meridians) this.strokeLine(line, cx, cy, cosA, sinA, lineW, p.depthFade);
1332
+ for (const line of this.parallels) this.strokeLine(line, cx, cy, cosA, sinA, lineW, p.depthFade);
1333
+ ctx.globalAlpha = 1;
1334
+ ctx.strokeStyle = rgba(wr, wg, wb, 0.4);
1335
+ ctx.lineWidth = lineW;
1336
+ ctx.beginPath();
1337
+ ctx.arc(cx, cy, RADIUS, 0, TAU);
1338
+ ctx.stroke();
1339
+ if (p.glow > 0.01) {
1340
+ ctx.save();
1341
+ ctx.globalCompositeOperation = "lighter";
1342
+ const glow = ctx.createRadialGradient(cx, cy, RADIUS * 0.82, cx, cy, RADIUS * 1.4);
1343
+ glow.addColorStop(0, rgba(wr, wg, wb, 0.4 * p.glow));
1344
+ glow.addColorStop(1, rgba(wr, wg, wb, 0));
1345
+ ctx.fillStyle = glow;
809
1346
  ctx.beginPath();
810
- ctx.arc(x, y, size, 0, Math.PI * 2);
1347
+ ctx.arc(cx, cy, RADIUS * 1.4, 0, TAU);
811
1348
  ctx.fill();
1349
+ ctx.restore();
812
1350
  }
813
- ctx.strokeStyle = "rgba(120,200,255,0.35)";
814
- ctx.lineWidth = 1;
815
- ctx.beginPath();
816
- ctx.arc(this.cx, this.cy, RADIUS, 0, Math.PI * 2);
817
- ctx.stroke();
818
- }
819
- renderStill() {
820
- this.render();
821
1351
  }
822
1352
  // ---- SaverInstance ----
823
1353
  setPaused(paused) {
@@ -832,12 +1362,22 @@ var GlobeInstance = class {
832
1362
  resize(width, height, dpr) {
833
1363
  this.w = width;
834
1364
  this.h = height;
835
- if (dpr !== void 0) this.ctx.dpr = dpr;
1365
+ if (dpr !== void 0) this.ctxSaver.dpr = dpr;
836
1366
  this.sizeCanvas();
837
- this.cx = Math.min(Math.max(this.cx, RADIUS), Math.max(RADIUS, this.w - RADIUS));
838
- this.cy = Math.min(Math.max(this.cy, RADIUS), Math.max(RADIUS, this.h - RADIUS));
839
1367
  if (this.paused) this.renderStill();
840
1368
  }
1369
+ applyTrack(track) {
1370
+ this.track = track;
1371
+ if (this.paused) this.renderStill();
1372
+ }
1373
+ /** Pure, frame-addressable render at logical time `t` (ms). Position and
1374
+ * rotation are both closed-form in `t` — no accumulated state — so seeking
1375
+ * to any `t`, in any order, reproduces the same frame. */
1376
+ renderFrame(t, _seed) {
1377
+ this.t = t;
1378
+ this.applyParams(t);
1379
+ this.render(t);
1380
+ }
841
1381
  dispose() {
842
1382
  this.stop();
843
1383
  if (typeof HTMLCanvasElement !== "undefined" && this.canvas instanceof HTMLCanvasElement) this.canvas.remove();
@@ -847,6 +1387,25 @@ var globe = {
847
1387
  manifest: globeManifest,
848
1388
  mount: (ctx) => new GlobeInstance(ctx)
849
1389
  };
1390
+ var globeDemoTrack = {
1391
+ program: "globe",
1392
+ seed: 3,
1393
+ duration: 12e3,
1394
+ loop: true,
1395
+ deltas: [
1396
+ { t: 0, path: "spin", value: 0.6 },
1397
+ { t: 4e3, path: "spin", value: 2.2, ease: "smooth" },
1398
+ { t: 8e3, path: "spin", value: 0.6, ease: "smooth" },
1399
+ { t: 12e3, path: "spin", value: 0.6 },
1400
+ { t: 0, path: "bounce", value: 1 },
1401
+ { t: 5e3, path: "bounce", value: 0.1, ease: "smooth" },
1402
+ { t: 9e3, path: "bounce", value: 1, ease: "smooth" },
1403
+ { t: 12e3, path: "bounce", value: 1 },
1404
+ { t: 0, path: "glow", value: 0.25 },
1405
+ { t: 6e3, path: "glow", value: 0.9, ease: "smooth" },
1406
+ { t: 12e3, path: "glow", value: 0.25, ease: "smooth" }
1407
+ ]
1408
+ };
850
1409
 
851
1410
  // src/spotlight.ts
852
1411
  var spotlightManifest = {
@@ -906,12 +1465,12 @@ var SpotlightInstance = class {
906
1465
  this.c2d.setTransform(dpr, 0, 0, dpr, 0, 0);
907
1466
  }
908
1467
  centre() {
909
- const tri2 = (t, period) => {
1468
+ const tri3 = (t, period) => {
910
1469
  const p = (t % (period * 2) + period * 2) % (period * 2);
911
1470
  return p < period ? p / period : 2 - p / period;
912
1471
  };
913
- const kx = tri2(this.clock, SPEED_X);
914
- const ky = tri2(this.clock, SPEED_Y);
1472
+ const kx = tri3(this.clock, SPEED_X);
1473
+ const ky = tri3(this.clock, SPEED_Y);
915
1474
  const x = HOLE_RADIUS + kx * (this.w - HOLE_RADIUS * 2);
916
1475
  const y = HOLE_RADIUS + ky * (this.h - HOLE_RADIUS * 2);
917
1476
  return [x, y];
@@ -1396,6 +1955,34 @@ var pipes = {
1396
1955
  };
1397
1956
 
1398
1957
  // src/flurry.ts
1958
+ import {
1959
+ sampleTrack as sampleTrack4,
1960
+ defaultParams as defaultParams4
1961
+ } from "@idle-screens/core";
1962
+ var STREAM_COUNT = 5;
1963
+ var PARTICLES_PER_ARM = 56;
1964
+ var BASE_RADIUS = 6;
1965
+ var STILL_T = 6e3;
1966
+ var TRAIL_FRAC_MIN = 0.12;
1967
+ var TRAIL_FRAC_MAX = 0.42;
1968
+ var TAIL_SIZE_FLOOR = 0.45;
1969
+ var TAIL_ALPHA_POWER = 1.4;
1970
+ var PARAM_SPACE4 = {
1971
+ /** Arm count. Build-time: rebuilt (deterministically, from the same seeded
1972
+ * RNG forks) whenever this changes rather than smoothly animated — more
1973
+ * arms means re-deriving the whole cast, not interpolating between two. */
1974
+ arms: { type: "number", default: STREAM_COUNT, min: 3, max: 10, ease: "step" },
1975
+ speed: { type: "number", default: 1, min: 0.25, max: 3, ease: "smooth" },
1976
+ /** Additive glow strength: halo reach and brightness of each particle. */
1977
+ glow: { type: "number", default: 0.6, min: 0, max: 1.5, ease: "smooth" },
1978
+ /** How far back each arm's analytic trail reads, as a fraction of the
1979
+ * screen diagonal (0 = short stub, 1 = long flowing ribbon). */
1980
+ trail: { type: "number", default: 0.5, min: 0, max: 1, ease: "smooth" },
1981
+ /** Color scheme. 'spectrum' rotates hue continuously over ~20s — well
1982
+ * outside flash-safety limits, no strobing. */
1983
+ palette: { type: "enum", default: "aurora", options: ["aurora", "ember", "mono", "spectrum"] },
1984
+ size: { type: "number", default: 1, min: 0.5, max: 2, ease: "smooth" }
1985
+ };
1399
1986
  var flurryManifest = {
1400
1987
  id: "flurry",
1401
1988
  label: "Flurry",
@@ -1404,24 +1991,70 @@ var flurryManifest = {
1404
1991
  costTier: "low",
1405
1992
  motionIntensity: "calm",
1406
1993
  reducedMotionFallback: "static",
1407
- a11y: { flashSafe: true },
1994
+ paramSpace: PARAM_SPACE4,
1995
+ a11y: {
1996
+ flashSafe: true,
1997
+ notes: "Softly glowing arms drifting on black. The spectrum palette rotates hue over ~20s; no flashing."
1998
+ },
1408
1999
  workerReady: true
1409
2000
  };
1410
- var STREAM_COUNT = 5;
1411
- var PARTICLES_PER_STREAM = 12;
1412
- var TRAIL_ALPHA2 = 0.06;
1413
- var BASE_RADIUS = 6;
2001
+ function buildArm(rng) {
2002
+ return {
2003
+ freqX1: rng.range(0.3, 0.9),
2004
+ freqY1: rng.range(0.3, 0.9),
2005
+ freqX2: rng.range(0.1, 0.4),
2006
+ freqY2: rng.range(0.1, 0.4),
2007
+ freqX3: rng.range(0.04, 0.15),
2008
+ freqY3: rng.range(0.04, 0.15),
2009
+ phaseX: rng.range(0, Math.PI * 2),
2010
+ phaseY: rng.range(0, Math.PI * 2),
2011
+ ampX: rng.range(0.2, 0.4),
2012
+ ampY: rng.range(0.2, 0.4),
2013
+ armSpeed: rng.range(0.6, 1.2),
2014
+ hueJitter: rng.range(0, 1)
2015
+ };
2016
+ }
2017
+ function paletteHue(palette, arm, armIndex, armCount, t) {
2018
+ const spread = armCount > 0 ? armIndex / armCount : 0;
2019
+ switch (palette) {
2020
+ case "ember":
2021
+ return (8 + spread * 46 + arm.hueJitter * 10) % 360;
2022
+ // reds -> oranges -> yellows
2023
+ case "mono":
2024
+ return 201 + arm.hueJitter * 14;
2025
+ // narrow cool-blue band, 201-215
2026
+ case "spectrum": {
2027
+ const rotation = t / 2e4 * 360;
2028
+ return (arm.hueJitter * 360 + rotation) % 360;
2029
+ }
2030
+ case "aurora":
2031
+ default:
2032
+ return (150 + spread * 70 + arm.hueJitter * 20) % 360;
2033
+ }
2034
+ }
1414
2035
  var FlurryInstance = class {
1415
2036
  ctxSaver;
1416
2037
  canvas;
1417
- ctx;
2038
+ c2d;
1418
2039
  w = 0;
1419
2040
  h = 0;
1420
- streams;
2041
+ arms = [];
1421
2042
  frameId = null;
1422
- t = 0;
1423
- lastTime = 0;
1424
2043
  paused = false;
2044
+ startT = 0;
2045
+ /** Logical time the next rAF origin resumes from.
2046
+ *
2047
+ * `start()` re-anchors `startT` to the next frame's timestamp, so on its own
2048
+ * `now - startT` always begins at zero. Mount wants that; resuming from a
2049
+ * pause does not — without carrying the frozen `t` forward, every
2050
+ * pause/resume (and every reduced-motion toggle) snaps the scene back to its
2051
+ * opening frame and restarts any applied control track. Set only in
2052
+ * `setPaused(false)`, so first mount still starts at 0. */
2053
+ resumeFrom = 0;
2054
+ t = STILL_T;
2055
+ // anchor frame until the loop (or a seek) moves it
2056
+ params = defaultParams4(PARAM_SPACE4);
2057
+ track = null;
1425
2058
  constructor(ctx) {
1426
2059
  this.ctxSaver = ctx;
1427
2060
  this.w = ctx.width;
@@ -1439,10 +2072,8 @@ var FlurryInstance = class {
1439
2072
  this.canvas = canvas;
1440
2073
  const c2d = canvas.getContext("2d", { alpha: false });
1441
2074
  if (!c2d) throw new Error("flurry: no 2d context");
1442
- this.ctx = c2d;
1443
- this.streams = this.buildStreams(ctx.rng);
2075
+ this.c2d = c2d;
1444
2076
  this.sizeCanvas();
1445
- this.clearFull();
1446
2077
  this.paused = ctx.reducedMotion;
1447
2078
  if (this.paused) {
1448
2079
  this.renderStill();
@@ -1450,71 +2081,95 @@ var FlurryInstance = class {
1450
2081
  this.start();
1451
2082
  }
1452
2083
  }
1453
- buildStreams(rng) {
1454
- const out = [];
1455
- for (let i = 0; i < STREAM_COUNT; i++) {
1456
- out.push({
1457
- hue: (i * 360 / STREAM_COUNT + rng.range(0, 30)) % 360,
1458
- freqX1: rng.range(0.3, 0.9),
1459
- freqY1: rng.range(0.3, 0.9),
1460
- freqX2: rng.range(0.1, 0.4),
1461
- freqY2: rng.range(0.1, 0.4),
1462
- phaseX: rng.range(0, Math.PI * 2),
1463
- phaseY: rng.range(0, Math.PI * 2),
1464
- ampX: rng.range(0.2, 0.4),
1465
- ampY: rng.range(0.2, 0.4),
1466
- speed: rng.range(0.6, 1.2)
1467
- });
2084
+ applyParams(t) {
2085
+ const p = this.track ? sampleTrack4(PARAM_SPACE4, this.track, t) : this.params;
2086
+ for (const k of Object.keys(PARAM_SPACE4)) {
2087
+ const v = p[k];
2088
+ if (v !== void 0) this.params[k] = v;
1468
2089
  }
1469
- return out;
2090
+ }
2091
+ /** Rebuild the arm cast for a given count, deterministically, from the
2092
+ * saver's own seeded RNG. Pure w.r.t. (ctx.rng, count) — safe to call any
2093
+ * number of times, in any order, from any `t`. Keying off `arms.length`
2094
+ * alone is correct here (not a "rebuild every frame" bug): `ctx.rng`
2095
+ * never changes for this instance and `Rng.fork(salt)` is itself a pure
2096
+ * function of the salt, so a given count always yields the same cast. */
2097
+ ensureArms(count) {
2098
+ if (count === this.arms.length) return;
2099
+ const out = [];
2100
+ for (let i = 0; i < count; i++) out.push(buildArm(this.ctxSaver.rng.fork(i)));
2101
+ this.arms = out;
1470
2102
  }
1471
2103
  sizeCanvas() {
1472
2104
  const dpr = Math.min(this.ctxSaver.dpr, 2);
1473
2105
  this.canvas.width = Math.max(1, Math.round(this.w * dpr));
1474
2106
  this.canvas.height = Math.max(1, Math.round(this.h * dpr));
1475
- this.ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
1476
- }
1477
- clearFull() {
1478
- this.ctx.fillStyle = "#000";
1479
- this.ctx.fillRect(0, 0, this.w, this.h);
2107
+ this.c2d.setTransform(dpr, 0, 0, dpr, 0, 0);
1480
2108
  }
1481
- streamPos(s, t) {
2109
+ /** Closed-form arm-tip position at arm-local time `s` (seconds). Pure. */
2110
+ armTip(arm, s) {
1482
2111
  const cx = this.w / 2;
1483
2112
  const cy = this.h / 2;
1484
- const x = cx + Math.sin(t * s.freqX1 + s.phaseX) * this.w * s.ampX + Math.sin(t * s.freqX2 + s.phaseX * 1.7) * this.w * s.ampX * 0.3;
1485
- const y = cy + Math.cos(t * s.freqY1 + s.phaseY) * this.h * s.ampY + Math.cos(t * s.freqY2 + s.phaseY * 2.1) * this.h * s.ampY * 0.3;
2113
+ const x = cx + Math.sin(s * arm.freqX1 + arm.phaseX) * this.w * arm.ampX + Math.sin(s * arm.freqX2 + arm.phaseX * 1.7) * this.w * arm.ampX * 0.3 + Math.sin(s * arm.freqX3 + arm.phaseX * 0.6) * this.w * arm.ampX * 0.12;
2114
+ const y = cy + Math.cos(s * arm.freqY1 + arm.phaseY) * this.h * arm.ampY + Math.cos(s * arm.freqY2 + arm.phaseY * 2.1) * this.h * arm.ampY * 0.3 + Math.cos(s * arm.freqY3 + arm.phaseY * 1.3) * this.h * arm.ampY * 0.12;
1486
2115
  return [x, y];
1487
2116
  }
1488
- drawFrame(_dt) {
1489
- const ctx = this.ctx;
1490
- ctx.globalCompositeOperation = "source-over";
1491
- ctx.fillStyle = `rgba(0,0,0,${TRAIL_ALPHA2})`;
1492
- ctx.fillRect(0, 0, this.w, this.h);
1493
- ctx.globalCompositeOperation = "lighter";
1494
- for (const s of this.streams) {
1495
- const st = this.t * s.speed;
1496
- for (let p = 0; p < PARTICLES_PER_STREAM; p++) {
1497
- const offset = p * 0.012;
1498
- const [x, y] = this.streamPos(s, st - offset);
1499
- const hue = (s.hue + this.t * 8 + p * 3) % 360;
1500
- const alpha = 0.15 + 0.1 * (1 - p / PARTICLES_PER_STREAM);
1501
- const r = BASE_RADIUS * (1 - p * 0.04);
1502
- const grad = ctx.createRadialGradient(x, y, 0, x, y, r * 3);
1503
- grad.addColorStop(0, `hsla(${hue},90%,60%,${alpha})`);
1504
- grad.addColorStop(0.4, `hsla(${hue},80%,50%,${alpha * 0.5})`);
1505
- grad.addColorStop(1, `hsla(${hue},70%,40%,0)`);
1506
- ctx.fillStyle = grad;
1507
- ctx.beginPath();
1508
- ctx.arc(x, y, r * 3, 0, Math.PI * 2);
1509
- ctx.fill();
2117
+ /** Pure render at logical time `t` (ms): background + every arm's analytic trail. */
2118
+ render(t) {
2119
+ const c2d = this.c2d;
2120
+ const p = this.params;
2121
+ c2d.fillStyle = "#000";
2122
+ c2d.fillRect(0, 0, this.w, this.h);
2123
+ const armCount = Math.max(3, Math.min(10, Math.round(p.arms)));
2124
+ this.ensureArms(armCount);
2125
+ c2d.globalCompositeOperation = "lighter";
2126
+ c2d.lineCap = "butt";
2127
+ c2d.lineJoin = "round";
2128
+ const globalS = t / 1e3 * p.speed;
2129
+ const glow = Math.max(0, Math.min(1.5, p.glow));
2130
+ const size = Math.max(0.5, Math.min(2, p.size));
2131
+ const glowReach = 3.6 + glow * 2.6;
2132
+ const headAlpha = 0.85 * (0.5 + glow * 0.6);
2133
+ const diag = Math.hypot(this.w, this.h);
2134
+ const trailFrac = TRAIL_FRAC_MIN + Math.max(0, Math.min(1, p.trail)) * (TRAIL_FRAC_MAX - TRAIL_FRAC_MIN);
2135
+ const targetArcPx = trailFrac * diag;
2136
+ const avgDim = (this.w + this.h) / 2;
2137
+ for (let i = 0; i < this.arms.length; i++) {
2138
+ const arm = this.arms[i];
2139
+ const armS = globalS * arm.armSpeed;
2140
+ const charRate = Math.max(0.02, (arm.freqX1 * arm.ampX + arm.freqY1 * arm.ampY) / 2);
2141
+ const spanS = targetArcPx / (charRate * avgDim);
2142
+ const stepS = spanS / (PARTICLES_PER_ARM - 1);
2143
+ const pts = new Array(PARTICLES_PER_ARM);
2144
+ for (let k = 0; k < PARTICLES_PER_ARM; k++) pts[k] = this.armTip(arm, armS - k * stepS);
2145
+ const hue = paletteHue(p.palette, arm, i, this.arms.length, t);
2146
+ for (let k = 0; k < PARTICLES_PER_ARM - 1; k++) {
2147
+ const kFrac = (k + 0.5) / (PARTICLES_PER_ARM - 1);
2148
+ const r = BASE_RADIUS * size * (1 - kFrac * (1 - TAIL_SIZE_FLOOR));
2149
+ const alpha = headAlpha * Math.pow(1 - kFrac, TAIL_ALPHA_POWER);
2150
+ const [x0, y0] = pts[k];
2151
+ const [x1, y1] = pts[k + 1];
2152
+ c2d.strokeStyle = `hsla(${hue},85%,58%,${alpha * 0.5})`;
2153
+ c2d.lineWidth = Math.max(0.5, r * glowReach);
2154
+ c2d.beginPath();
2155
+ c2d.moveTo(x0, y0);
2156
+ c2d.lineTo(x1, y1);
2157
+ c2d.stroke();
2158
+ c2d.strokeStyle = `hsla(${hue},95%,74%,${Math.min(1, alpha * 1.15)})`;
2159
+ c2d.lineWidth = Math.max(0.5, r * 1.15);
2160
+ c2d.beginPath();
2161
+ c2d.moveTo(x0, y0);
2162
+ c2d.lineTo(x1, y1);
2163
+ c2d.stroke();
1510
2164
  }
1511
2165
  }
1512
- ctx.globalCompositeOperation = "source-over";
2166
+ c2d.globalCompositeOperation = "source-over";
1513
2167
  }
2168
+ // ---- loop ----
1514
2169
  start() {
1515
2170
  if (this.frameId !== null || typeof requestAnimationFrame === "undefined") return;
1516
- this.lastTime = 0;
1517
- this.loop(0);
2171
+ this.startT = 0;
2172
+ this.frameId = requestAnimationFrame((now) => this.loop(now));
1518
2173
  }
1519
2174
  stop() {
1520
2175
  if (this.frameId !== null) {
@@ -1524,23 +2179,23 @@ var FlurryInstance = class {
1524
2179
  }
1525
2180
  loop(now) {
1526
2181
  this.frameId = requestAnimationFrame((n) => this.loop(n));
1527
- const dt = this.lastTime ? (now - this.lastTime) / 1e3 : 1 / 60;
1528
- this.lastTime = now;
1529
- this.t += Math.min(dt, 0.1);
1530
- this.drawFrame(dt);
2182
+ if (this.startT === 0) this.startT = now;
2183
+ this.renderFrame(now - this.startT + this.resumeFrom, this.ctxSaver.seed);
1531
2184
  }
2185
+ /** Freeze on whatever frame we're actually at — not a fixed anchor — so
2186
+ * pausing mid-loop, resizing while paused, or steering a track while
2187
+ * paused all repaint the same instant instead of snapping elsewhere. */
1532
2188
  renderStill() {
1533
- this.clearFull();
1534
- for (let i = 0; i < 120; i++) {
1535
- this.t += 1 / 60;
1536
- this.drawFrame(1 / 60);
1537
- }
2189
+ this.renderFrame(this.t, this.ctxSaver.seed);
1538
2190
  }
2191
+ // ---- SaverInstance ----
1539
2192
  setPaused(paused) {
1540
2193
  this.paused = paused;
1541
2194
  if (paused) {
1542
2195
  this.stop();
2196
+ this.renderStill();
1543
2197
  } else {
2198
+ this.resumeFrom = this.t;
1544
2199
  this.start();
1545
2200
  }
1546
2201
  }
@@ -1549,9 +2204,19 @@ var FlurryInstance = class {
1549
2204
  this.h = height;
1550
2205
  if (dpr !== void 0) this.ctxSaver.dpr = dpr;
1551
2206
  this.sizeCanvas();
1552
- this.clearFull();
1553
2207
  if (this.paused) this.renderStill();
1554
2208
  }
2209
+ applyTrack(track) {
2210
+ this.track = track;
2211
+ if (this.paused) this.renderStill();
2212
+ }
2213
+ /** Pure, frame-addressable render at logical time `t` (ms) for `seed`.
2214
+ * Same (t, seed) always paints the same pixels — seek-back safe. */
2215
+ renderFrame(t, _seed) {
2216
+ this.t = t;
2217
+ this.applyParams(t);
2218
+ this.render(t);
2219
+ }
1555
2220
  dispose() {
1556
2221
  this.stop();
1557
2222
  if (typeof HTMLCanvasElement !== "undefined" && this.canvas instanceof HTMLCanvasElement) this.canvas.remove();
@@ -1561,6 +2226,24 @@ var flurry = {
1561
2226
  manifest: flurryManifest,
1562
2227
  mount: (ctx) => new FlurryInstance(ctx)
1563
2228
  };
2229
+ var flurryDemoTrack = {
2230
+ program: "flurry",
2231
+ seed: 3,
2232
+ duration: 16e3,
2233
+ loop: true,
2234
+ deltas: [
2235
+ { t: 0, path: "palette", value: "aurora" },
2236
+ { t: 8e3, path: "palette", value: "ember" },
2237
+ { t: 0, path: "speed", value: 0.6 },
2238
+ { t: 8e3, path: "speed", value: 1.8, ease: "smooth" },
2239
+ { t: 16e3, path: "speed", value: 0.6, ease: "smooth" },
2240
+ { t: 0, path: "glow", value: 0.3 },
2241
+ { t: 4e3, path: "glow", value: 0.9, ease: "smooth" },
2242
+ { t: 8e3, path: "glow", value: 0.3, ease: "smooth" },
2243
+ { t: 12e3, path: "glow", value: 0.9, ease: "smooth" },
2244
+ { t: 16e3, path: "glow", value: 0.3, ease: "smooth" }
2245
+ ]
2246
+ };
1564
2247
 
1565
2248
  // src/fluid-shared.ts
1566
2249
  var DT = 0.025;
@@ -3243,8 +3926,8 @@ var reactionDiffusion = {
3243
3926
 
3244
3927
  // src/messages.ts
3245
3928
  import {
3246
- sampleTrack,
3247
- defaultParams
3929
+ sampleTrack as sampleTrack5,
3930
+ defaultParams as defaultParams5
3248
3931
  } from "@idle-screens/core";
3249
3932
  var PHRASES = {
3250
3933
  "out-to-lunch": "OUT TO LUNCH",
@@ -3253,7 +3936,7 @@ var PHRASES = {
3253
3936
  "gone-idle": "gone idle \u2014 leave a message",
3254
3937
  "ship-it": "SHIP IT IN THE MORNING"
3255
3938
  };
3256
- var PARAM_SPACE = {
3939
+ var PARAM_SPACE5 = {
3257
3940
  /** Which line the screen mutters. */
3258
3941
  phrase: { type: "enum", default: "out-to-lunch", options: Object.keys(PHRASES) },
3259
3942
  /** 'marquee' = the Out-to-Lunch crawl (steps down the page);
@@ -3276,7 +3959,7 @@ var messagesManifest = {
3276
3959
  costTier: "low",
3277
3960
  motionIntensity: "calm",
3278
3961
  reducedMotionFallback: "static",
3279
- paramSpace: PARAM_SPACE,
3962
+ paramSpace: PARAM_SPACE5,
3280
3963
  attribution: {
3281
3964
  source: 'After Dark "Messages" \u2014 concepts by Berkeley Systems',
3282
3965
  license: "MIT port; reference CSS MIT (Bryan Braun)",
@@ -3285,7 +3968,7 @@ var messagesManifest = {
3285
3968
  a11y: { flashSafe: true, notes: "A single line of text moving smoothly; no flashing." },
3286
3969
  workerReady: true
3287
3970
  };
3288
- var tri = (t, p) => {
3971
+ var tri2 = (t, p) => {
3289
3972
  const k = (t % (p * 2) + p * 2) % (p * 2);
3290
3973
  return k < p ? k / p : 2 - k / p;
3291
3974
  };
@@ -3299,7 +3982,7 @@ var MessagesInstance = class {
3299
3982
  paused = false;
3300
3983
  startT = 0;
3301
3984
  t = 0;
3302
- params = defaultParams(PARAM_SPACE);
3985
+ params = defaultParams5(PARAM_SPACE5);
3303
3986
  track = null;
3304
3987
  constructor(ctx) {
3305
3988
  this.ctxSaver = ctx;
@@ -3322,8 +4005,8 @@ var MessagesInstance = class {
3322
4005
  else this.start();
3323
4006
  }
3324
4007
  applyParams(t) {
3325
- const p = this.track ? sampleTrack(PARAM_SPACE, this.track, t) : this.params;
3326
- for (const k of Object.keys(PARAM_SPACE)) {
4008
+ const p = this.track ? sampleTrack5(PARAM_SPACE5, this.track, t) : this.params;
4009
+ for (const k of Object.keys(PARAM_SPACE5)) {
3327
4010
  const v = p[k];
3328
4011
  if (v !== void 0) this.params[k] = v;
3329
4012
  }
@@ -3354,8 +4037,8 @@ var MessagesInstance = class {
3354
4037
  const y2 = this.h * 0.22 + row * this.h * 0.27 + fs * 0.5;
3355
4038
  return [x2, y2];
3356
4039
  }
3357
- const x = tri(t, 8e3 / p.speed) * Math.max(0, this.w - textW);
3358
- const y = fs + tri(t, 17300 / p.speed) * Math.max(0, this.h - fs * 1.6);
4040
+ const x = tri2(t, 8e3 / p.speed) * Math.max(0, this.w - textW);
4041
+ const y = fs + tri2(t, 17300 / p.speed) * Math.max(0, this.h - fs * 1.6);
3359
4042
  return [x, y];
3360
4043
  }
3361
4044
  // ---- loop ----
@@ -3460,17 +4143,22 @@ var messagesDemoTrack = {
3460
4143
  };
3461
4144
 
3462
4145
  export {
4146
+ dvd,
4147
+ dvdDemoTrack,
3463
4148
  warp,
4149
+ warpDemoTrack,
3464
4150
  hardRain,
3465
4151
  rainstorm,
3466
4152
  globe,
4153
+ globeDemoTrack,
3467
4154
  spotlight,
3468
4155
  mystify,
3469
4156
  pipes,
3470
4157
  flurry,
4158
+ flurryDemoTrack,
3471
4159
  fluid,
3472
4160
  reactionDiffusion,
3473
4161
  messages,
3474
4162
  messagesDemoTrack
3475
4163
  };
3476
- //# sourceMappingURL=chunk-RMW74SYX.js.map
4164
+ //# sourceMappingURL=chunk-PU6BQ5S3.js.map