use-scroll-animate 6.1.1 → 6.3.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.
Files changed (114) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/chunks/{base-Yno7N2eC.js → base-DchG4q_S.js} +2 -2
  3. package/dist/chunks/{base-Yno7N2eC.js.map → base-DchG4q_S.js.map} +1 -1
  4. package/dist/chunks/{core-BIOaYdgN.js → core-D2vF8kZb.js} +2 -2
  5. package/dist/chunks/{core-BIOaYdgN.js.map → core-D2vF8kZb.js.map} +1 -1
  6. package/dist/chunks/{core-CUGCsMsJ.js → core-DVyTlo9Q.js} +2 -2
  7. package/dist/chunks/{core-CUGCsMsJ.js.map → core-DVyTlo9Q.js.map} +1 -1
  8. package/dist/chunks/{fx-BqDeFywO.js → fx-DUMVKSvg.js} +2 -2
  9. package/dist/chunks/{fx-BqDeFywO.js.map → fx-DUMVKSvg.js.map} +1 -1
  10. package/dist/chunks/generative-BHIj-NU0.cjs +295 -0
  11. package/dist/chunks/generative-BHIj-NU0.cjs.map +1 -0
  12. package/dist/chunks/generative-BRUZaIsX.js +290 -0
  13. package/dist/chunks/generative-BRUZaIsX.js.map +1 -0
  14. package/dist/chunks/gpu-BBRLgEzM.cjs +388 -0
  15. package/dist/chunks/gpu-BBRLgEzM.cjs.map +1 -0
  16. package/dist/chunks/gpu-XHWzeNb5.js +381 -0
  17. package/dist/chunks/gpu-XHWzeNb5.js.map +1 -0
  18. package/dist/chunks/registry-Bu5NrAyA.js +121 -0
  19. package/dist/chunks/registry-Bu5NrAyA.js.map +1 -0
  20. package/dist/chunks/registry-DehBVRDV.cjs +131 -0
  21. package/dist/chunks/registry-DehBVRDV.cjs.map +1 -0
  22. package/dist/chunks/shared-eweTlzxv.js +50 -0
  23. package/dist/chunks/shared-eweTlzxv.js.map +1 -0
  24. package/dist/chunks/shared-jkgRH-Hx.cjs +58 -0
  25. package/dist/chunks/shared-jkgRH-Hx.cjs.map +1 -0
  26. package/dist/chunks/{spring-DfQO5USi.js → spring-BhoT09Qb.js} +2 -2
  27. package/dist/chunks/{spring-DfQO5USi.js.map → spring-BhoT09Qb.js.map} +1 -1
  28. package/dist/chunks/{variants-VNscPeTD.js → variants-C_hv_s23.js} +2 -2
  29. package/dist/chunks/{variants-VNscPeTD.js.map → variants-C_hv_s23.js.map} +1 -1
  30. package/dist/components/a11y.js +2 -2
  31. package/dist/components/angular.cjs +1 -0
  32. package/dist/components/angular.cjs.map +1 -1
  33. package/dist/components/angular.js +7 -6
  34. package/dist/components/angular.js.map +1 -1
  35. package/dist/components/background.js +2 -2
  36. package/dist/components/bridge.js +1 -1
  37. package/dist/components/cards.js +2 -2
  38. package/dist/components/click.js +3 -3
  39. package/dist/components/depth.js +3 -3
  40. package/dist/components/effects.cjs +72 -403
  41. package/dist/components/effects.cjs.map +1 -1
  42. package/dist/components/effects.js +9 -339
  43. package/dist/components/effects.js.map +1 -1
  44. package/dist/components/feedback.js +1 -1
  45. package/dist/components/fx-gpu.cjs +13 -0
  46. package/dist/components/fx-gpu.cjs.map +1 -0
  47. package/dist/components/fx-gpu.d.cts +63 -0
  48. package/dist/components/fx-gpu.d.ts +63 -0
  49. package/dist/components/fx-gpu.js +6 -0
  50. package/dist/components/fx-gpu.js.map +1 -0
  51. package/dist/components/fx-text.cjs +267 -0
  52. package/dist/components/fx-text.cjs.map +1 -0
  53. package/dist/components/fx-text.d.cts +70 -0
  54. package/dist/components/fx-text.d.ts +70 -0
  55. package/dist/components/fx-text.js +263 -0
  56. package/dist/components/fx-text.js.map +1 -0
  57. package/dist/components/fx.cjs +13 -133
  58. package/dist/components/fx.cjs.map +1 -1
  59. package/dist/components/fx.js +6 -125
  60. package/dist/components/fx.js.map +1 -1
  61. package/dist/components/fx2.cjs +32 -0
  62. package/dist/components/fx2.cjs.map +1 -0
  63. package/dist/components/fx2.d.cts +162 -0
  64. package/dist/components/fx2.d.ts +162 -0
  65. package/dist/components/fx2.js +22 -0
  66. package/dist/components/fx2.js.map +1 -0
  67. package/dist/components/gesture.js +4 -4
  68. package/dist/components/interaction.js +1 -1
  69. package/dist/components/layout.js +1 -1
  70. package/dist/components/lite.cjs +5 -9
  71. package/dist/components/lite.cjs.map +1 -1
  72. package/dist/components/lite.js +5 -9
  73. package/dist/components/lite.js.map +1 -1
  74. package/dist/components/packs.js +1 -1
  75. package/dist/components/page.js +3 -3
  76. package/dist/components/perf.js +2 -2
  77. package/dist/components/physics.js +3 -3
  78. package/dist/components/reveal.js +1 -1
  79. package/dist/components/solid.cjs +1 -0
  80. package/dist/components/solid.cjs.map +1 -1
  81. package/dist/components/solid.js +7 -6
  82. package/dist/components/solid.js.map +1 -1
  83. package/dist/components/svelte.cjs +1 -0
  84. package/dist/components/svelte.cjs.map +1 -1
  85. package/dist/components/svelte.js +7 -6
  86. package/dist/components/svelte.js.map +1 -1
  87. package/dist/components/svg.js +1 -1
  88. package/dist/components/text.js +2 -2
  89. package/dist/components/timeline.js +3 -3
  90. package/dist/components/transitions.js +1 -1
  91. package/dist/components/ui.js +4 -4
  92. package/dist/components/vue.cjs +1 -0
  93. package/dist/components/vue.cjs.map +1 -1
  94. package/dist/components/vue.js +7 -6
  95. package/dist/components/vue.js.map +1 -1
  96. package/dist/components/webgl.js +1 -1
  97. package/dist/components/widgets.cjs +1174 -0
  98. package/dist/components/widgets.cjs.map +1 -0
  99. package/dist/components/widgets.d.cts +206 -0
  100. package/dist/components/widgets.d.ts +206 -0
  101. package/dist/components/widgets.js +1155 -0
  102. package/dist/components/widgets.js.map +1 -0
  103. package/dist/components.cjs +10 -9
  104. package/dist/components.cjs.map +1 -1
  105. package/dist/components.js +10 -9
  106. package/dist/components.js.map +1 -1
  107. package/dist/components.umd.js +2 -2
  108. package/dist/components.umd.js.map +1 -1
  109. package/dist/index.js +2 -2
  110. package/dist/widgets.umd.js +2 -0
  111. package/dist/widgets.umd.js.map +1 -0
  112. package/docs/ROADMAP.md +10 -11
  113. package/docs/components.md +61 -0
  114. package/package.json +41 -1
