@iamahmarfaraz/react-liquid-bg 1.0.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.
@@ -0,0 +1,1560 @@
1
+ import fe, { useRef as ie, useEffect as ce } from "react";
2
+ var ee = { exports: {} }, O = {};
3
+ var oe;
4
+ function ve() {
5
+ if (oe) return O;
6
+ oe = 1;
7
+ var f = /* @__PURE__ */ Symbol.for("react.transitional.element"), e = /* @__PURE__ */ Symbol.for("react.fragment");
8
+ function r(i, v, n) {
9
+ var x = null;
10
+ if (n !== void 0 && (x = "" + n), v.key !== void 0 && (x = "" + v.key), "key" in v) {
11
+ n = {};
12
+ for (var P in v)
13
+ P !== "key" && (n[P] = v[P]);
14
+ } else n = v;
15
+ return v = n.ref, {
16
+ $$typeof: f,
17
+ type: i,
18
+ key: x,
19
+ ref: v !== void 0 ? v : null,
20
+ props: n
21
+ };
22
+ }
23
+ return O.Fragment = e, O.jsx = r, O.jsxs = r, O;
24
+ }
25
+ var K = {};
26
+ var ae;
27
+ function de() {
28
+ return ae || (ae = 1, process.env.NODE_ENV !== "production" && (function() {
29
+ function f(t) {
30
+ if (t == null) return null;
31
+ if (typeof t == "function")
32
+ return t.$$typeof === w ? null : t.displayName || t.name || null;
33
+ if (typeof t == "string") return t;
34
+ switch (t) {
35
+ case S:
36
+ return "Fragment";
37
+ case E:
38
+ return "Profiler";
39
+ case D:
40
+ return "StrictMode";
41
+ case C:
42
+ return "Suspense";
43
+ case b:
44
+ return "SuspenseList";
45
+ case q:
46
+ return "Activity";
47
+ }
48
+ if (typeof t == "object")
49
+ switch (typeof t.tag == "number" && console.error(
50
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
51
+ ), t.$$typeof) {
52
+ case N:
53
+ return "Portal";
54
+ case Z:
55
+ return t.displayName || "Context";
56
+ case B:
57
+ return (t._context.displayName || "Context") + ".Consumer";
58
+ case A:
59
+ var m = t.render;
60
+ return t = t.displayName, t || (t = m.displayName || m.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
61
+ case j:
62
+ return m = t.displayName || null, m !== null ? m : f(t.type) || "Memo";
63
+ case X:
64
+ m = t._payload, t = t._init;
65
+ try {
66
+ return f(t(m));
67
+ } catch {
68
+ }
69
+ }
70
+ return null;
71
+ }
72
+ function e(t) {
73
+ return "" + t;
74
+ }
75
+ function r(t) {
76
+ try {
77
+ e(t);
78
+ var m = !1;
79
+ } catch {
80
+ m = !0;
81
+ }
82
+ if (m) {
83
+ m = console;
84
+ var o = m.error, a = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
85
+ return o.call(
86
+ m,
87
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
88
+ a
89
+ ), e(t);
90
+ }
91
+ }
92
+ function i(t) {
93
+ if (t === S) return "<>";
94
+ if (typeof t == "object" && t !== null && t.$$typeof === X)
95
+ return "<...>";
96
+ try {
97
+ var m = f(t);
98
+ return m ? "<" + m + ">" : "<...>";
99
+ } catch {
100
+ return "<...>";
101
+ }
102
+ }
103
+ function v() {
104
+ var t = Y.A;
105
+ return t === null ? null : t.getOwner();
106
+ }
107
+ function n() {
108
+ return Error("react-stack-top-frame");
109
+ }
110
+ function x(t) {
111
+ if ($.call(t, "key")) {
112
+ var m = Object.getOwnPropertyDescriptor(t, "key").get;
113
+ if (m && m.isReactWarning) return !1;
114
+ }
115
+ return t.key !== void 0;
116
+ }
117
+ function P(t, m) {
118
+ function o() {
119
+ H || (H = !0, console.error(
120
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
121
+ m
122
+ ));
123
+ }
124
+ o.isReactWarning = !0, Object.defineProperty(t, "key", {
125
+ get: o,
126
+ configurable: !0
127
+ });
128
+ }
129
+ function k() {
130
+ var t = f(this.type);
131
+ return V[t] || (V[t] = !0, console.error(
132
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
133
+ )), t = this.props.ref, t !== void 0 ? t : null;
134
+ }
135
+ function c(t, m, o, a, u, s) {
136
+ var l = o.ref;
137
+ return t = {
138
+ $$typeof: F,
139
+ type: t,
140
+ key: m,
141
+ props: o,
142
+ _owner: a
143
+ }, (l !== void 0 ? l : null) !== null ? Object.defineProperty(t, "ref", {
144
+ enumerable: !1,
145
+ get: k
146
+ }) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
147
+ configurable: !1,
148
+ enumerable: !1,
149
+ writable: !0,
150
+ value: 0
151
+ }), Object.defineProperty(t, "_debugInfo", {
152
+ configurable: !1,
153
+ enumerable: !1,
154
+ writable: !0,
155
+ value: null
156
+ }), Object.defineProperty(t, "_debugStack", {
157
+ configurable: !1,
158
+ enumerable: !1,
159
+ writable: !0,
160
+ value: u
161
+ }), Object.defineProperty(t, "_debugTask", {
162
+ configurable: !1,
163
+ enumerable: !1,
164
+ writable: !0,
165
+ value: s
166
+ }), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
167
+ }
168
+ function U(t, m, o, a, u, s) {
169
+ var l = m.children;
170
+ if (l !== void 0)
171
+ if (a)
172
+ if (re(l)) {
173
+ for (a = 0; a < l.length; a++)
174
+ J(l[a]);
175
+ Object.freeze && Object.freeze(l);
176
+ } else
177
+ console.error(
178
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
179
+ );
180
+ else J(l);
181
+ if ($.call(m, "key")) {
182
+ l = f(t);
183
+ var g = Object.keys(m).filter(function(T) {
184
+ return T !== "key";
185
+ });
186
+ a = 0 < g.length ? "{key: someKey, " + g.join(": ..., ") + ": ...}" : "{key: someKey}", G[l + a] || (g = 0 < g.length ? "{" + g.join(": ..., ") + ": ...}" : "{}", console.error(
187
+ `A props object containing a "key" prop is being spread into JSX:
188
+ let props = %s;
189
+ <%s {...props} />
190
+ React keys must be passed directly to JSX without using spread:
191
+ let props = %s;
192
+ <%s key={someKey} {...props} />`,
193
+ a,
194
+ l,
195
+ g,
196
+ l
197
+ ), G[l + a] = !0);
198
+ }
199
+ if (l = null, o !== void 0 && (r(o), l = "" + o), x(m) && (r(m.key), l = "" + m.key), "key" in m) {
200
+ o = {};
201
+ for (var p in m)
202
+ p !== "key" && (o[p] = m[p]);
203
+ } else o = m;
204
+ return l && P(
205
+ o,
206
+ typeof t == "function" ? t.displayName || t.name || "Unknown" : t
207
+ ), c(
208
+ t,
209
+ l,
210
+ o,
211
+ v(),
212
+ u,
213
+ s
214
+ );
215
+ }
216
+ function J(t) {
217
+ y(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === X && (t._payload.status === "fulfilled" ? y(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
218
+ }
219
+ function y(t) {
220
+ return typeof t == "object" && t !== null && t.$$typeof === F;
221
+ }
222
+ var d = fe, F = /* @__PURE__ */ Symbol.for("react.transitional.element"), N = /* @__PURE__ */ Symbol.for("react.portal"), S = /* @__PURE__ */ Symbol.for("react.fragment"), D = /* @__PURE__ */ Symbol.for("react.strict_mode"), E = /* @__PURE__ */ Symbol.for("react.profiler"), B = /* @__PURE__ */ Symbol.for("react.consumer"), Z = /* @__PURE__ */ Symbol.for("react.context"), A = /* @__PURE__ */ Symbol.for("react.forward_ref"), C = /* @__PURE__ */ Symbol.for("react.suspense"), b = /* @__PURE__ */ Symbol.for("react.suspense_list"), j = /* @__PURE__ */ Symbol.for("react.memo"), X = /* @__PURE__ */ Symbol.for("react.lazy"), q = /* @__PURE__ */ Symbol.for("react.activity"), w = /* @__PURE__ */ Symbol.for("react.client.reference"), Y = d.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, $ = Object.prototype.hasOwnProperty, re = Array.isArray, M = console.createTask ? console.createTask : function() {
223
+ return null;
224
+ };
225
+ d = {
226
+ react_stack_bottom_frame: function(t) {
227
+ return t();
228
+ }
229
+ };
230
+ var H, V = {}, L = d.react_stack_bottom_frame.bind(
231
+ d,
232
+ n
233
+ )(), W = M(i(n)), G = {};
234
+ K.Fragment = S, K.jsx = function(t, m, o) {
235
+ var a = 1e4 > Y.recentlyCreatedOwnerStacks++;
236
+ return U(
237
+ t,
238
+ m,
239
+ o,
240
+ !1,
241
+ a ? Error("react-stack-top-frame") : L,
242
+ a ? M(i(t)) : W
243
+ );
244
+ }, K.jsxs = function(t, m, o) {
245
+ var a = 1e4 > Y.recentlyCreatedOwnerStacks++;
246
+ return U(
247
+ t,
248
+ m,
249
+ o,
250
+ !0,
251
+ a ? Error("react-stack-top-frame") : L,
252
+ a ? M(i(t)) : W
253
+ );
254
+ };
255
+ })()), K;
256
+ }
257
+ var ne;
258
+ function ge() {
259
+ return ne || (ne = 1, process.env.NODE_ENV === "production" ? ee.exports = ve() : ee.exports = de()), ee.exports;
260
+ }
261
+ var he = ge();
262
+ let Q = {
263
+ sim_resolution: 128,
264
+ dye_resolution: 512,
265
+ paused: !1,
266
+ clamp_values: !0,
267
+ embedded_dither: !0,
268
+ /* Fluid Dissipation Behaviors*/
269
+ dissipation: 0.985,
270
+ velocity: 0.995,
271
+ pressure: 0.8,
272
+ pressure_iteration: 20,
273
+ /* Fluid Color */
274
+ fluid_color: [
275
+ [0, 0, 0],
276
+ [0.4, 0.2, 0]
277
+ ],
278
+ /* Characteristics */
279
+ curl: 15,
280
+ emitter_size: 0.6,
281
+ render_shaders: !0,
282
+ multi_color: !0,
283
+ /* Bloom */
284
+ render_bloom: !1,
285
+ bloom_iterations: 8,
286
+ bloom_resolution: 256,
287
+ intensity: 0.8,
288
+ threshold: 0.6,
289
+ soft_knee: 0.7,
290
+ // bloom_resolution: 256*4,
291
+ // bloom_iterations: 1,
292
+ // intensity: 0.6,
293
+ // threshold: 0.3,
294
+ // soft_knee: 1.0,
295
+ /* Background */
296
+ background_color: { r: 15, g: 15, b: 15 },
297
+ transparent: !0
298
+ };
299
+ const te = {
300
+ alpha: !0,
301
+ depth: !1,
302
+ stencil: !1,
303
+ antialias: !1,
304
+ preserveDrawingBuffer: !1,
305
+ powerPreference: "default"
306
+ }, _ = {
307
+ vertex: `
308
+ precision highp float;
309
+
310
+ attribute vec2 aPosition;
311
+ varying vec2 vUv;
312
+ varying vec2 vL;
313
+ varying vec2 vR;
314
+ varying vec2 vT;
315
+ varying vec2 vB;
316
+ uniform vec2 texelSize;
317
+
318
+ void main () {
319
+ vUv = aPosition * 0.5 + 0.5;
320
+ vL = vUv - vec2(texelSize.x, 0.0);
321
+ vR = vUv + vec2(texelSize.x, 0.0);
322
+ vT = vUv + vec2(0.0, texelSize.y);
323
+ vB = vUv - vec2(0.0, texelSize.y);
324
+ gl_Position = vec4(aPosition, 0.0, 1.0);
325
+ }`,
326
+ clear: `
327
+ precision mediump float;
328
+ precision mediump sampler2D;
329
+
330
+ varying highp vec2 vUv;
331
+ uniform sampler2D uTexture;
332
+ uniform float value;
333
+
334
+ void main () {
335
+ gl_FragColor = value * texture2D(uTexture, vUv);
336
+ }
337
+ `,
338
+ color: `
339
+ precision mediump float;
340
+
341
+ uniform vec4 color;
342
+
343
+ void main () {
344
+ gl_FragColor = color;
345
+ }
346
+ `,
347
+ background: `
348
+ void main() {
349
+ gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
350
+ }
351
+ `,
352
+ display: `
353
+ precision highp float;
354
+ precision highp sampler2D;
355
+
356
+ varying vec2 vUv;
357
+ uniform sampler2D uTexture;
358
+
359
+ void main () {
360
+ vec3 C = texture2D(uTexture, vUv).rgb;
361
+ float a = max(C.r, max(C.g, C.b));
362
+ gl_FragColor = vec4(C, a);
363
+ }
364
+ `,
365
+ displayBloom: `
366
+ precision highp float;
367
+ precision highp sampler2D;
368
+
369
+ varying vec2 vUv;
370
+ uniform sampler2D uTexture;
371
+ uniform sampler2D uBloom;
372
+ uniform sampler2D uDithering;
373
+ uniform vec2 ditherScale;
374
+
375
+ void main () {
376
+ vec3 C = texture2D(uTexture, vUv).rgb;
377
+ vec3 bloom = texture2D(uBloom, vUv).rgb;
378
+ vec3 noise = texture2D(uDithering, vUv * ditherScale).rgb;
379
+ noise = noise * 2.0 - 1.0;
380
+ bloom += noise / 800.0;
381
+ bloom = pow(bloom.rgb, vec3(1.0 / 2.2));
382
+ C += bloom;
383
+ float a = max(C.r, max(C.g, C.b));
384
+ gl_FragColor = vec4(C, a);
385
+ }
386
+ `,
387
+ displayShading: `
388
+ precision highp float;
389
+ precision highp sampler2D;
390
+
391
+ varying vec2 vUv;
392
+ varying vec2 vL;
393
+ varying vec2 vR;
394
+ varying vec2 vT;
395
+ varying vec2 vB;
396
+ uniform sampler2D uTexture;
397
+ uniform vec2 texelSize;
398
+
399
+ void main () {
400
+ vec3 L = texture2D(uTexture, vL).rgb;
401
+ vec3 R = texture2D(uTexture, vR).rgb;
402
+ vec3 T = texture2D(uTexture, vT).rgb;
403
+ vec3 B = texture2D(uTexture, vB).rgb;
404
+ vec3 C = texture2D(uTexture, vUv).rgb;
405
+
406
+ float dx = length(R) - length(L);
407
+ float dy = length(T) - length(B);
408
+
409
+ vec3 n = normalize(vec3(dx, dy, length(texelSize)));
410
+ vec3 l = vec3(0.0, 0.0, 1.0);
411
+
412
+ float diffuse = clamp(dot(n, l) + 0.7, 0.7, 1.0);
413
+ C.rgb *= diffuse;
414
+
415
+ float a = max(C.r, max(C.g, C.b));
416
+ gl_FragColor = vec4(C, a);
417
+ }
418
+ `,
419
+ displayBloomShading: `
420
+ precision highp float;
421
+ precision highp sampler2D;
422
+
423
+ varying vec2 vUv;
424
+ varying vec2 vL;
425
+ varying vec2 vR;
426
+ varying vec2 vT;
427
+ varying vec2 vB;
428
+ uniform sampler2D uTexture;
429
+ uniform sampler2D uBloom;
430
+ uniform sampler2D uDithering;
431
+ uniform vec2 ditherScale;
432
+ uniform vec2 texelSize;
433
+
434
+ void main () {
435
+ vec3 L = texture2D(uTexture, vL).rgb;
436
+ vec3 R = texture2D(uTexture, vR).rgb;
437
+ vec3 T = texture2D(uTexture, vT).rgb;
438
+ vec3 B = texture2D(uTexture, vB).rgb;
439
+ vec3 C = texture2D(uTexture, vUv).rgb;
440
+
441
+ float dx = length(R) - length(L);
442
+ float dy = length(T) - length(B);
443
+
444
+ vec3 n = normalize(vec3(dx, dy, length(texelSize)));
445
+ vec3 l = vec3(0.0, 0.0, 1.0);
446
+
447
+ float diffuse = clamp(dot(n, l) + 0.7, 0.7, 1.0);
448
+ C *= diffuse;
449
+
450
+ vec3 bloom = texture2D(uBloom, vUv).rgb;
451
+ vec3 noise = texture2D(uDithering, vUv * ditherScale).rgb;
452
+ noise = noise * 2.0 - 1.0;
453
+ bloom += noise / 800.0;
454
+ bloom = pow(bloom.rgb, vec3(1.0 / 2.2));
455
+ C += bloom;
456
+
457
+ float a = max(C.r, max(C.g, C.b));
458
+ gl_FragColor = vec4(C, a);
459
+ }
460
+ `,
461
+ bloomPreFilter: `
462
+ precision mediump float;
463
+ precision mediump sampler2D;
464
+
465
+ varying vec2 vUv;
466
+ uniform sampler2D uTexture;
467
+ uniform vec3 curve;
468
+ uniform float threshold;
469
+
470
+ void main () {
471
+ vec3 c = texture2D(uTexture, vUv).rgb;
472
+ float br = max(c.r, max(c.g, c.b));
473
+ float rq = clamp(br - curve.x, 0.0, curve.y);
474
+ rq = curve.z * rq * rq;
475
+ c *= max(rq, br - threshold) / max(br, 0.0001);
476
+ gl_FragColor = vec4(c, 0.0);
477
+ }
478
+ `,
479
+ bloomBlur: `
480
+ precision mediump float;
481
+ precision mediump sampler2D;
482
+
483
+ varying vec2 vL;
484
+ varying vec2 vR;
485
+ varying vec2 vT;
486
+ varying vec2 vB;
487
+ uniform sampler2D uTexture;
488
+
489
+ void main () {
490
+ vec4 sum = vec4(0.0);
491
+ sum += texture2D(uTexture, vL);
492
+ sum += texture2D(uTexture, vR);
493
+ sum += texture2D(uTexture, vT);
494
+ sum += texture2D(uTexture, vB);
495
+ sum *= 0.25;
496
+ gl_FragColor = sum;
497
+ }
498
+ `,
499
+ bloomFinal: `
500
+ precision mediump float;
501
+ precision mediump sampler2D;
502
+
503
+ varying vec2 vL;
504
+ varying vec2 vR;
505
+ varying vec2 vT;
506
+ varying vec2 vB;
507
+ uniform sampler2D uTexture;
508
+ uniform float intensity;
509
+
510
+ void main () {
511
+ vec4 sum = vec4(0.0);
512
+ sum += texture2D(uTexture, vL);
513
+ sum += texture2D(uTexture, vR);
514
+ sum += texture2D(uTexture, vT);
515
+ sum += texture2D(uTexture, vB);
516
+ sum *= 0.25;
517
+ gl_FragColor = sum * intensity;
518
+ }
519
+ `,
520
+ splat: `
521
+ precision highp float;
522
+ precision highp sampler2D;
523
+
524
+ varying vec2 vUv;
525
+ uniform sampler2D uTarget;
526
+ uniform float aspectRatio;
527
+ uniform vec3 color;
528
+ uniform vec2 point;
529
+ uniform float radius;
530
+
531
+ void main () {
532
+ vec2 p = vUv - point.xy;
533
+ p.x *= aspectRatio;
534
+ vec3 splat = exp(-dot(p, p) / radius) * color;
535
+ vec3 base = texture2D(uTarget, vUv).xyz;
536
+ gl_FragColor = vec4(base + splat, 1.0);
537
+ }
538
+ `,
539
+ advectionManualFiltering: `
540
+ precision highp float;
541
+ precision highp sampler2D;
542
+
543
+ varying vec2 vUv;
544
+ uniform sampler2D uVelocity;
545
+ uniform sampler2D uSource;
546
+ uniform vec2 texelSize;
547
+ uniform vec2 dyeTexelSize;
548
+ uniform float dt;
549
+ uniform float dissipation;
550
+
551
+ vec4 bilerp (sampler2D sam, vec2 uv, vec2 tsize) {
552
+ vec2 st = uv / tsize - 0.5;
553
+
554
+ vec2 iuv = floor(st);
555
+ vec2 fuv = fract(st);
556
+
557
+ vec4 a = texture2D(sam, (iuv + vec2(0.5, 0.5)) * tsize);
558
+ vec4 b = texture2D(sam, (iuv + vec2(1.5, 0.5)) * tsize);
559
+ vec4 c = texture2D(sam, (iuv + vec2(0.5, 1.5)) * tsize);
560
+ vec4 d = texture2D(sam, (iuv + vec2(1.5, 1.5)) * tsize);
561
+
562
+ return mix(mix(a, b, fuv.x), mix(c, d, fuv.x), fuv.y);
563
+ }
564
+
565
+ void main () {
566
+ vec2 coord = vUv - dt * bilerp(uVelocity, vUv, texelSize).xy * texelSize;
567
+ gl_FragColor = dissipation * bilerp(uSource, coord, dyeTexelSize);
568
+ gl_FragColor.a = 1.0;
569
+ }
570
+ `,
571
+ advection: `
572
+ precision highp float;
573
+ precision highp sampler2D;
574
+
575
+ varying vec2 vUv;
576
+ uniform sampler2D uVelocity;
577
+ uniform sampler2D uSource;
578
+ uniform vec2 texelSize;
579
+ uniform float dt;
580
+ uniform float dissipation;
581
+
582
+ void main () {
583
+ vec2 coord = vUv - dt * texture2D(uVelocity, vUv).xy * texelSize;
584
+ gl_FragColor = dissipation * texture2D(uSource, coord);
585
+ gl_FragColor.a = 1.0;
586
+ }
587
+ `,
588
+ divergence: `
589
+ precision mediump float;
590
+ precision mediump sampler2D;
591
+
592
+ varying highp vec2 vUv;
593
+ varying highp vec2 vL;
594
+ varying highp vec2 vR;
595
+ varying highp vec2 vT;
596
+ varying highp vec2 vB;
597
+ uniform sampler2D uVelocity;
598
+
599
+ void main () {
600
+ float L = texture2D(uVelocity, vL).x;
601
+ float R = texture2D(uVelocity, vR).x;
602
+ float T = texture2D(uVelocity, vT).y;
603
+ float B = texture2D(uVelocity, vB).y;
604
+
605
+ vec2 C = texture2D(uVelocity, vUv).xy;
606
+ if (vL.x < 0.0) { L = -C.x; }
607
+ if (vR.x > 1.0) { R = -C.x; }
608
+ if (vT.y > 1.0) { T = -C.y; }
609
+ if (vB.y < 0.0) { B = -C.y; }
610
+
611
+ float div = 0.5 * (R - L + T - B);
612
+ gl_FragColor = vec4(div, 0.0, 0.0, 1.0);
613
+ }
614
+ `,
615
+ curl: `
616
+ precision mediump float;
617
+ precision mediump sampler2D;
618
+
619
+ varying highp vec2 vUv;
620
+ varying highp vec2 vL;
621
+ varying highp vec2 vR;
622
+ varying highp vec2 vT;
623
+ varying highp vec2 vB;
624
+ uniform sampler2D uVelocity;
625
+
626
+ void main () {
627
+ float L = texture2D(uVelocity, vL).y;
628
+ float R = texture2D(uVelocity, vR).y;
629
+ float T = texture2D(uVelocity, vT).x;
630
+ float B = texture2D(uVelocity, vB).x;
631
+ float vorticity = R - L - T + B;
632
+ gl_FragColor = vec4(0.5 * vorticity, 0.0, 0.0, 1.0);
633
+ }
634
+ `,
635
+ vorticity: `
636
+ precision highp float;
637
+ precision highp sampler2D;
638
+
639
+ varying vec2 vUv;
640
+ varying vec2 vL;
641
+ varying vec2 vR;
642
+ varying vec2 vT;
643
+ varying vec2 vB;
644
+ uniform sampler2D uVelocity;
645
+ uniform sampler2D uCurl;
646
+ uniform float curl;
647
+ uniform float dt;
648
+
649
+ void main () {
650
+ float L = texture2D(uCurl, vL).x;
651
+ float R = texture2D(uCurl, vR).x;
652
+ float T = texture2D(uCurl, vT).x;
653
+ float B = texture2D(uCurl, vB).x;
654
+ float C = texture2D(uCurl, vUv).x;
655
+
656
+ vec2 force = 0.5 * vec2(abs(T) - abs(B), abs(R) - abs(L));
657
+ force /= length(force) + 0.0001;
658
+ force *= curl * C;
659
+ force.y *= -1.0;
660
+
661
+ vec2 vel = texture2D(uVelocity, vUv).xy;
662
+ gl_FragColor = vec4(vel + force * dt, 0.0, 1.0);
663
+ }
664
+ `,
665
+ pressure: `
666
+ precision mediump float;
667
+ precision mediump sampler2D;
668
+
669
+ varying highp vec2 vUv;
670
+ varying highp vec2 vL;
671
+ varying highp vec2 vR;
672
+ varying highp vec2 vT;
673
+ varying highp vec2 vB;
674
+ uniform sampler2D uPressure;
675
+ uniform sampler2D uDivergence;
676
+
677
+ vec2 boundary (vec2 uv) {
678
+ return uv;
679
+ // uncomment if you use wrap or repeat texture mode
680
+ // uv = min(max(uv, 0.0), 1.0);
681
+ // return uv;
682
+ }
683
+
684
+ void main () {
685
+ float L = texture2D(uPressure, boundary(vL)).x;
686
+ float R = texture2D(uPressure, boundary(vR)).x;
687
+ float T = texture2D(uPressure, boundary(vT)).x;
688
+ float B = texture2D(uPressure, boundary(vB)).x;
689
+ float C = texture2D(uPressure, vUv).x;
690
+ float divergence = texture2D(uDivergence, vUv).x;
691
+ float pressure = (L + R + B + T - divergence) * 0.25;
692
+ gl_FragColor = vec4(pressure, 0.0, 0.0, 1.0);
693
+ }
694
+ `,
695
+ gradientSubtract: `
696
+ precision mediump float;
697
+ precision mediump sampler2D;
698
+
699
+ varying highp vec2 vUv;
700
+ varying highp vec2 vL;
701
+ varying highp vec2 vR;
702
+ varying highp vec2 vT;
703
+ varying highp vec2 vB;
704
+ uniform sampler2D uPressure;
705
+ uniform sampler2D uVelocity;
706
+
707
+ vec2 boundary (vec2 uv) {
708
+ return uv;
709
+ // uv = min(max(uv, 0.0), 1.0);
710
+ // return uv;
711
+ }
712
+
713
+ void main () {
714
+ float L = texture2D(uPressure, boundary(vL)).x;
715
+ float R = texture2D(uPressure, boundary(vR)).x;
716
+ float T = texture2D(uPressure, boundary(vT)).x;
717
+ float B = texture2D(uPressure, boundary(vB)).x;
718
+ vec2 velocity = texture2D(uVelocity, vUv).xy;
719
+ velocity.xy -= vec2(R - L, T - B);
720
+ gl_FragColor = vec4(velocity, 0.0, 1.0);
721
+ }
722
+ `
723
+ };
724
+ function ye(f) {
725
+ Object.assign(Q, f);
726
+ }
727
+ const ue = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdYAAAHWCAYAAADKGqhaAAAPYklEQVR4nO3V0arsOA5AUf3/T/fMg9wkIkUR5EYc1xrYXigq3/RhHhL//P9/EfEPSZLsG2WoS7PZbDabzW/m9ZAkSfaNPCRJ0o6mv+wkSZ5klKEuH/v2e/fdd999993/2fvrIUmS7Bt5SJKkHU1/2UmSPMkoQ12azWaz2Wx+M6+HJEmyb+QhSZJ2NP1lJ0nyJCOPW5flY/b29vb29vYf9utHJEmyb+QhSZJ2NP1lJ0nyJKMMdWk2m81ms/nNvB6SJM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29h/260ckSbJv5CFJknY0/WUnSfIkowx1aTabzWaz+c28HpIkyb6RhyRJ2tH0l50kyZOMMtTlY99+77777rvvvvs/e389JEmSfSMPSZK0o+kvO0mSJxllqEuz2Ww2m81v5vWQJEn2jTwkSdKOpr/sJEmeZORx67J8zN7e3t7e3v7Dfv2IJEn2jTwkSdKOpr/sJEmeZJShLs1ms9lsNr+Z10OSJNk38pAkSTua/rKTJHmSkcety/Kxuv82d/997/d+7/d+7/f+P/P+9ZAkSfaNPCRJ0o6mv+wkSZ5klKEuzWaz2Ww2v5nXQ5Ik2TfykCRJO5r+spMkeZKRx63L8jF7e3t7e3v7D/v1I5Ik2TfykCRJO5r+spMkeZJRhro0m81ms9n8Zl4PSZJk38hDkiTtaPrLTpLkSUYZ6vKxb79333333Xff/Z+9vx6SJMm+kYckSdrR9JedJMmTjDLUpdlsNpvN5jfzekiSJPtGHpIkaUfTX3aSJE8y8rh1WT5mb29vb29v/2G/fkSSJPtGHpIkaUfTX3aSJE8yylCXZrPZbDab38zrIUmS7Bt5SJKkHU1/2UmSPMnI49Zl+Vjdf5u7//5//f7p+9N//6+/f/r+9N//6++fvj/99//6+/+L+/8DJmjrygTZvccAAAAASUVORK5CYII=";
728
+ let le = !1;
729
+ function pe(f) {
730
+ let e = [];
731
+ e.push(new se());
732
+ let r = f.getContext("webgl2", te);
733
+ const i = !!r;
734
+ i || (r = f.getContext("webgl", te) || f.getContext("experimental-webgl", te));
735
+ let v = k();
736
+ P() && (Q.render_shaders = !1), v.supportLinearFiltering || (Q.render_shaders = !1, Q.render_bloom = !1);
737
+ const n = {
738
+ baseVertex: c(
739
+ r.VERTEX_SHADER,
740
+ _.vertex
741
+ ),
742
+ clear: c(r.FRAGMENT_SHADER, _.clear),
743
+ color: c(r.FRAGMENT_SHADER, _.color),
744
+ background: c(
745
+ r.FRAGMENT_SHADER,
746
+ _.background
747
+ ),
748
+ display: c(
749
+ r.FRAGMENT_SHADER,
750
+ _.display
751
+ ),
752
+ displayBloom: c(
753
+ r.FRAGMENT_SHADER,
754
+ _.displayBloom
755
+ ),
756
+ displayShading: c(
757
+ r.FRAGMENT_SHADER,
758
+ _.displayShading
759
+ ),
760
+ displayBloomShading: c(
761
+ r.FRAGMENT_SHADER,
762
+ _.displayBloomShading
763
+ ),
764
+ bloomPreFilter: c(
765
+ r.FRAGMENT_SHADER,
766
+ _.bloomPreFilter
767
+ ),
768
+ bloomBlur: c(
769
+ r.FRAGMENT_SHADER,
770
+ _.bloomBlur
771
+ ),
772
+ bloomFinal: c(
773
+ r.FRAGMENT_SHADER,
774
+ _.bloomFinal
775
+ ),
776
+ splat: c(r.FRAGMENT_SHADER, _.splat),
777
+ advectionManualFiltering: c(
778
+ r.FRAGMENT_SHADER,
779
+ _.advectionManualFiltering
780
+ ),
781
+ advection: c(
782
+ r.FRAGMENT_SHADER,
783
+ _.advection
784
+ ),
785
+ divergence: c(
786
+ r.FRAGMENT_SHADER,
787
+ _.divergence
788
+ ),
789
+ curl: c(r.FRAGMENT_SHADER, _.curl),
790
+ vorticity: c(
791
+ r.FRAGMENT_SHADER,
792
+ _.vorticity
793
+ ),
794
+ pressure: c(
795
+ r.FRAGMENT_SHADER,
796
+ _.pressure
797
+ ),
798
+ gradientSubtract: c(
799
+ r.FRAGMENT_SHADER,
800
+ _.gradientSubtract
801
+ )
802
+ };
803
+ let x = U(v.supportLinearFiltering);
804
+ function P() {
805
+ return /Mobi|Android/i.test(navigator.userAgent);
806
+ }
807
+ function k() {
808
+ let J, y, d, F, N;
809
+ i ? (r.getExtension("EXT_color_buffer_float"), N = r.getExtension("OES_texture_float_linear")) : (F = r.getExtension("OES_texture_half_float"), N = r.getExtension(
810
+ "OES_texture_half_float_linear"
811
+ ));
812
+ const S = i ? r.HALF_FLOAT : F.HALF_FLOAT_OES;
813
+ r.clearColor(0, 0, 0, 1), i ? (J = D(
814
+ r.RGBA16F,
815
+ r.RGBA,
816
+ S
817
+ ), y = D(
818
+ r.RG16F,
819
+ r.RG,
820
+ S
821
+ ), d = D(
822
+ r.R16F,
823
+ r.RED,
824
+ S
825
+ )) : (J = D(
826
+ r.RGBA,
827
+ r.RGBA,
828
+ S
829
+ ), y = D(
830
+ r.RGBA,
831
+ r.RGBA,
832
+ S
833
+ ), d = D(
834
+ r.RGBA,
835
+ r.RGBA,
836
+ S
837
+ ));
838
+ function D(E, B, Z) {
839
+ let A, C = r.createTexture();
840
+ r.bindTexture(r.TEXTURE_2D, C), r.texParameteri(
841
+ r.TEXTURE_2D,
842
+ r.TEXTURE_MIN_FILTER,
843
+ r.NEAREST
844
+ ), r.texParameteri(
845
+ r.TEXTURE_2D,
846
+ r.TEXTURE_MAG_FILTER,
847
+ r.NEAREST
848
+ ), r.texParameteri(
849
+ r.TEXTURE_2D,
850
+ r.TEXTURE_WRAP_S,
851
+ r.CLAMP_TO_EDGE
852
+ ), r.texParameteri(
853
+ r.TEXTURE_2D,
854
+ r.TEXTURE_WRAP_T,
855
+ r.CLAMP_TO_EDGE
856
+ ), r.texImage2D(
857
+ r.TEXTURE_2D,
858
+ 0,
859
+ E,
860
+ 4,
861
+ 4,
862
+ 0,
863
+ B,
864
+ Z,
865
+ null
866
+ );
867
+ let b = r.createFramebuffer();
868
+ if (r.bindFramebuffer(r.FRAMEBUFFER, b), r.framebufferTexture2D(
869
+ r.FRAMEBUFFER,
870
+ r.COLOR_ATTACHMENT0,
871
+ r.TEXTURE_2D,
872
+ C,
873
+ 0
874
+ ), A = r.checkFramebufferStatus(r.FRAMEBUFFER) === r.FRAMEBUFFER_COMPLETE, !A)
875
+ switch (E) {
876
+ case r.R16F:
877
+ return D(r.RG16F, r.RG, Z);
878
+ case r.RG16F:
879
+ return D(r.RGBA16F, r.RGBA, Z);
880
+ default:
881
+ return null;
882
+ }
883
+ return { internalFormat: E, format: B };
884
+ }
885
+ return {
886
+ formatRGBA: J,
887
+ formatRG: y,
888
+ formatR: d,
889
+ halfFloatTexType: S,
890
+ supportLinearFiltering: N
891
+ };
892
+ }
893
+ function c(J, y) {
894
+ const d = r.createShader(J);
895
+ if (r.shaderSource(d, y), r.compileShader(d), !r.getShaderParameter(d, r.COMPILE_STATUS))
896
+ throw r.getShaderInfoLog(d);
897
+ return d;
898
+ }
899
+ function U(J) {
900
+ return {
901
+ clearProgram: new R(n.baseVertex, n.clear, r),
902
+ colorProgram: new R(n.baseVertex, n.color, r),
903
+ backgroundProgram: new R(
904
+ n.baseVertex,
905
+ n.background,
906
+ r
907
+ ),
908
+ displayProgram: new R(n.baseVertex, n.display, r),
909
+ displayBloomProgram: new R(
910
+ n.baseVertex,
911
+ n.displayBloom,
912
+ r
913
+ ),
914
+ displayShadingProgram: new R(
915
+ n.baseVertex,
916
+ n.displayShading,
917
+ r
918
+ ),
919
+ displayBloomShadingProgram: new R(
920
+ n.baseVertex,
921
+ n.displayBloomShading,
922
+ r
923
+ ),
924
+ bloomPreFilterProgram: new R(
925
+ n.baseVertex,
926
+ n.bloomPreFilter,
927
+ r
928
+ ),
929
+ bloomBlurProgram: new R(
930
+ n.baseVertex,
931
+ n.bloomBlur,
932
+ r
933
+ ),
934
+ bloomFinalProgram: new R(
935
+ n.baseVertex,
936
+ n.bloomFinal,
937
+ r
938
+ ),
939
+ splatProgram: new R(n.baseVertex, n.splat, r),
940
+ advectionProgram: new R(
941
+ n.baseVertex,
942
+ J ? n.advection : n.advectionManualFiltering,
943
+ r
944
+ ),
945
+ divergenceProgram: new R(
946
+ n.baseVertex,
947
+ n.divergence,
948
+ r
949
+ ),
950
+ curlProgram: new R(n.baseVertex, n.curl, r),
951
+ vorticityProgram: new R(
952
+ n.baseVertex,
953
+ n.vorticity,
954
+ r
955
+ ),
956
+ pressureProgram: new R(n.baseVertex, n.pressure, r),
957
+ gradientSubtractProgram: new R(
958
+ n.baseVertex,
959
+ n.gradientSubtract,
960
+ r
961
+ )
962
+ };
963
+ }
964
+ return {
965
+ programs: x,
966
+ webGL: r,
967
+ colorFormats: v,
968
+ pointers: e
969
+ };
970
+ }
971
+ function Te(f, e, r, i, v) {
972
+ if (le) {
973
+ let o = [];
974
+ o.push(new se()), v = o;
975
+ }
976
+ le = !0;
977
+ const n = Q;
978
+ let x = [], P = [], k, c, U, J, y, d, F, N, S, D;
979
+ const E = (e.bindBuffer(e.ARRAY_BUFFER, e.createBuffer()), e.bufferData(
980
+ e.ARRAY_BUFFER,
981
+ new Float32Array([-1, -1, -1, 1, 1, 1, 1, -1]),
982
+ e.STATIC_DRAW
983
+ ), e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, e.createBuffer()), e.bufferData(
984
+ e.ELEMENT_ARRAY_BUFFER,
985
+ new Uint16Array([0, 1, 2, 0, 2, 3]),
986
+ e.STATIC_DRAW
987
+ ), e.vertexAttribPointer(0, 2, e.FLOAT, !1, 0, 0), e.enableVertexAttribArray(0), (o) => {
988
+ e.bindFramebuffer(e.FRAMEBUFFER, o), e.drawElements(e.TRIANGLES, 6, e.UNSIGNED_SHORT, 0);
989
+ });
990
+ let B = (n.embedded_dither, q(ue));
991
+ A(), V(Math.random() * 20 + 5);
992
+ let Z = Date.now();
993
+ w();
994
+ function A() {
995
+ const o = r.halfFloatTexType, a = r.formatRGBA, u = r.formatRG, s = r.formatR, l = r.supportLinearFiltering ? e.LINEAR : e.NEAREST;
996
+ let g = t(n.sim_resolution), p = t(n.dye_resolution), T = t(n.bloom_resolution);
997
+ k = g.width, c = g.height, U = p.width, J = p.height, y = y ? j(
998
+ y,
999
+ U,
1000
+ J,
1001
+ a.internalFormat,
1002
+ a.format,
1003
+ o,
1004
+ l
1005
+ ) : C(
1006
+ U,
1007
+ J,
1008
+ a.internalFormat,
1009
+ a.format,
1010
+ o,
1011
+ l
1012
+ ), d = d ? j(
1013
+ d,
1014
+ k,
1015
+ c,
1016
+ u.internalFormat,
1017
+ u.format,
1018
+ o,
1019
+ l
1020
+ ) : C(
1021
+ k,
1022
+ c,
1023
+ u.internalFormat,
1024
+ u.format,
1025
+ o,
1026
+ l
1027
+ ), D = b(
1028
+ T.width,
1029
+ T.height,
1030
+ a.internalFormat,
1031
+ a.format,
1032
+ o,
1033
+ l
1034
+ ), F = b(
1035
+ k,
1036
+ c,
1037
+ s.internalFormat,
1038
+ s.format,
1039
+ o,
1040
+ e.NEAREST
1041
+ ), N = b(
1042
+ k,
1043
+ c,
1044
+ s.internalFormat,
1045
+ s.format,
1046
+ o,
1047
+ e.NEAREST
1048
+ ), S = C(
1049
+ k,
1050
+ c,
1051
+ s.internalFormat,
1052
+ s.format,
1053
+ o,
1054
+ e.NEAREST
1055
+ ), x.length = 0;
1056
+ for (let h = 0; h < n.bloom_iterations; h++) {
1057
+ let I = T.width >> h + 1, z = T.height >> h + 1;
1058
+ if (I < 2 || z < 2) break;
1059
+ let me = b(
1060
+ I,
1061
+ z,
1062
+ a.internalFormat,
1063
+ a.format,
1064
+ o,
1065
+ l
1066
+ );
1067
+ x.push(me);
1068
+ }
1069
+ }
1070
+ function C(o, a, u, s, l, g) {
1071
+ let p = b(o, a, u, s, l, g), T = b(o, a, u, s, l, g);
1072
+ return {
1073
+ /* Get and set Buffer Data */
1074
+ get read() {
1075
+ return p;
1076
+ },
1077
+ set read(h) {
1078
+ p = h;
1079
+ },
1080
+ get write() {
1081
+ return T;
1082
+ },
1083
+ set write(h) {
1084
+ T = h;
1085
+ },
1086
+ /* Swap data between buffers */
1087
+ swap() {
1088
+ let h = p;
1089
+ p = T, T = h;
1090
+ }
1091
+ };
1092
+ }
1093
+ function b(o, a, u, s, l, g) {
1094
+ e.activeTexture(e.TEXTURE0);
1095
+ let p = e.createTexture();
1096
+ e.bindTexture(e.TEXTURE_2D, p), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, g), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, g), e.texParameteri(
1097
+ e.TEXTURE_2D,
1098
+ e.TEXTURE_WRAP_S,
1099
+ e.CLAMP_TO_EDGE
1100
+ ), e.texParameteri(
1101
+ e.TEXTURE_2D,
1102
+ e.TEXTURE_WRAP_T,
1103
+ e.CLAMP_TO_EDGE
1104
+ ), e.texImage2D(
1105
+ e.TEXTURE_2D,
1106
+ 0,
1107
+ u,
1108
+ o,
1109
+ a,
1110
+ 0,
1111
+ s,
1112
+ l,
1113
+ null
1114
+ );
1115
+ let T = e.createFramebuffer();
1116
+ return e.bindFramebuffer(e.FRAMEBUFFER, T), e.framebufferTexture2D(
1117
+ e.FRAMEBUFFER,
1118
+ e.COLOR_ATTACHMENT0,
1119
+ e.TEXTURE_2D,
1120
+ p,
1121
+ 0
1122
+ ), e.viewport(0, 0, o, a), e.clear(e.COLOR_BUFFER_BIT), {
1123
+ texture: p,
1124
+ fbo: T,
1125
+ width: o,
1126
+ height: a,
1127
+ attach(h) {
1128
+ return e.activeTexture(e.TEXTURE0 + h), e.bindTexture(e.TEXTURE_2D, p), h;
1129
+ }
1130
+ };
1131
+ }
1132
+ function j(o, a, u, s, l, g, p) {
1133
+ return o.read = X(
1134
+ o.read,
1135
+ a,
1136
+ u,
1137
+ s,
1138
+ l,
1139
+ g,
1140
+ p
1141
+ ), o.write = b(a, u, s, l, g, p), o;
1142
+ }
1143
+ function X(o, a, u, s, l, g, p) {
1144
+ let T = b(a, u, s, l, g, p);
1145
+ return i.clearProgram.bind(), e.uniform1i(i.clearProgram.uniforms.uTexture, o.attach(0)), e.uniform1f(i.clearProgram.uniforms.value, 1), E(T.fbo), T;
1146
+ }
1147
+ function q(o) {
1148
+ let a = e.createTexture();
1149
+ e.bindTexture(e.TEXTURE_2D, a), e.texParameteri(
1150
+ e.TEXTURE_2D,
1151
+ e.TEXTURE_MIN_FILTER,
1152
+ e.LINEAR
1153
+ ), e.texParameteri(
1154
+ e.TEXTURE_2D,
1155
+ e.TEXTURE_MAG_FILTER,
1156
+ e.LINEAR
1157
+ ), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.REPEAT), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.REPEAT), e.texImage2D(
1158
+ e.TEXTURE_2D,
1159
+ 0,
1160
+ e.RGB,
1161
+ 1,
1162
+ 1,
1163
+ 0,
1164
+ e.RGB,
1165
+ e.UNSIGNED_BYTE,
1166
+ new Uint8Array([255, 255, 255])
1167
+ );
1168
+ let u = {
1169
+ texture: a,
1170
+ width: 1,
1171
+ height: 1,
1172
+ attach(l) {
1173
+ return e.activeTexture(e.TEXTURE0 + l), e.bindTexture(e.TEXTURE_2D, a), l;
1174
+ }
1175
+ }, s = new Image();
1176
+ return s.src = o, s.onload = () => {
1177
+ u.width = s.width, u.height = s.height, e.bindTexture(e.TEXTURE_2D, a), e.texImage2D(
1178
+ e.TEXTURE_2D,
1179
+ 0,
1180
+ e.RGB,
1181
+ e.RGB,
1182
+ e.UNSIGNED_BYTE,
1183
+ s
1184
+ );
1185
+ }, u;
1186
+ }
1187
+ function w() {
1188
+ L(), Y(), n.paused || $(0.016), re(null), requestAnimationFrame(w);
1189
+ }
1190
+ function Y() {
1191
+ P.length > 0 && V(P.pop());
1192
+ for (let o = 0; o < v.length; o++) {
1193
+ const a = v[o];
1194
+ a.moved && (H(a.x, a.y, a.dx, a.dy, a.color), o !== 1 && (a.moved = !1));
1195
+ }
1196
+ if (n.multi_color) {
1197
+ if (Z + 100 < Date.now()) {
1198
+ Z = Date.now();
1199
+ for (let o = 0; o < v.length; o++) {
1200
+ const a = v[o];
1201
+ a.color = W();
1202
+ }
1203
+ }
1204
+ v[0] && !v[0].moved && H(
1205
+ f.width * 0.5,
1206
+ f.height * 0.5,
1207
+ 0,
1208
+ 0,
1209
+ { r: 0, g: 0, b: 0 }
1210
+ );
1211
+ }
1212
+ }
1213
+ function $(o) {
1214
+ e.disable(e.BLEND), e.viewport(0, 0, k, c), i.curlProgram.bind(), e.uniform2f(
1215
+ i.curlProgram.uniforms.texelSize,
1216
+ 1 / k,
1217
+ 1 / c
1218
+ ), e.uniform1i(
1219
+ i.curlProgram.uniforms.uVelocity,
1220
+ d.read.attach(0)
1221
+ ), E(N.fbo), i.vorticityProgram.bind(), e.uniform2f(
1222
+ i.vorticityProgram.uniforms.texelSize,
1223
+ 1 / k,
1224
+ 1 / c
1225
+ ), e.uniform1i(
1226
+ i.vorticityProgram.uniforms.uVelocity,
1227
+ d.read.attach(0)
1228
+ ), e.uniform1i(i.vorticityProgram.uniforms.uCurl, N.attach(1)), e.uniform1f(i.vorticityProgram.uniforms.curl, n.curl), e.uniform1f(i.vorticityProgram.uniforms.dt, o), E(d.write.fbo), d.swap(), i.divergenceProgram.bind(), e.uniform2f(
1229
+ i.divergenceProgram.uniforms.texelSize,
1230
+ 1 / k,
1231
+ 1 / c
1232
+ ), e.uniform1i(
1233
+ i.divergenceProgram.uniforms.uVelocity,
1234
+ d.read.attach(0)
1235
+ ), E(F.fbo), i.clearProgram.bind(), e.uniform1i(
1236
+ i.clearProgram.uniforms.uTexture,
1237
+ S.read.attach(0)
1238
+ ), e.uniform1f(i.clearProgram.uniforms.value, n.pressure), E(S.write.fbo), S.swap(), i.pressureProgram.bind(), e.uniform2f(
1239
+ i.pressureProgram.uniforms.texelSize,
1240
+ 1 / k,
1241
+ 1 / c
1242
+ ), e.uniform1i(
1243
+ i.pressureProgram.uniforms.uDivergence,
1244
+ F.attach(0)
1245
+ );
1246
+ for (let u = 0; u < n.pressure_iteration; u++)
1247
+ e.uniform1i(
1248
+ i.pressureProgram.uniforms.uPressure,
1249
+ S.read.attach(1)
1250
+ ), E(S.write.fbo), S.swap();
1251
+ i.gradientSubtractProgram.bind(), e.uniform2f(
1252
+ i.gradientSubtractProgram.uniforms.texelSize,
1253
+ 1 / k,
1254
+ 1 / c
1255
+ ), e.uniform1i(
1256
+ i.gradientSubtractProgram.uniforms.uPressure,
1257
+ S.read.attach(0)
1258
+ ), e.uniform1i(
1259
+ i.gradientSubtractProgram.uniforms.uVelocity,
1260
+ d.read.attach(1)
1261
+ ), E(d.write.fbo), d.swap(), i.advectionProgram.bind(), e.uniform2f(
1262
+ i.advectionProgram.uniforms.texelSize,
1263
+ 1 / k,
1264
+ 1 / c
1265
+ ), r.supportLinearFiltering || e.uniform2f(
1266
+ i.advectionProgram.uniforms.dyeTexelSize,
1267
+ 1 / k,
1268
+ 1 / c
1269
+ );
1270
+ let a = d.read.attach(0);
1271
+ e.uniform1i(i.advectionProgram.uniforms.uVelocity, a), e.uniform1i(i.advectionProgram.uniforms.uSource, a), e.uniform1f(i.advectionProgram.uniforms.dt, o), e.uniform1f(
1272
+ i.advectionProgram.uniforms.dissipation,
1273
+ n.velocity
1274
+ ), E(d.write.fbo), d.swap(), e.viewport(0, 0, U, J), r.supportLinearFiltering || e.uniform2f(
1275
+ i.advectionProgram.uniforms.dyeTexelSize,
1276
+ 1 / U,
1277
+ 1 / J
1278
+ ), e.uniform1i(
1279
+ i.advectionProgram.uniforms.uVelocity,
1280
+ d.read.attach(0)
1281
+ ), e.uniform1i(
1282
+ i.advectionProgram.uniforms.uSource,
1283
+ y.read.attach(1)
1284
+ ), e.uniform1f(
1285
+ i.advectionProgram.uniforms.dissipation,
1286
+ n.dissipation
1287
+ ), E(y.write.fbo), y.swap();
1288
+ }
1289
+ function re(o) {
1290
+ n.render_bloom && M(y.read, D), e.blendFunc(e.ONE, e.ONE_MINUS_SRC_ALPHA), e.enable(e.BLEND);
1291
+ let a = e.drawingBufferWidth, u = e.drawingBufferHeight;
1292
+ if (e.viewport(0, 0, a, u), !n.transparent) {
1293
+ i.colorProgram.bind();
1294
+ let s = n.background_color;
1295
+ e.uniform4f(
1296
+ i.colorProgram.uniforms.color,
1297
+ s.r / 255,
1298
+ s.g / 255,
1299
+ s.b / 255,
1300
+ 1
1301
+ ), E(o);
1302
+ }
1303
+ if (n.transparent && (i.backgroundProgram.bind(), e.uniform1f(
1304
+ i.backgroundProgram.uniforms.aspectRatio,
1305
+ f.width / f.height
1306
+ ), E(null)), n.render_shaders) {
1307
+ let s = n.render_bloom ? i.displayBloomShadingProgram : i.displayShadingProgram;
1308
+ if (s.bind(), e.uniform2f(s.uniforms.texelSize, 1 / a, 1 / u), e.uniform1i(s.uniforms.uTexture, y.read.attach(0)), n.render_bloom) {
1309
+ e.uniform1i(s.uniforms.uBloom, D.attach(1)), e.uniform1i(
1310
+ s.uniforms.uDithering,
1311
+ B.attach(2)
1312
+ );
1313
+ let l = m(B, a, u);
1314
+ e.uniform2f(s.uniforms.ditherScale, l.x, l.y);
1315
+ }
1316
+ } else {
1317
+ let s = n.render_bloom ? i.displayBloomProgram : i.displayProgram;
1318
+ if (s.bind(), e.uniform1i(s.uniforms.uTexture, y.read.attach(0)), n.render_bloom) {
1319
+ e.uniform1i(s.uniforms.uBloom, D.attach(1)), e.uniform1i(
1320
+ s.uniforms.uDithering,
1321
+ B.attach(2)
1322
+ );
1323
+ let l = m(B, a, u);
1324
+ e.uniform2f(s.uniforms.ditherScale, l.x, l.y);
1325
+ }
1326
+ }
1327
+ E(o);
1328
+ }
1329
+ function M(o, a) {
1330
+ if (x.length < 2) return;
1331
+ let u = a;
1332
+ e.disable(e.BLEND), i.bloomPreFilterProgram.bind();
1333
+ let s = n.threshold * n.soft_knee + 1e-4, l = n.threshold - s, g = s * 2, p = 0.25 / s;
1334
+ e.uniform3f(
1335
+ i.bloomPreFilterProgram.uniforms.curve,
1336
+ l,
1337
+ g,
1338
+ p
1339
+ ), e.uniform1f(
1340
+ i.bloomPreFilterProgram.uniforms.threshold,
1341
+ n.threshold
1342
+ ), e.uniform1i(
1343
+ i.bloomPreFilterProgram.uniforms.uTexture,
1344
+ o.attach(0)
1345
+ ), e.viewport(0, 0, u.width, u.height), E(u.fbo), i.bloomBlurProgram.bind();
1346
+ for (let T = 0; T < x.length; T++) {
1347
+ let h = x[T];
1348
+ e.uniform2f(
1349
+ i.bloomBlurProgram.uniforms.texelSize,
1350
+ 1 / u.width,
1351
+ 1 / u.height
1352
+ ), e.uniform1i(
1353
+ i.bloomBlurProgram.uniforms.uTexture,
1354
+ u.attach(0)
1355
+ ), e.viewport(0, 0, h.width, h.height), E(h.fbo), u = h;
1356
+ }
1357
+ e.blendFunc(e.ONE, e.ONE), e.enable(e.BLEND);
1358
+ for (let T = x.length - 2; T >= 0; T--) {
1359
+ let h = x[T];
1360
+ e.uniform2f(
1361
+ i.bloomBlurProgram.uniforms.texelSize,
1362
+ 1 / u.width,
1363
+ 1 / u.height
1364
+ ), e.uniform1i(
1365
+ i.bloomBlurProgram.uniforms.uTexture,
1366
+ u.attach(0)
1367
+ ), e.viewport(0, 0, h.width, h.height), E(h.fbo), u = h;
1368
+ }
1369
+ e.disable(e.BLEND), i.bloomFinalProgram.bind(), e.uniform2f(
1370
+ i.bloomFinalProgram.uniforms.texelSize,
1371
+ 1 / u.width,
1372
+ 1 / u.height
1373
+ ), e.uniform1i(
1374
+ i.bloomFinalProgram.uniforms.uTexture,
1375
+ u.attach(0)
1376
+ ), e.uniform1f(
1377
+ i.bloomFinalProgram.uniforms.intensity,
1378
+ n.intensity
1379
+ ), e.viewport(0, 0, a.width, a.height), E(a.fbo);
1380
+ }
1381
+ function H(o, a, u, s, l) {
1382
+ e.viewport(0, 0, k, c), i.splatProgram.bind(), e.uniform1i(
1383
+ i.splatProgram.uniforms.uTarget,
1384
+ d.read.attach(0)
1385
+ ), e.uniform1f(
1386
+ i.splatProgram.uniforms.aspectRatio,
1387
+ f.width / f.height
1388
+ ), e.uniform2f(
1389
+ i.splatProgram.uniforms.point,
1390
+ o / f.width,
1391
+ 1 - a / f.height
1392
+ ), e.uniform3f(i.splatProgram.uniforms.color, u, -s, 1), e.uniform1f(
1393
+ i.splatProgram.uniforms.radius,
1394
+ n.emitter_size / 100
1395
+ ), E(d.write.fbo), d.swap(), e.viewport(0, 0, U, J), e.uniform1i(
1396
+ i.splatProgram.uniforms.uTarget,
1397
+ y.read.attach(0)
1398
+ ), e.uniform3f(
1399
+ i.splatProgram.uniforms.color,
1400
+ l.r,
1401
+ l.g,
1402
+ l.b
1403
+ ), E(y.write.fbo), y.swap();
1404
+ }
1405
+ function V(o) {
1406
+ for (let a = 0; a < o; a++) {
1407
+ const u = Math.random() * f.width, s = Math.random() * f.height, l = (Math.random() - 0.5) * 600, g = (Math.random() - 0.5) * 600, p = W();
1408
+ H(u, s, l, g, p);
1409
+ }
1410
+ }
1411
+ function L() {
1412
+ (f.width != f.clientWidth || f.height != f.clientHeight) && (f.width = f.clientWidth, f.height = f.clientHeight, A());
1413
+ }
1414
+ function W() {
1415
+ let o = G(Math.random(), 1, 1);
1416
+ return o.r *= 0.15, o.g *= 0.15, o.b *= 0.15, o;
1417
+ }
1418
+ function G(o, a, u) {
1419
+ let s, l, g, p, T, h, I, z;
1420
+ switch (p = Math.floor(o * 6), T = o * 6 - p, h = u * (1 - a), I = u * (1 - T * a), z = u * (1 - (1 - T) * a), p % 6) {
1421
+ case 0:
1422
+ s = u, l = z, g = h;
1423
+ break;
1424
+ case 1:
1425
+ s = I, l = u, g = h;
1426
+ break;
1427
+ case 2:
1428
+ s = h, l = u, g = z;
1429
+ break;
1430
+ case 3:
1431
+ s = h, l = I, g = u;
1432
+ break;
1433
+ case 4:
1434
+ s = z, l = h, g = u;
1435
+ break;
1436
+ case 5:
1437
+ s = u, l = h, g = I;
1438
+ break;
1439
+ }
1440
+ return {
1441
+ r: s,
1442
+ g: l,
1443
+ b: g
1444
+ };
1445
+ }
1446
+ function t(o) {
1447
+ let a = e.drawingBufferWidth / e.drawingBufferHeight;
1448
+ a < 1 && (a = 1 / a);
1449
+ let u = Math.round(o * a), s = Math.round(o);
1450
+ return e.drawingBufferWidth > e.drawingBufferHeight ? { width: u, height: s } : { width: s, height: u };
1451
+ }
1452
+ function m(o, a, u) {
1453
+ return {
1454
+ x: a / o.width,
1455
+ y: u / o.height
1456
+ };
1457
+ }
1458
+ window.addEventListener("mousemove", (o) => {
1459
+ const a = f.getBoundingClientRect(), u = o.clientX - a.left, s = o.clientY - a.top;
1460
+ if (u < 0 || s < 0 || u > a.width || s > a.height) return;
1461
+ const l = v[0];
1462
+ l.down = !0, l.moved = !0, l.dx = (u - l.x) * 5, l.dy = (s - l.y) * 5, l.x = u, l.y = s;
1463
+ }), f.addEventListener("mousedown", () => {
1464
+ v[0].down = !0, v[0].color = W();
1465
+ }), window.addEventListener("mouseup", () => {
1466
+ v[0].down = !1;
1467
+ }), window.addEventListener("keydown", (o) => {
1468
+ o.code === "KeyP" && (n.paused = !n.paused), o.key === " " && P.push(parseInt(Math.random() * 20) + 5);
1469
+ });
1470
+ }
1471
+ class R {
1472
+ constructor(e, r, i) {
1473
+ if (this.uniforms = {}, this.webGL = i, this.program = i.createProgram(), i.attachShader(this.program, e), i.attachShader(this.program, r), i.linkProgram(this.program), !i.getProgramParameter(this.program, i.LINK_STATUS))
1474
+ throw i.getProgramInfoLog(this.program);
1475
+ const v = i.getProgramParameter(
1476
+ this.program,
1477
+ i.ACTIVE_UNIFORMS
1478
+ );
1479
+ for (let n = 0; n < v; n++) {
1480
+ const x = i.getActiveUniform(this.program, n).name;
1481
+ this.uniforms[x] = i.getUniformLocation(
1482
+ this.program,
1483
+ x
1484
+ );
1485
+ }
1486
+ }
1487
+ /**
1488
+ * Sets shader program as part of current rendering state.
1489
+ */
1490
+ bind() {
1491
+ this.webGL.useProgram(this.program);
1492
+ }
1493
+ }
1494
+ class se {
1495
+ constructor() {
1496
+ this.id = -1, this.x = 0, this.y = 0, this.dx = 0, this.dy = 0, this.down = !1, this.moved = !1, this.color = [30, 0, 300];
1497
+ }
1498
+ }
1499
+ class Ee {
1500
+ constructor(e) {
1501
+ this.canvas = e, this.webGL = null, this.programs = null, this.colorFormats = null, this.pointers = null, this.active = !1, this._started = !1;
1502
+ }
1503
+ start() {
1504
+ if (!this.active) {
1505
+ if (!this._started) {
1506
+ const { webGL: e, programs: r, colorFormats: i, pointers: v } = pe(this.canvas);
1507
+ this.webGL = e, this.programs = r, this.colorFormats = i, this.pointers = v, Te(
1508
+ this.canvas,
1509
+ this.webGL,
1510
+ this.colorFormats,
1511
+ this.programs,
1512
+ this.pointers
1513
+ ), this._started = !0;
1514
+ }
1515
+ this.active = !0;
1516
+ }
1517
+ }
1518
+ pause() {
1519
+ this.active && (this.active = !1, this.webGL && this.webGL.clear(this.webGL.COLOR_BUFFER_BIT));
1520
+ }
1521
+ destroy() {
1522
+ this.active = !1, this.webGL = null, this.programs = null, this.colorFormats = null, this.pointers = null, this._started = !1;
1523
+ }
1524
+ }
1525
+ function Se({
1526
+ enabled: f = !0,
1527
+ style: e = {},
1528
+ className: r = "",
1529
+ pointerEvents: i = !0
1530
+ }) {
1531
+ const v = ie(null), n = ie(null);
1532
+ return ce(() => {
1533
+ if (!v.current) return;
1534
+ n.current || (n.current = new Ee(v.current));
1535
+ const x = n.current;
1536
+ return f ? x.start() : x.pause(), () => {
1537
+ n.current && (n.current.destroy?.(), n.current = null);
1538
+ };
1539
+ }, [f]), /* @__PURE__ */ he.jsx(
1540
+ "canvas",
1541
+ {
1542
+ ref: v,
1543
+ className: r,
1544
+ style: {
1545
+ position: "fixed",
1546
+ inset: 0,
1547
+ width: "100vw",
1548
+ height: "100vh",
1549
+ zIndex: 0,
1550
+ pointerEvents: i ? "auto" : "none",
1551
+ ...e
1552
+ }
1553
+ }
1554
+ );
1555
+ }
1556
+ export {
1557
+ Se as LiquidBG,
1558
+ Se as default,
1559
+ ye as setBehaviors
1560
+ };