@@ -0,0 +1,295 @@
1
+ 'use strict';
2
+
3
+ var shared = require('./shared-jkgRH-Hx.cjs');
4
+
5
+ /** Deterministic smooth pseudo-noise in [-1, 1] (sum of sines — cheap, no tables). */
6
+ function noise2(x, y, t = 0) {
7
+ return (Math.sin(x * 1.7 + t) * Math.cos(y * 1.3 - t * 0.7) + Math.sin((x + y) * 0.9 + t * 0.5) * 0.5 + Math.cos(x * 0.6 - y * 1.1 - t * 0.3) * 0.5) / 2;
8
+ }
9
+ /** Hex `#rrggbb` → [r, g, b]. */
10
+ function hexRgb(hex) {
11
+ const m = /^#?([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i.exec(hex.trim());
12
+ return m ? [parseInt(m[1], 16), parseInt(m[2], 16), parseInt(m[3], 16)] : [124, 92, 255];
13
+ }
14
+ /**
15
+ * Mount a generative canvas behind `el` and run `spec` on it. Returns the
16
+ * cleanup. Exposed for custom generative effects.
17
+ */
18
+ function canvasBackground(el, fx, spec, o) {
19
+ const canvas = document.createElement('canvas');
20
+ canvas.setAttribute('aria-hidden', 'true');
21
+ canvas.setAttribute('data-usa-fx-canvas', '');
22
+ canvas.style.cssText = 'position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:-1;border-radius:inherit';
23
+ const restore = [];
24
+ const set = (k, v) => {
25
+ restore.push([k, el.style[k]]);
26
+ el.style[k] = v;
27
+ };
28
+ if (getComputedStyle(el).position === 'static')
29
+ set('position', 'relative');
30
+ set('isolation', 'isolate');
31
+ el.prepend(canvas);
32
+ const ctx = canvas.getContext('2d');
33
+ let raf = 0;
34
+ let visible = true;
35
+ let quality = Math.min(1, Math.max(0.35, Number(o.quality) || 1));
36
+ let w = 0;
37
+ let h = 0;
38
+ let state = null;
39
+ const t0 = performance.now();
40
+ let last = t0;
41
+ let slow = 0;
42
+ let fast = 0;
43
+ const resize = () => {
44
+ const r = el.getBoundingClientRect();
45
+ w = Math.max(1, Math.round(r.width));
46
+ h = Math.max(1, Math.round(r.height));
47
+ const dpr = Math.min(2, (typeof devicePixelRatio === 'number' ? devicePixelRatio : 1) || 1) * quality;
48
+ canvas.width = Math.max(1, Math.round(w * dpr));
49
+ canvas.height = Math.max(1, Math.round(h * dpr));
50
+ if (ctx)
51
+ ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
52
+ state = spec.init ? spec.init(w, h, o) : {};
53
+ };
54
+ const frame = (now) => {
55
+ raf = 0;
56
+ if (!ctx)
57
+ return;
58
+ const dt = now - last;
59
+ last = now;
60
+ // adaptive quality: sustained slow frames lower the render scale, fast ones raise it
61
+ if (dt > 28)
62
+ slow++;
63
+ else if (dt < 18)
64
+ fast++;
65
+ if (slow > 20 && quality > 0.35) {
66
+ quality = Math.max(0.35, quality - 0.15);
67
+ slow = fast = 0;
68
+ resize();
69
+ }
70
+ else if (fast > 240 && quality < 1) {
71
+ quality = Math.min(1, quality + 0.15);
72
+ slow = fast = 0;
73
+ resize();
74
+ }
75
+ spec.draw({ ctx, w, h, t: (now - t0) / 1000, quality, state, o });
76
+ if (visible && !document.hidden)
77
+ raf = requestAnimationFrame(frame);
78
+ };
79
+ const start = () => {
80
+ if (!raf && ctx && !fx.reduced) {
81
+ last = performance.now();
82
+ raf = requestAnimationFrame(frame);
83
+ }
84
+ };
85
+ resize();
86
+ if (ctx)
87
+ spec.draw({ ctx, w, h, t: 0, quality, state, o }); // first / static frame
88
+ const io = typeof IntersectionObserver === 'function' ? new IntersectionObserver((es) => {
89
+ visible = es.some((e) => e.isIntersecting);
90
+ if (visible)
91
+ start();
92
+ }) : null;
93
+ io?.observe(el);
94
+ const ro = typeof ResizeObserver === 'function' ? new ResizeObserver(() => {
95
+ resize();
96
+ if (ctx && fx.reduced)
97
+ spec.draw({ ctx, w, h, t: 0, quality, state, o });
98
+ }) : null;
99
+ ro?.observe(el);
100
+ const vis = () => !document.hidden && visible && start();
101
+ document.addEventListener('visibilitychange', vis);
102
+ start();
103
+ return () => {
104
+ cancelAnimationFrame(raf);
105
+ raf = 0;
106
+ io?.disconnect();
107
+ ro?.disconnect();
108
+ document.removeEventListener('visibilitychange', vis);
109
+ canvas.remove();
110
+ for (const [k, v] of restore)
111
+ el.style[k] = v;
112
+ };
113
+ }
114
+ const gen = (name, description, defaults, spec) => ({
115
+ name,
116
+ kind: 'background',
117
+ description,
118
+ reduced: 'run',
119
+ defaults: { colors: shared.PALETTE, background: '#0b0d12', speed: 1, quality: 1, ...defaults },
120
+ run: (el, o, ctx) => canvasBackground(el, ctx, spec, o),
121
+ });
122
+ /** Low-resolution scalar field → ImageData, drawn scaled up (used by voronoi / metaballs / contours). */
123
+ function field(f, cell, px) {
124
+ const step = Math.max(2, Math.round(cell / f.quality));
125
+ const cw = Math.max(1, Math.ceil(f.w / step));
126
+ const ch = Math.max(1, Math.ceil(f.h / step));
127
+ const st = f.state;
128
+ if (!st.buf || st.buf.width !== cw || st.buf.height !== ch) {
129
+ st.buf = document.createElement('canvas');
130
+ st.buf.width = cw;
131
+ st.buf.height = ch;
132
+ st.bctx = st.buf.getContext('2d');
133
+ st.img = st.bctx?.createImageData(cw, ch);
134
+ }
135
+ if (!st.bctx || !st.img)
136
+ return;
137
+ const d = st.img.data;
138
+ for (let y = 0; y < ch; y++)
139
+ for (let x = 0; x < cw; x++)
140
+ px(x * step, y * step, d, (y * cw + x) * 4);
141
+ st.bctx.putImageData(st.img, 0, 0);
142
+ f.ctx.imageSmoothingEnabled = true;
143
+ f.ctx.drawImage(st.buf, 0, 0, f.w, f.h);
144
+ }
145
+ const GENERATIVE_FX = [
146
+ gen('flow-field', 'Particles drift along a slowly changing flow field, leaving silky trails.', { count: 600, fade: 0.06 }, {
147
+ init: (w, h, o) => ({ p: Array.from({ length: o.count }, () => [Math.random() * w, Math.random() * h]) }),
148
+ draw: ({ ctx, w, h, t, state, o, quality }) => {
149
+ ctx.fillStyle = o.background;
150
+ ctx.globalAlpha = t === 0 ? 1 : o.fade;
151
+ ctx.fillRect(0, 0, w, h);
152
+ ctx.globalAlpha = 0.8;
153
+ const n = Math.round(state.p.length * quality);
154
+ const steps = t === 0 ? 40 : 1;
155
+ for (let i = 0; i < n; i++) {
156
+ const q = state.p[i];
157
+ ctx.fillStyle = o.colors[i % o.colors.length];
158
+ for (let s = 0; s < steps; s++) {
159
+ const a = noise2(q[0] * 0.004, q[1] * 0.004, t * 0.15 * o.speed) * Math.PI * 2;
160
+ q[0] += Math.cos(a) * 1.2 * o.speed;
161
+ q[1] += Math.sin(a) * 1.2 * o.speed;
162
+ if (q[0] < 0 || q[0] > w || q[1] < 0 || q[1] > h)
163
+ (q[0] = Math.random() * w), (q[1] = Math.random() * h);
164
+ ctx.fillRect(q[0], q[1], 1.4, 1.4);
165
+ }
166
+ }
167
+ ctx.globalAlpha = 1;
168
+ },
169
+ }),
170
+ gen('voronoi', 'Drifting Voronoi cells in the palette, with darker borders.', { seeds: 14, cell: 6 }, {
171
+ init: (w, h, o) => ({ s: Array.from({ length: o.seeds }, (_, i) => ({ x: Math.random() * w, y: Math.random() * h, vx: Math.random() - 0.5, vy: Math.random() - 0.5, c: hexRgb(o.colors[i % o.colors.length]) })) }),
172
+ draw: (f) => {
173
+ const { w, h, state, o } = f;
174
+ for (const s of state.s) {
175
+ s.x += s.vx * o.speed;
176
+ s.y += s.vy * o.speed;
177
+ if (s.x < 0 || s.x > w)
178
+ s.vx *= -1;
179
+ if (s.y < 0 || s.y > h)
180
+ s.vy *= -1;
181
+ }
182
+ field(f, o.cell, (x, y, d, i) => {
183
+ let b = Infinity;
184
+ let b2 = Infinity;
185
+ let c = state.s[0].c;
186
+ for (const s of state.s) {
187
+ const dd = (s.x - x) ** 2 + (s.y - y) ** 2;
188
+ if (dd < b)
189
+ (b2 = b), (b = dd), (c = s.c);
190
+ else if (dd < b2)
191
+ b2 = dd;
192
+ }
193
+ const edge = Math.sqrt(b2) - Math.sqrt(b) < 6 ? 0.55 : 1;
194
+ d[i] = c[0] * edge;
195
+ d[i + 1] = c[1] * edge;
196
+ d[i + 2] = c[2] * edge;
197
+ d[i + 3] = 255;
198
+ });
199
+ },
200
+ }),
201
+ gen('mesh-gradient', 'Soft blobs of colour orbit and blend into a living mesh gradient.', { blobs: 4, blur: 0.65 }, {
202
+ draw: ({ ctx, w, h, t, o }) => {
203
+ ctx.fillStyle = o.background;
204
+ ctx.fillRect(0, 0, w, h);
205
+ const r = Math.max(w, h) * o.blur;
206
+ for (let i = 0; i < o.blobs; i++) {
207
+ const a = t * 0.25 * o.speed + (i * Math.PI * 2) / o.blobs;
208
+ const x = w / 2 + Math.cos(a * (1 + i * 0.13)) * w * 0.32;
209
+ const y = h / 2 + Math.sin(a * (0.8 + i * 0.11)) * h * 0.32;
210
+ const [cr, cg, cb] = hexRgb(o.colors[i % o.colors.length]);
211
+ const g = ctx.createRadialGradient(x, y, 0, x, y, r);
212
+ g.addColorStop(0, `rgba(${cr},${cg},${cb},0.7)`);
213
+ g.addColorStop(1, `rgba(${cr},${cg},${cb},0)`);
214
+ ctx.fillStyle = g;
215
+ ctx.fillRect(0, 0, w, h);
216
+ }
217
+ },
218
+ }),
219
+ gen('starfield', 'Stars stream toward the viewer (warp speed with `speed: 4`).', { stars: 400, color: '#ffffff' }, {
220
+ init: (_w, _h, o) => ({ s: Array.from({ length: o.stars }, () => [Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random()]) }),
221
+ draw: ({ ctx, w, h, t, state, o, quality }) => {
222
+ ctx.fillStyle = o.background;
223
+ ctx.fillRect(0, 0, w, h);
224
+ ctx.fillStyle = o.color;
225
+ const n = Math.round(state.s.length * quality);
226
+ for (let i = 0; i < n; i++) {
227
+ const s = state.s[i];
228
+ if (t > 0)
229
+ s[2] -= 0.004 * o.speed;
230
+ if (s[2] <= 0.01)
231
+ (s[0] = Math.random() * 2 - 1), (s[1] = Math.random() * 2 - 1), (s[2] = 1);
232
+ const x = w / 2 + (s[0] / s[2]) * w * 0.5;
233
+ const y = h / 2 + (s[1] / s[2]) * h * 0.5;
234
+ if (x < 0 || x > w || y < 0 || y > h)
235
+ continue;
236
+ const size = (1 - s[2]) * 2.6;
237
+ ctx.globalAlpha = Math.min(1, (1 - s[2]) * 1.6);
238
+ ctx.fillRect(x, y, size, size);
239
+ }
240
+ ctx.globalAlpha = 1;
241
+ },
242
+ }),
243
+ gen('metaballs', 'Gooey blobs that merge and split (low-resolution field, scaled up).', { balls: 6, cell: 5, threshold: 1 }, {
244
+ init: (w, h, o) => ({ b: Array.from({ length: o.balls }, () => ({ x: Math.random() * w, y: Math.random() * h, vx: (Math.random() - 0.5) * 1.6, vy: (Math.random() - 0.5) * 1.6, r: Math.min(w, h) * (0.08 + Math.random() * 0.08) })) }),
245
+ draw: (f) => {
246
+ const { w, h, state, o } = f;
247
+ for (const b of state.b) {
248
+ b.x += b.vx * o.speed;
249
+ b.y += b.vy * o.speed;
250
+ if (b.x < 0 || b.x > w)
251
+ b.vx *= -1;
252
+ if (b.y < 0 || b.y > h)
253
+ b.vy *= -1;
254
+ }
255
+ const [ar, ag, ab] = hexRgb(o.colors[0]);
256
+ const [br, bg, bb] = hexRgb(o.colors[1] || o.colors[0]);
257
+ const [kr, kg, kb] = hexRgb(o.background);
258
+ field(f, o.cell, (x, y, d, i) => {
259
+ let v = 0;
260
+ for (const b of state.b)
261
+ v += (b.r * b.r) / ((b.x - x) ** 2 + (b.y - y) ** 2 + 1);
262
+ const inside = v >= o.threshold;
263
+ const k = Math.min(1, (v - o.threshold) * 0.8);
264
+ d[i] = inside ? ar + (br - ar) * k : kr;
265
+ d[i + 1] = inside ? ag + (bg - ag) * k : kg;
266
+ d[i + 2] = inside ? ab + (bb - ab) * k : kb;
267
+ d[i + 3] = 255;
268
+ });
269
+ },
270
+ }),
271
+ gen('contours', 'Topographic contour lines over a slowly shifting height field.', { levels: 9, cell: 4, color: '#7c5cff' }, {
272
+ draw: (f) => {
273
+ const { t, o } = f;
274
+ const [lr, lg, lb] = hexRgb(o.color);
275
+ const [kr, kg, kb] = hexRgb(o.background);
276
+ const z = (x, y) => (noise2(x * 0.006, y * 0.006, t * 0.2 * o.speed) + 1) / 2;
277
+ const step = Math.max(2, Math.round(o.cell / f.quality));
278
+ field(f, o.cell, (x, y, d, i) => {
279
+ const a = Math.floor(z(x, y) * o.levels);
280
+ const line = a !== Math.floor(z(x + step, y) * o.levels) || a !== Math.floor(z(x, y + step) * o.levels);
281
+ const shade = 0.12 + (a / o.levels) * 0.18;
282
+ d[i] = line ? lr : kr + (lr - kr) * shade;
283
+ d[i + 1] = line ? lg : kg + (lg - kg) * shade;
284
+ d[i + 2] = line ? lb : kb + (lb - kb) * shade;
285
+ d[i + 3] = 255;
286
+ });
287
+ },
288
+ }),
289
+ ];
290
+
291
+ exports.GENERATIVE_FX = GENERATIVE_FX;
292
+ exports.canvasBackground = canvasBackground;
293
+ exports.hexRgb = hexRgb;
294
+ exports.noise2 = noise2;
295
+ //# sourceMappingURL=generative-BHIj-NU0.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generative-BHIj-NU0.cjs","sources":["../../src/components/effects/generative.ts"],"sourcesContent":["/**\n * 5.5 — generative backgrounds on Canvas 2D, registered through\n * `registerEffect()` (kind `background`): `flow-field`, `voronoi`,\n * `mesh-gradient`, `starfield`, `metaballs`, `contours`.\n *\n * Shared runner (`canvasBackground()`): a canvas behind the element's content\n * (`aria-hidden`, pointer-transparent), rendering only while visible\n * (IntersectionObserver) and the tab is shown, with adaptive quality — the\n * render scale drops when frames get slow and recovers when they are fast.\n * Reduced motion: one static frame, no loop.\n */\nimport type { EffectContext, EffectDefinition } from '../fx/registry';\nimport { PALETTE } from './shared';\n\nexport interface GenFrame {\n ctx: CanvasRenderingContext2D;\n /** CSS-pixel size of the canvas. */\n w: number;\n h: number;\n /** Seconds since start (0 for the static reduced-motion frame). */\n t: number;\n /** Render scale 0.35–1 (adaptive quality). */\n quality: number;\n /** Per-effect state, created by `init`. */\n state: any;\n /** Merged options. */\n o: any;\n}\n\nexport interface GenerativeSpec {\n init?: (w: number, h: number, o: any) => any;\n draw: (f: GenFrame) => void;\n}\n\n/** Deterministic smooth pseudo-noise in [-1, 1] (sum of sines — cheap, no tables). */\nexport function noise2(x: number, y: number, t = 0): number {\n return (Math.sin(x * 1.7 + t) * Math.cos(y * 1.3 - t * 0.7) + Math.sin((x + y) * 0.9 + t * 0.5) * 0.5 + Math.cos(x * 0.6 - y * 1.1 - t * 0.3) * 0.5) / 2;\n}\n\n/** Hex `#rrggbb` → [r, g, b]. */\nexport function hexRgb(hex: string): [number, number, number] {\n const m = /^#?([\\da-f]{2})([\\da-f]{2})([\\da-f]{2})$/i.exec(hex.trim());\n return m ? [parseInt(m[1], 16), parseInt(m[2], 16), parseInt(m[3], 16)] : [124, 92, 255];\n}\n\n/**\n * Mount a generative canvas behind `el` and run `spec` on it. Returns the\n * cleanup. Exposed for custom generative effects.\n */\nexport function canvasBackground(el: HTMLElement, fx: EffectContext, spec: GenerativeSpec, o: any): () => void {\n const canvas = document.createElement('canvas');\n canvas.setAttribute('aria-hidden', 'true');\n canvas.setAttribute('data-usa-fx-canvas', '');\n canvas.style.cssText = 'position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:-1;border-radius:inherit';\n const restore: [string, string][] = [];\n const set = (k: 'position' | 'isolation', v: string) => {\n restore.push([k, el.style[k]]);\n el.style[k] = v;\n };\n if (getComputedStyle(el).position === 'static') set('position', 'relative');\n set('isolation', 'isolate');\n el.prepend(canvas);\n const ctx = canvas.getContext('2d');\n let raf = 0;\n let visible = true;\n let quality = Math.min(1, Math.max(0.35, Number(o.quality) || 1));\n let w = 0;\n let h = 0;\n let state: any = null;\n const t0 = performance.now();\n let last = t0;\n let slow = 0;\n let fast = 0;\n const resize = () => {\n const r = el.getBoundingClientRect();\n w = Math.max(1, Math.round(r.width));\n h = Math.max(1, Math.round(r.height));\n const dpr = Math.min(2, (typeof devicePixelRatio === 'number' ? devicePixelRatio : 1) || 1) * quality;\n canvas.width = Math.max(1, Math.round(w * dpr));\n canvas.height = Math.max(1, Math.round(h * dpr));\n if (ctx) ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n state = spec.init ? spec.init(w, h, o) : {};\n };\n const frame = (now: number) => {\n raf = 0;\n if (!ctx) return;\n const dt = now - last;\n last = now;\n // adaptive quality: sustained slow frames lower the render scale, fast ones raise it\n if (dt > 28) slow++;\n else if (dt < 18) fast++;\n if (slow > 20 && quality > 0.35) {\n quality = Math.max(0.35, quality - 0.15);\n slow = fast = 0;\n resize();\n } else if (fast > 240 && quality < 1) {\n quality = Math.min(1, quality + 0.15);\n slow = fast = 0;\n resize();\n }\n spec.draw({ ctx, w, h, t: (now - t0) / 1000, quality, state, o });\n if (visible && !document.hidden) raf = requestAnimationFrame(frame);\n };\n const start = () => {\n if (!raf && ctx && !fx.reduced) {\n last = performance.now();\n raf = requestAnimationFrame(frame);\n }\n };\n resize();\n if (ctx) spec.draw({ ctx, w, h, t: 0, quality, state, o }); // first / static frame\n const io = typeof IntersectionObserver === 'function' ? new IntersectionObserver((es) => {\n visible = es.some((e) => e.isIntersecting);\n if (visible) start();\n }) : null;\n io?.observe(el);\n const ro = typeof ResizeObserver === 'function' ? new ResizeObserver(() => {\n resize();\n if (ctx && fx.reduced) spec.draw({ ctx, w, h, t: 0, quality, state, o });\n }) : null;\n ro?.observe(el);\n const vis = () => !document.hidden && visible && start();\n document.addEventListener('visibilitychange', vis);\n start();\n return () => {\n cancelAnimationFrame(raf);\n raf = 0;\n io?.disconnect();\n ro?.disconnect();\n document.removeEventListener('visibilitychange', vis);\n canvas.remove();\n for (const [k, v] of restore) el.style[k as 'position'] = v;\n };\n}\n\nconst gen = (name: string, description: string, defaults: Record<string, unknown>, spec: GenerativeSpec): EffectDefinition => ({\n name,\n kind: 'background',\n description,\n reduced: 'run',\n defaults: { colors: PALETTE, background: '#0b0d12', speed: 1, quality: 1, ...defaults },\n run: (el, o: any, ctx) => canvasBackground(el, ctx, spec, o),\n});\n\n/** Low-resolution scalar field → ImageData, drawn scaled up (used by voronoi / metaballs / contours). */\nfunction field(f: GenFrame, cell: number, px: (x: number, y: number, out: Uint8ClampedArray, i: number) => void): void {\n const step = Math.max(2, Math.round(cell / f.quality));\n const cw = Math.max(1, Math.ceil(f.w / step));\n const ch = Math.max(1, Math.ceil(f.h / step));\n const st = f.state;\n if (!st.buf || st.buf.width !== cw || st.buf.height !== ch) {\n st.buf = document.createElement('canvas');\n st.buf.width = cw;\n st.buf.height = ch;\n st.bctx = st.buf.getContext('2d');\n st.img = st.bctx?.createImageData(cw, ch);\n }\n if (!st.bctx || !st.img) return;\n const d = st.img.data as Uint8ClampedArray;\n for (let y = 0; y < ch; y++) for (let x = 0; x < cw; x++) px(x * step, y * step, d, (y * cw + x) * 4);\n st.bctx.putImageData(st.img, 0, 0);\n f.ctx.imageSmoothingEnabled = true;\n f.ctx.drawImage(st.buf, 0, 0, f.w, f.h);\n}\n\nexport const GENERATIVE_FX: EffectDefinition[] = [\n gen('flow-field', 'Particles drift along a slowly changing flow field, leaving silky trails.', { count: 600, fade: 0.06 }, {\n init: (w, h, o) => ({ p: Array.from({ length: o.count }, () => [Math.random() * w, Math.random() * h]) }),\n draw: ({ ctx, w, h, t, state, o, quality }) => {\n ctx.fillStyle = o.background;\n ctx.globalAlpha = t === 0 ? 1 : o.fade;\n ctx.fillRect(0, 0, w, h);\n ctx.globalAlpha = 0.8;\n const n = Math.round(state.p.length * quality);\n const steps = t === 0 ? 40 : 1;\n for (let i = 0; i < n; i++) {\n const q = state.p[i];\n ctx.fillStyle = o.colors[i % o.colors.length];\n for (let s = 0; s < steps; s++) {\n const a = noise2(q[0] * 0.004, q[1] * 0.004, t * 0.15 * o.speed) * Math.PI * 2;\n q[0] += Math.cos(a) * 1.2 * o.speed;\n q[1] += Math.sin(a) * 1.2 * o.speed;\n if (q[0] < 0 || q[0] > w || q[1] < 0 || q[1] > h) (q[0] = Math.random() * w), (q[1] = Math.random() * h);\n ctx.fillRect(q[0], q[1], 1.4, 1.4);\n }\n }\n ctx.globalAlpha = 1;\n },\n }),\n gen('voronoi', 'Drifting Voronoi cells in the palette, with darker borders.', { seeds: 14, cell: 6 }, {\n init: (w, h, o) => ({ s: Array.from({ length: o.seeds }, (_, i) => ({ x: Math.random() * w, y: Math.random() * h, vx: Math.random() - 0.5, vy: Math.random() - 0.5, c: hexRgb(o.colors[i % o.colors.length]) })) }),\n draw: (f) => {\n const { w, h, state, o } = f;\n for (const s of state.s) {\n s.x += s.vx * o.speed;\n s.y += s.vy * o.speed;\n if (s.x < 0 || s.x > w) s.vx *= -1;\n if (s.y < 0 || s.y > h) s.vy *= -1;\n }\n field(f, o.cell, (x, y, d, i) => {\n let b = Infinity;\n let b2 = Infinity;\n let c = state.s[0].c;\n for (const s of state.s) {\n const dd = (s.x - x) ** 2 + (s.y - y) ** 2;\n if (dd < b) (b2 = b), (b = dd), (c = s.c);\n else if (dd < b2) b2 = dd;\n }\n const edge = Math.sqrt(b2) - Math.sqrt(b) < 6 ? 0.55 : 1;\n d[i] = c[0] * edge;\n d[i + 1] = c[1] * edge;\n d[i + 2] = c[2] * edge;\n d[i + 3] = 255;\n });\n },\n }),\n gen('mesh-gradient', 'Soft blobs of colour orbit and blend into a living mesh gradient.', { blobs: 4, blur: 0.65 }, {\n draw: ({ ctx, w, h, t, o }) => {\n ctx.fillStyle = o.background;\n ctx.fillRect(0, 0, w, h);\n const r = Math.max(w, h) * o.blur;\n for (let i = 0; i < o.blobs; i++) {\n const a = t * 0.25 * o.speed + (i * Math.PI * 2) / o.blobs;\n const x = w / 2 + Math.cos(a * (1 + i * 0.13)) * w * 0.32;\n const y = h / 2 + Math.sin(a * (0.8 + i * 0.11)) * h * 0.32;\n const [cr, cg, cb] = hexRgb(o.colors[i % o.colors.length]);\n const g = ctx.createRadialGradient(x, y, 0, x, y, r);\n g.addColorStop(0, `rgba(${cr},${cg},${cb},0.7)`);\n g.addColorStop(1, `rgba(${cr},${cg},${cb},0)`);\n ctx.fillStyle = g;\n ctx.fillRect(0, 0, w, h);\n }\n },\n }),\n gen('starfield', 'Stars stream toward the viewer (warp speed with `speed: 4`).', { stars: 400, color: '#ffffff' }, {\n init: (_w, _h, o) => ({ s: Array.from({ length: o.stars }, () => [Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random()]) }),\n draw: ({ ctx, w, h, t, state, o, quality }) => {\n ctx.fillStyle = o.background;\n ctx.fillRect(0, 0, w, h);\n ctx.fillStyle = o.color;\n const n = Math.round(state.s.length * quality);\n for (let i = 0; i < n; i++) {\n const s = state.s[i];\n if (t > 0) s[2] -= 0.004 * o.speed;\n if (s[2] <= 0.01) (s[0] = Math.random() * 2 - 1), (s[1] = Math.random() * 2 - 1), (s[2] = 1);\n const x = w / 2 + (s[0] / s[2]) * w * 0.5;\n const y = h / 2 + (s[1] / s[2]) * h * 0.5;\n if (x < 0 || x > w || y < 0 || y > h) continue;\n const size = (1 - s[2]) * 2.6;\n ctx.globalAlpha = Math.min(1, (1 - s[2]) * 1.6);\n ctx.fillRect(x, y, size, size);\n }\n ctx.globalAlpha = 1;\n },\n }),\n gen('metaballs', 'Gooey blobs that merge and split (low-resolution field, scaled up).', { balls: 6, cell: 5, threshold: 1 }, {\n init: (w, h, o) => ({ b: Array.from({ length: o.balls }, () => ({ x: Math.random() * w, y: Math.random() * h, vx: (Math.random() - 0.5) * 1.6, vy: (Math.random() - 0.5) * 1.6, r: Math.min(w, h) * (0.08 + Math.random() * 0.08) })) }),\n draw: (f) => {\n const { w, h, state, o } = f;\n for (const b of state.b) {\n b.x += b.vx * o.speed;\n b.y += b.vy * o.speed;\n if (b.x < 0 || b.x > w) b.vx *= -1;\n if (b.y < 0 || b.y > h) b.vy *= -1;\n }\n const [ar, ag, ab] = hexRgb(o.colors[0]);\n const [br, bg, bb] = hexRgb(o.colors[1] || o.colors[0]);\n const [kr, kg, kb] = hexRgb(o.background);\n field(f, o.cell, (x, y, d, i) => {\n let v = 0;\n for (const b of state.b) v += (b.r * b.r) / ((b.x - x) ** 2 + (b.y - y) ** 2 + 1);\n const inside = v >= o.threshold;\n const k = Math.min(1, (v - o.threshold) * 0.8);\n d[i] = inside ? ar + (br - ar) * k : kr;\n d[i + 1] = inside ? ag + (bg - ag) * k : kg;\n d[i + 2] = inside ? ab + (bb - ab) * k : kb;\n d[i + 3] = 255;\n });\n },\n }),\n gen('contours', 'Topographic contour lines over a slowly shifting height field.', { levels: 9, cell: 4, color: '#7c5cff' }, {\n draw: (f) => {\n const { t, o } = f;\n const [lr, lg, lb] = hexRgb(o.color);\n const [kr, kg, kb] = hexRgb(o.background);\n const z = (x: number, y: number) => (noise2(x * 0.006, y * 0.006, t * 0.2 * o.speed) + 1) / 2;\n const step = Math.max(2, Math.round(o.cell / f.quality));\n field(f, o.cell, (x, y, d, i) => {\n const a = Math.floor(z(x, y) * o.levels);\n const line = a !== Math.floor(z(x + step, y) * o.levels) || a !== Math.floor(z(x, y + step) * o.levels);\n const shade = 0.12 + (a / o.levels) * 0.18;\n d[i] = line ? lr : kr + (lr - kr) * shade;\n d[i + 1] = line ? lg : kg + (lg - kg) * shade;\n d[i + 2] = line ? lb : kb + (lb - kb) * shade;\n d[i + 3] = 255;\n });\n },\n }),\n];\n"],"names":["PALETTE"],"mappings":";;;;AAkCA;AACM,SAAU,MAAM,CAAC,CAAS,EAAE,CAAS,EAAE,CAAC,GAAG,CAAC,EAAA;AAChD,IAAA,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC;AAC1J;AAEA;AACM,SAAU,MAAM,CAAC,GA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C,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;AACxC,gBAAA,MAAM,IAAI,GAAG,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;AACvG,gBAAA,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,IAAI,IAAI;gBAC1C,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,KAAK;gBACzC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,KAAK;gBAC7C,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,KAAK;AAC7C,gBAAA,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG;AAChB,YAAA,CAAC,CAAC;QACJ,CAAC;KACF,CAAC;;;;;;;;"}
@@ -0,0 +1,290 @@
1
+ import { P as PALETTE } from './shared-eweTlzxv.js';
2
+
3
+ /** Deterministic smooth pseudo-noise in [-1, 1] (sum of sines — cheap, no tables). */
4
+ function noise2(x, y, t = 0) {
5
+ return (Math.sin(x * 1.7 + t) * Math.cos(y * 1.3 - t * 0.7) + Math.sin((x + y) * 0.9 + t * 0.5) * 0.5 + Math.cos(x * 0.6 - y * 1.1 - t * 0.3) * 0.5) / 2;
6
+ }
7
+ /** Hex `#rrggbb` → [r, g, b]. */
8
+ function hexRgb(hex) {
9
+ const m = /^#?([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i.exec(hex.trim());
10
+ return m ? [parseInt(m[1], 16), parseInt(m[2], 16), parseInt(m[3], 16)] : [124, 92, 255];
11
+ }
12
+ /**
13
+ * Mount a generative canvas behind `el` and run `spec` on it. Returns the
14
+ * cleanup. Exposed for custom generative effects.
15
+ */
16
+ function canvasBackground(el, fx, spec, o) {
17
+ const canvas = document.createElement('canvas');
18
+ canvas.setAttribute('aria-hidden', 'true');
19
+ canvas.setAttribute('data-usa-fx-canvas', '');
20
+ canvas.style.cssText = 'position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:-1;border-radius:inherit';
21
+ const restore = [];
22
+ const set = (k, v) => {
23
+ restore.push([k, el.style[k]]);
24
+ el.style[k] = v;
25
+ };
26
+ if (getComputedStyle(el).position === 'static')
27
+ set('position', 'relative');
28
+ set('isolation', 'isolate');
29
+ el.prepend(canvas);
30
+ const ctx = canvas.getContext('2d');
31
+ let raf = 0;
32
+ let visible = true;
33
+ let quality = Math.min(1, Math.max(0.35, Number(o.quality) || 1));
34
+ let w = 0;
35
+ let h = 0;
36
+ let state = null;
37
+ const t0 = performance.now();
38
+ let last = t0;
39
+ let slow = 0;
40
+ let fast = 0;
41
+ const resize = () => {
42
+ const r = el.getBoundingClientRect();
43
+ w = Math.max(1, Math.round(r.width));
44
+ h = Math.max(1, Math.round(r.height));
45
+ const dpr = Math.min(2, (typeof devicePixelRatio === 'number' ? devicePixelRatio : 1) || 1) * quality;
46
+ canvas.width = Math.max(1, Math.round(w * dpr));
47
+ canvas.height = Math.max(1, Math.round(h * dpr));
48
+ if (ctx)
49
+ ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
50
+ state = spec.init ? spec.init(w, h, o) : {};
51
+ };
52
+ const frame = (now) => {
53
+ raf = 0;
54
+ if (!ctx)
55
+ return;
56
+ const dt = now - last;
57
+ last = now;
58
+ // adaptive quality: sustained slow frames lower the render scale, fast ones raise it
59
+ if (dt > 28)
60
+ slow++;
61
+ else if (dt < 18)
62
+ fast++;
63
+ if (slow > 20 && quality > 0.35) {
64
+ quality = Math.max(0.35, quality - 0.15);
65
+ slow = fast = 0;
66
+ resize();
67
+ }
68
+ else if (fast > 240 && quality < 1) {
69
+ quality = Math.min(1, quality + 0.15);
70
+ slow = fast = 0;
71
+ resize();
72
+ }
73
+ spec.draw({ ctx, w, h, t: (now - t0) / 1000, quality, state, o });
74
+ if (visible && !document.hidden)
75
+ raf = requestAnimationFrame(frame);
76
+ };
77
+ const start = () => {
78
+ if (!raf && ctx && !fx.reduced) {
79
+ last = performance.now();
80
+ raf = requestAnimationFrame(frame);
81
+ }
82
+ };
83
+ resize();
84
+ if (ctx)
85
+ spec.draw({ ctx, w, h, t: 0, quality, state, o }); // first / static frame
86
+ const io = typeof IntersectionObserver === 'function' ? new IntersectionObserver((es) => {
87
+ visible = es.some((e) => e.isIntersecting);
88
+ if (visible)
89
+ start();
90
+ }) : null;
91
+ io?.observe(el);
92
+ const ro = typeof ResizeObserver === 'function' ? new ResizeObserver(() => {
93
+ resize();
94
+ if (ctx && fx.reduced)
95
+ spec.draw({ ctx, w, h, t: 0, quality, state, o });
96
+ }) : null;
97
+ ro?.observe(el);
98
+ const vis = () => !document.hidden && visible && start();
99
+ document.addEventListener('visibilitychange', vis);
100
+ start();
101
+ return () => {
102
+ cancelAnimationFrame(raf);
103
+ raf = 0;
104
+ io?.disconnect();
105
+ ro?.disconnect();
106
+ document.removeEventListener('visibilitychange', vis);
107
+ canvas.remove();
108
+ for (const [k, v] of restore)
109
+ el.style[k] = v;
110
+ };
111
+ }
112
+ const gen = (name, description, defaults, spec) => ({
113
+ name,
114
+ kind: 'background',
115
+ description,
116
+ reduced: 'run',
117
+ defaults: { colors: PALETTE, background: '#0b0d12', speed: 1, quality: 1, ...defaults },
118
+ run: (el, o, ctx) => canvasBackground(el, ctx, spec, o),
119
+ });
120
+ /** Low-resolution scalar field → ImageData, drawn scaled up (used by voronoi / metaballs / contours). */
121
+ function field(f, cell, px) {
122
+ const step = Math.max(2, Math.round(cell / f.quality));
123
+ const cw = Math.max(1, Math.ceil(f.w / step));
124
+ const ch = Math.max(1, Math.ceil(f.h / step));
125
+ const st = f.state;
126
+ if (!st.buf || st.buf.width !== cw || st.buf.height !== ch) {
127
+ st.buf = document.createElement('canvas');
128
+ st.buf.width = cw;
129
+ st.buf.height = ch;
130
+ st.bctx = st.buf.getContext('2d');
131
+ st.img = st.bctx?.createImageData(cw, ch);
132
+ }
133
+ if (!st.bctx || !st.img)
134
+ return;
135
+ const d = st.img.data;
136
+ for (let y = 0; y < ch; y++)
137
+ for (let x = 0; x < cw; x++)
138
+ px(x * step, y * step, d, (y * cw + x) * 4);
139
+ st.bctx.putImageData(st.img, 0, 0);
140
+ f.ctx.imageSmoothingEnabled = true;
141
+ f.ctx.drawImage(st.buf, 0, 0, f.w, f.h);
142
+ }
143
+ const GENERATIVE_FX = [
144
+ gen('flow-field', 'Particles drift along a slowly changing flow field, leaving silky trails.', { count: 600, fade: 0.06 }, {
145
+ init: (w, h, o) => ({ p: Array.from({ length: o.count }, () => [Math.random() * w, Math.random() * h]) }),
146
+ draw: ({ ctx, w, h, t, state, o, quality }) => {
147
+ ctx.fillStyle = o.background;
148
+ ctx.globalAlpha = t === 0 ? 1 : o.fade;
149
+ ctx.fillRect(0, 0, w, h);
150
+ ctx.globalAlpha = 0.8;
151
+ const n = Math.round(state.p.length * quality);
152
+ const steps = t === 0 ? 40 : 1;
153
+ for (let i = 0; i < n; i++) {
154
+ const q = state.p[i];
155
+ ctx.fillStyle = o.colors[i % o.colors.length];
156
+ for (let s = 0; s < steps; s++) {
157
+ const a = noise2(q[0] * 0.004, q[1] * 0.004, t * 0.15 * o.speed) * Math.PI * 2;
158
+ q[0] += Math.cos(a) * 1.2 * o.speed;
159
+ q[1] += Math.sin(a) * 1.2 * o.speed;
160
+ if (q[0] < 0 || q[0] > w || q[1] < 0 || q[1] > h)
161
+ (q[0] = Math.random() * w), (q[1] = Math.random() * h);
162
+ ctx.fillRect(q[0], q[1], 1.4, 1.4);
163
+ }
164
+ }
165
+ ctx.globalAlpha = 1;
166
+ },
167
+ }),
168
+ gen('voronoi', 'Drifting Voronoi cells in the palette, with darker borders.', { seeds: 14, cell: 6 }, {
169
+ init: (w, h, o) => ({ s: Array.from({ length: o.seeds }, (_, i) => ({ x: Math.random() * w, y: Math.random() * h, vx: Math.random() - 0.5, vy: Math.random() - 0.5, c: hexRgb(o.colors[i % o.colors.length]) })) }),
170
+ draw: (f) => {
171
+ const { w, h, state, o } = f;
172
+ for (const s of state.s) {
173
+ s.x += s.vx * o.speed;
174
+ s.y += s.vy * o.speed;
175
+ if (s.x < 0 || s.x > w)
176
+ s.vx *= -1;
177
+ if (s.y < 0 || s.y > h)
178
+ s.vy *= -1;
179
+ }
180
+ field(f, o.cell, (x, y, d, i) => {
181
+ let b = Infinity;
182
+ let b2 = Infinity;
183
+ let c = state.s[0].c;
184
+ for (const s of state.s) {
185
+ const dd = (s.x - x) ** 2 + (s.y - y) ** 2;
186
+ if (dd < b)
187
+ (b2 = b), (b = dd), (c = s.c);
188
+ else if (dd < b2)
189
+ b2 = dd;
190
+ }
191
+ const edge = Math.sqrt(b2) - Math.sqrt(b) < 6 ? 0.55 : 1;
192
+ d[i] = c[0] * edge;
193
+ d[i + 1] = c[1] * edge;
194
+ d[i + 2] = c[2] * edge;
195
+ d[i + 3] = 255;
196
+ });
197
+ },
198
+ }),
199
+ gen('mesh-gradient', 'Soft blobs of colour orbit and blend into a living mesh gradient.', { blobs: 4, blur: 0.65 }, {
200
+ draw: ({ ctx, w, h, t, o }) => {
201
+ ctx.fillStyle = o.background;
202
+ ctx.fillRect(0, 0, w, h);
203
+ const r = Math.max(w, h) * o.blur;
204
+ for (let i = 0; i < o.blobs; i++) {
205
+ const a = t * 0.25 * o.speed + (i * Math.PI * 2) / o.blobs;
206
+ const x = w / 2 + Math.cos(a * (1 + i * 0.13)) * w * 0.32;
207
+ const y = h / 2 + Math.sin(a * (0.8 + i * 0.11)) * h * 0.32;
208
+ const [cr, cg, cb] = hexRgb(o.colors[i % o.colors.length]);
209
+ const g = ctx.createRadialGradient(x, y, 0, x, y, r);
210
+ g.addColorStop(0, `rgba(${cr},${cg},${cb},0.7)`);
211
+ g.addColorStop(1, `rgba(${cr},${cg},${cb},0)`);
212
+ ctx.fillStyle = g;
213
+ ctx.fillRect(0, 0, w, h);
214
+ }
215
+ },
216
+ }),
217
+ gen('starfield', 'Stars stream toward the viewer (warp speed with `speed: 4`).', { stars: 400, color: '#ffffff' }, {
218
+ init: (_w, _h, o) => ({ s: Array.from({ length: o.stars }, () => [Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random()]) }),
219
+ draw: ({ ctx, w, h, t, state, o, quality }) => {
220
+ ctx.fillStyle = o.background;
221
+ ctx.fillRect(0, 0, w, h);
222
+ ctx.fillStyle = o.color;
223
+ const n = Math.round(state.s.length * quality);
224
+ for (let i = 0; i < n; i++) {
225
+ const s = state.s[i];
226
+ if (t > 0)
227
+ s[2] -= 0.004 * o.speed;
228
+ if (s[2] <= 0.01)
229
+ (s[0] = Math.random() * 2 - 1), (s[1] = Math.random() * 2 - 1), (s[2] = 1);
230
+ const x = w / 2 + (s[0] / s[2]) * w * 0.5;
231
+ const y = h / 2 + (s[1] / s[2]) * h * 0.5;
232
+ if (x < 0 || x > w || y < 0 || y > h)
233
+ continue;
234
+ const size = (1 - s[2]) * 2.6;
235
+ ctx.globalAlpha = Math.min(1, (1 - s[2]) * 1.6);
236
+ ctx.fillRect(x, y, size, size);
237
+ }
238
+ ctx.globalAlpha = 1;
239
+ },
240
+ }),
241
+ gen('metaballs', 'Gooey blobs that merge and split (low-resolution field, scaled up).', { balls: 6, cell: 5, threshold: 1 }, {
242
+ init: (w, h, o) => ({ b: Array.from({ length: o.balls }, () => ({ x: Math.random() * w, y: Math.random() * h, vx: (Math.random() - 0.5) * 1.6, vy: (Math.random() - 0.5) * 1.6, r: Math.min(w, h) * (0.08 + Math.random() * 0.08) })) }),
243
+ draw: (f) => {
244
+ const { w, h, state, o } = f;
245
+ for (const b of state.b) {
246
+ b.x += b.vx * o.speed;
247
+ b.y += b.vy * o.speed;
248
+ if (b.x < 0 || b.x > w)
249
+ b.vx *= -1;
250
+ if (b.y < 0 || b.y > h)
251
+ b.vy *= -1;
252
+ }
253
+ const [ar, ag, ab] = hexRgb(o.colors[0]);
254
+ const [br, bg, bb] = hexRgb(o.colors[1] || o.colors[0]);
255
+ const [kr, kg, kb] = hexRgb(o.background);
256
+ field(f, o.cell, (x, y, d, i) => {
257
+ let v = 0;
258
+ for (const b of state.b)
259
+ v += (b.r * b.r) / ((b.x - x) ** 2 + (b.y - y) ** 2 + 1);
260
+ const inside = v >= o.threshold;
261
+ const k = Math.min(1, (v - o.threshold) * 0.8);
262
+ d[i] = inside ? ar + (br - ar) * k : kr;
263
+ d[i + 1] = inside ? ag + (bg - ag) * k : kg;
264
+ d[i + 2] = inside ? ab + (bb - ab) * k : kb;
265
+ d[i + 3] = 255;
266
+ });
267
+ },
268
+ }),
269
+ gen('contours', 'Topographic contour lines over a slowly shifting height field.', { levels: 9, cell: 4, color: '#7c5cff' }, {
270
+ draw: (f) => {
271
+ const { t, o } = f;
272
+ const [lr, lg, lb] = hexRgb(o.color);
273
+ const [kr, kg, kb] = hexRgb(o.background);
274
+ const z = (x, y) => (noise2(x * 0.006, y * 0.006, t * 0.2 * o.speed) + 1) / 2;
275
+ const step = Math.max(2, Math.round(o.cell / f.quality));
276
+ field(f, o.cell, (x, y, d, i) => {
277
+ const a = Math.floor(z(x, y) * o.levels);
278
+ const line = a !== Math.floor(z(x + step, y) * o.levels) || a !== Math.floor(z(x, y + step) * o.levels);
279
+ const shade = 0.12 + (a / o.levels) * 0.18;
280
+ d[i] = line ? lr : kr + (lr - kr) * shade;
281
+ d[i + 1] = line ? lg : kg + (lg - kg) * shade;
282
+ d[i + 2] = line ? lb : kb + (lb - kb) * shade;
283
+ d[i + 3] = 255;
284
+ });
285
+ },
286
+ }),
287
+ ];
288
+
289
+ export { GENERATIVE_FX as G, canvasBackground as c, hexRgb as h, noise2 as n };
290
+ //# sourceMappingURL=generative-BRUZaIsX.js.map