nfx-ui 0.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.
- package/README.md +235 -0
- package/dist/animations.cjs +3 -0
- package/dist/animations.d.ts +102 -0
- package/dist/animations.mjs +14 -0
- package/dist/apis.cjs +5 -0
- package/dist/apis.cjs.map +1 -0
- package/dist/apis.d.ts +7 -0
- package/dist/apis.mjs +18 -0
- package/dist/apis.mjs.map +1 -0
- package/dist/chunk-BounceLoading-B54QEw0n.mjs +244 -0
- package/dist/chunk-BounceLoading-B54QEw0n.mjs.map +1 -0
- package/dist/chunk-BounceLoading-C6n4BZVJ.cjs +11 -0
- package/dist/chunk-BounceLoading-C6n4BZVJ.cjs.map +1 -0
- package/dist/chunk-animations-Brp-bsaE.mjs +1243 -0
- package/dist/chunk-animations-Brp-bsaE.mjs.map +1 -0
- package/dist/chunk-animations-e2F3zuP9.cjs +190 -0
- package/dist/chunk-animations-e2F3zuP9.cjs.map +1 -0
- package/dist/chunk-chunk-BFrxaqQT.cjs +1 -0
- package/dist/chunk-i18n-Bp6pPM9n.mjs +207 -0
- package/dist/chunk-i18n-Bp6pPM9n.mjs.map +1 -0
- package/dist/chunk-i18n-_7W7guSV.cjs +3 -0
- package/dist/chunk-i18n-_7W7guSV.cjs.map +1 -0
- package/dist/chunk-lstorage-BVCD00Ow.mjs +27 -0
- package/dist/chunk-lstorage-BVCD00Ow.mjs.map +1 -0
- package/dist/chunk-lstorage-BnxLXHgH.cjs +3 -0
- package/dist/chunk-lstorage-BnxLXHgH.cjs.map +1 -0
- package/dist/chunk-lucide-BhgnmTNo.mjs +158 -0
- package/dist/chunk-lucide-BhgnmTNo.mjs.map +1 -0
- package/dist/chunk-lucide-CP2lvOPY.cjs +3 -0
- package/dist/chunk-lucide-CP2lvOPY.cjs.map +1 -0
- package/dist/chunk-preference-CYl68oeU.cjs +3 -0
- package/dist/chunk-preference-CYl68oeU.cjs.map +1 -0
- package/dist/chunk-preference-DImtu5jI.mjs +51 -0
- package/dist/chunk-preference-DImtu5jI.mjs.map +1 -0
- package/dist/chunk-types-BE3JCLff.cjs +3 -0
- package/dist/chunk-types-BE3JCLff.cjs.map +1 -0
- package/dist/chunk-types-BkFxelHl.mjs +20 -0
- package/dist/chunk-types-BkFxelHl.mjs.map +1 -0
- package/dist/chunk-types-C_opkZGr.cjs +3 -0
- package/dist/chunk-types-C_opkZGr.cjs.map +1 -0
- package/dist/chunk-types-CkbZrFqZ.cjs +3 -0
- package/dist/chunk-types-CkbZrFqZ.cjs.map +1 -0
- package/dist/chunk-types-DNPBKfmx.mjs +11 -0
- package/dist/chunk-types-DNPBKfmx.mjs.map +1 -0
- package/dist/chunk-types-SD4MzUGp.mjs +11 -0
- package/dist/chunk-types-SD4MzUGp.mjs.map +1 -0
- package/dist/chunk-useLayout-BAJHOIL3.cjs +3 -0
- package/dist/chunk-useLayout-BAJHOIL3.cjs.map +1 -0
- package/dist/chunk-useLayout-DPxlynT-.mjs +12 -0
- package/dist/chunk-useLayout-DPxlynT-.mjs.map +1 -0
- package/dist/chunk-useTheme-DgleVMMh.cjs +3 -0
- package/dist/chunk-useTheme-DgleVMMh.cjs.map +1 -0
- package/dist/chunk-useTheme-oHcq3d0o.mjs +13 -0
- package/dist/chunk-useTheme-oHcq3d0o.mjs.map +1 -0
- package/dist/components.cjs +8 -0
- package/dist/components.cjs.map +1 -0
- package/dist/components.d.ts +411 -0
- package/dist/components.mjs +1688 -0
- package/dist/components.mjs.map +1 -0
- package/dist/constants.cjs +5 -0
- package/dist/constants.cjs.map +1 -0
- package/dist/constants.d.ts +130 -0
- package/dist/constants.mjs +85 -0
- package/dist/constants.mjs.map +1 -0
- package/dist/events.cjs +5 -0
- package/dist/events.cjs.map +1 -0
- package/dist/events.d.ts +66 -0
- package/dist/events.mjs +31 -0
- package/dist/events.mjs.map +1 -0
- package/dist/hooks.cjs +5 -0
- package/dist/hooks.cjs.map +1 -0
- package/dist/hooks.d.ts +316 -0
- package/dist/hooks.mjs +107 -0
- package/dist/hooks.mjs.map +1 -0
- package/dist/icons.cjs +3 -0
- package/dist/icons.d.ts +218 -0
- package/dist/icons.mjs +76 -0
- package/dist/languages.cjs +5 -0
- package/dist/languages.cjs.map +1 -0
- package/dist/languages.d.ts +174 -0
- package/dist/languages.mjs +112 -0
- package/dist/languages.mjs.map +1 -0
- package/dist/layouts.cjs +5 -0
- package/dist/layouts.cjs.map +1 -0
- package/dist/layouts.d.ts +209 -0
- package/dist/layouts.mjs +460 -0
- package/dist/layouts.mjs.map +1 -0
- package/dist/navigations.cjs +5 -0
- package/dist/navigations.cjs.map +1 -0
- package/dist/navigations.d.ts +72 -0
- package/dist/navigations.mjs +30 -0
- package/dist/navigations.mjs.map +1 -0
- package/dist/preference.cjs +3 -0
- package/dist/preference.d.ts +94 -0
- package/dist/preference.mjs +14 -0
- package/dist/services.cjs +5 -0
- package/dist/services.cjs.map +1 -0
- package/dist/services.d.ts +8 -0
- package/dist/services.mjs +26 -0
- package/dist/services.mjs.map +1 -0
- package/dist/stores.cjs +5 -0
- package/dist/stores.cjs.map +1 -0
- package/dist/stores.d.ts +101 -0
- package/dist/stores.mjs +167 -0
- package/dist/stores.mjs.map +1 -0
- package/dist/themes.cjs +5 -0
- package/dist/themes.cjs.map +1 -0
- package/dist/themes.d.ts +229 -0
- package/dist/themes.mjs +894 -0
- package/dist/themes.mjs.map +1 -0
- package/dist/types.cjs +2 -0
- package/dist/types.d.ts +147 -0
- package/dist/types.mjs +2 -0
- package/dist/utils.cjs +5 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.ts +374 -0
- package/dist/utils.mjs +293 -0
- package/dist/utils.mjs.map +1 -0
- package/package.json +196 -0
|
@@ -0,0 +1,1243 @@
|
|
|
1
|
+
import { n as ue } from "./chunk-useTheme-oHcq3d0o.mjs";
|
|
2
|
+
import { memo as fe, useCallback as te, useEffect as ce, useMemo as ae, useRef as E } from "react";
|
|
3
|
+
import { jsx as W, jsxs as Ee } from "react/jsx-runtime";
|
|
4
|
+
import { Effect as Re, EffectComposer as ve, EffectPass as pe, RenderPass as ge } from "postprocessing";
|
|
5
|
+
import { Clock as be, Color as Pe, GLSL3 as Te, LinearFilter as xe, Mesh as _e, OrthographicCamera as Se, PlaneGeometry as Ae, Scene as Ie, ShaderMaterial as ke, Texture as Le, Uniform as oe, Vector2 as ye, WebGLRenderer as Fe } from "three";
|
|
6
|
+
const $e = "style-module__waves___oR3u7", Be = "style-module__wavesCanvas___zkhTC";
|
|
7
|
+
var we = {
|
|
8
|
+
waves: $e,
|
|
9
|
+
wavesCanvas: Be
|
|
10
|
+
}, O = class {
|
|
11
|
+
x;
|
|
12
|
+
y;
|
|
13
|
+
z;
|
|
14
|
+
constructor(a, r, o) {
|
|
15
|
+
this.x = a, this.y = r, this.z = o;
|
|
16
|
+
}
|
|
17
|
+
dot2(a, r) {
|
|
18
|
+
return this.x * a + this.y * r;
|
|
19
|
+
}
|
|
20
|
+
}, Ne = class {
|
|
21
|
+
grad3;
|
|
22
|
+
p;
|
|
23
|
+
perm;
|
|
24
|
+
gradP;
|
|
25
|
+
constructor(a = 0) {
|
|
26
|
+
this.grad3 = [
|
|
27
|
+
new O(1, 1, 0),
|
|
28
|
+
new O(-1, 1, 0),
|
|
29
|
+
new O(1, -1, 0),
|
|
30
|
+
new O(-1, -1, 0),
|
|
31
|
+
new O(1, 0, 1),
|
|
32
|
+
new O(-1, 0, 1),
|
|
33
|
+
new O(1, 0, -1),
|
|
34
|
+
new O(-1, 0, -1),
|
|
35
|
+
new O(0, 1, 1),
|
|
36
|
+
new O(0, -1, 1),
|
|
37
|
+
new O(0, 1, -1),
|
|
38
|
+
new O(0, -1, -1)
|
|
39
|
+
], this.p = [
|
|
40
|
+
151,
|
|
41
|
+
160,
|
|
42
|
+
137,
|
|
43
|
+
91,
|
|
44
|
+
90,
|
|
45
|
+
15,
|
|
46
|
+
131,
|
|
47
|
+
13,
|
|
48
|
+
201,
|
|
49
|
+
95,
|
|
50
|
+
96,
|
|
51
|
+
53,
|
|
52
|
+
194,
|
|
53
|
+
233,
|
|
54
|
+
7,
|
|
55
|
+
225,
|
|
56
|
+
140,
|
|
57
|
+
36,
|
|
58
|
+
103,
|
|
59
|
+
30,
|
|
60
|
+
69,
|
|
61
|
+
142,
|
|
62
|
+
8,
|
|
63
|
+
99,
|
|
64
|
+
37,
|
|
65
|
+
240,
|
|
66
|
+
21,
|
|
67
|
+
10,
|
|
68
|
+
23,
|
|
69
|
+
190,
|
|
70
|
+
6,
|
|
71
|
+
148,
|
|
72
|
+
247,
|
|
73
|
+
120,
|
|
74
|
+
234,
|
|
75
|
+
75,
|
|
76
|
+
0,
|
|
77
|
+
26,
|
|
78
|
+
197,
|
|
79
|
+
62,
|
|
80
|
+
94,
|
|
81
|
+
252,
|
|
82
|
+
219,
|
|
83
|
+
203,
|
|
84
|
+
117,
|
|
85
|
+
35,
|
|
86
|
+
11,
|
|
87
|
+
32,
|
|
88
|
+
57,
|
|
89
|
+
177,
|
|
90
|
+
33,
|
|
91
|
+
88,
|
|
92
|
+
237,
|
|
93
|
+
149,
|
|
94
|
+
56,
|
|
95
|
+
87,
|
|
96
|
+
174,
|
|
97
|
+
20,
|
|
98
|
+
125,
|
|
99
|
+
136,
|
|
100
|
+
171,
|
|
101
|
+
168,
|
|
102
|
+
68,
|
|
103
|
+
175,
|
|
104
|
+
74,
|
|
105
|
+
165,
|
|
106
|
+
71,
|
|
107
|
+
134,
|
|
108
|
+
139,
|
|
109
|
+
48,
|
|
110
|
+
27,
|
|
111
|
+
166,
|
|
112
|
+
77,
|
|
113
|
+
146,
|
|
114
|
+
158,
|
|
115
|
+
231,
|
|
116
|
+
83,
|
|
117
|
+
111,
|
|
118
|
+
229,
|
|
119
|
+
122,
|
|
120
|
+
60,
|
|
121
|
+
211,
|
|
122
|
+
133,
|
|
123
|
+
230,
|
|
124
|
+
220,
|
|
125
|
+
105,
|
|
126
|
+
92,
|
|
127
|
+
41,
|
|
128
|
+
55,
|
|
129
|
+
46,
|
|
130
|
+
245,
|
|
131
|
+
40,
|
|
132
|
+
244,
|
|
133
|
+
102,
|
|
134
|
+
143,
|
|
135
|
+
54,
|
|
136
|
+
65,
|
|
137
|
+
25,
|
|
138
|
+
63,
|
|
139
|
+
161,
|
|
140
|
+
1,
|
|
141
|
+
216,
|
|
142
|
+
80,
|
|
143
|
+
73,
|
|
144
|
+
209,
|
|
145
|
+
76,
|
|
146
|
+
132,
|
|
147
|
+
187,
|
|
148
|
+
208,
|
|
149
|
+
89,
|
|
150
|
+
18,
|
|
151
|
+
169,
|
|
152
|
+
200,
|
|
153
|
+
196,
|
|
154
|
+
135,
|
|
155
|
+
130,
|
|
156
|
+
116,
|
|
157
|
+
188,
|
|
158
|
+
159,
|
|
159
|
+
86,
|
|
160
|
+
164,
|
|
161
|
+
100,
|
|
162
|
+
109,
|
|
163
|
+
198,
|
|
164
|
+
173,
|
|
165
|
+
186,
|
|
166
|
+
3,
|
|
167
|
+
64,
|
|
168
|
+
52,
|
|
169
|
+
217,
|
|
170
|
+
226,
|
|
171
|
+
250,
|
|
172
|
+
124,
|
|
173
|
+
123,
|
|
174
|
+
5,
|
|
175
|
+
202,
|
|
176
|
+
38,
|
|
177
|
+
147,
|
|
178
|
+
118,
|
|
179
|
+
126,
|
|
180
|
+
255,
|
|
181
|
+
82,
|
|
182
|
+
85,
|
|
183
|
+
212,
|
|
184
|
+
207,
|
|
185
|
+
206,
|
|
186
|
+
59,
|
|
187
|
+
227,
|
|
188
|
+
47,
|
|
189
|
+
16,
|
|
190
|
+
58,
|
|
191
|
+
17,
|
|
192
|
+
182,
|
|
193
|
+
189,
|
|
194
|
+
28,
|
|
195
|
+
42,
|
|
196
|
+
223,
|
|
197
|
+
183,
|
|
198
|
+
170,
|
|
199
|
+
213,
|
|
200
|
+
119,
|
|
201
|
+
248,
|
|
202
|
+
152,
|
|
203
|
+
2,
|
|
204
|
+
44,
|
|
205
|
+
154,
|
|
206
|
+
163,
|
|
207
|
+
70,
|
|
208
|
+
221,
|
|
209
|
+
153,
|
|
210
|
+
101,
|
|
211
|
+
155,
|
|
212
|
+
167,
|
|
213
|
+
43,
|
|
214
|
+
172,
|
|
215
|
+
9,
|
|
216
|
+
129,
|
|
217
|
+
22,
|
|
218
|
+
39,
|
|
219
|
+
253,
|
|
220
|
+
19,
|
|
221
|
+
98,
|
|
222
|
+
108,
|
|
223
|
+
110,
|
|
224
|
+
79,
|
|
225
|
+
113,
|
|
226
|
+
224,
|
|
227
|
+
232,
|
|
228
|
+
178,
|
|
229
|
+
185,
|
|
230
|
+
112,
|
|
231
|
+
104,
|
|
232
|
+
218,
|
|
233
|
+
246,
|
|
234
|
+
97,
|
|
235
|
+
228,
|
|
236
|
+
251,
|
|
237
|
+
34,
|
|
238
|
+
242,
|
|
239
|
+
193,
|
|
240
|
+
238,
|
|
241
|
+
210,
|
|
242
|
+
144,
|
|
243
|
+
12,
|
|
244
|
+
191,
|
|
245
|
+
179,
|
|
246
|
+
162,
|
|
247
|
+
241,
|
|
248
|
+
81,
|
|
249
|
+
51,
|
|
250
|
+
145,
|
|
251
|
+
235,
|
|
252
|
+
249,
|
|
253
|
+
14,
|
|
254
|
+
239,
|
|
255
|
+
107,
|
|
256
|
+
49,
|
|
257
|
+
192,
|
|
258
|
+
214,
|
|
259
|
+
31,
|
|
260
|
+
181,
|
|
261
|
+
199,
|
|
262
|
+
106,
|
|
263
|
+
157,
|
|
264
|
+
184,
|
|
265
|
+
84,
|
|
266
|
+
204,
|
|
267
|
+
176,
|
|
268
|
+
115,
|
|
269
|
+
121,
|
|
270
|
+
50,
|
|
271
|
+
45,
|
|
272
|
+
127,
|
|
273
|
+
4,
|
|
274
|
+
150,
|
|
275
|
+
254,
|
|
276
|
+
138,
|
|
277
|
+
236,
|
|
278
|
+
205,
|
|
279
|
+
93,
|
|
280
|
+
222,
|
|
281
|
+
114,
|
|
282
|
+
67,
|
|
283
|
+
29,
|
|
284
|
+
24,
|
|
285
|
+
72,
|
|
286
|
+
243,
|
|
287
|
+
141,
|
|
288
|
+
128,
|
|
289
|
+
195,
|
|
290
|
+
78,
|
|
291
|
+
66,
|
|
292
|
+
215,
|
|
293
|
+
61,
|
|
294
|
+
156,
|
|
295
|
+
180
|
|
296
|
+
], this.perm = new Array(512), this.gradP = new Array(512), this.seed(a);
|
|
297
|
+
}
|
|
298
|
+
seed(a) {
|
|
299
|
+
a > 0 && a < 1 && (a *= 65536), a = Math.floor(a), a < 256 && (a |= a << 8);
|
|
300
|
+
for (let r = 0; r < 256; r++) {
|
|
301
|
+
let o = r & 1 ? this.p[r] ^ a & 255 : this.p[r] ^ a >> 8 & 255;
|
|
302
|
+
this.perm[r] = this.perm[r + 256] = o, this.gradP[r] = this.gradP[r + 256] = this.grad3[o % 12];
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
fade(a) {
|
|
306
|
+
return a * a * a * (a * (a * 6 - 15) + 10);
|
|
307
|
+
}
|
|
308
|
+
lerp(a, r, o) {
|
|
309
|
+
return (1 - o) * a + o * r;
|
|
310
|
+
}
|
|
311
|
+
perlin2(a, r) {
|
|
312
|
+
let o = Math.floor(a), t = Math.floor(r);
|
|
313
|
+
a -= o, r -= t, o &= 255, t &= 255;
|
|
314
|
+
const f = this.gradP[o + this.perm[t]].dot2(a, r), d = this.gradP[o + this.perm[t + 1]].dot2(a, r - 1), m = this.gradP[o + 1 + this.perm[t]].dot2(a - 1, r), y = this.gradP[o + 1 + this.perm[t + 1]].dot2(a - 1, r - 1), w = this.fade(a);
|
|
315
|
+
return this.lerp(this.lerp(f, m, w), this.lerp(d, y, w), this.fade(r));
|
|
316
|
+
}
|
|
317
|
+
}, Ve = ({ lineColor: a = "black", backgroundColor: r = "transparent", waveSpeedX: o = 0.0125, waveSpeedY: t = 5e-3, waveAmpX: f = 32, waveAmpY: d = 16, xGap: m = 10, yGap: y = 32, friction: w = 0.925, tension: A = 5e-3, maxCursorMove: R = 100, style: g = {}, className: I = "" }) => {
|
|
318
|
+
const n = E(null), h = E(null), C = E(null), $ = E({
|
|
319
|
+
width: 0,
|
|
320
|
+
height: 0,
|
|
321
|
+
left: 0,
|
|
322
|
+
top: 0
|
|
323
|
+
}), B = E(new Ne(Math.random())), k = E([]), _ = E({
|
|
324
|
+
x: -10,
|
|
325
|
+
y: 0,
|
|
326
|
+
lx: 0,
|
|
327
|
+
ly: 0,
|
|
328
|
+
sx: 0,
|
|
329
|
+
sy: 0,
|
|
330
|
+
v: 0,
|
|
331
|
+
vs: 0,
|
|
332
|
+
a: 0,
|
|
333
|
+
set: !1
|
|
334
|
+
}), v = E({
|
|
335
|
+
lineColor: a,
|
|
336
|
+
waveSpeedX: o,
|
|
337
|
+
waveSpeedY: t,
|
|
338
|
+
waveAmpX: f,
|
|
339
|
+
waveAmpY: d,
|
|
340
|
+
friction: w,
|
|
341
|
+
tension: A,
|
|
342
|
+
maxCursorMove: R,
|
|
343
|
+
xGap: m,
|
|
344
|
+
yGap: y
|
|
345
|
+
}), L = E(null);
|
|
346
|
+
return ce(() => {
|
|
347
|
+
v.current = {
|
|
348
|
+
lineColor: a,
|
|
349
|
+
waveSpeedX: o,
|
|
350
|
+
waveSpeedY: t,
|
|
351
|
+
waveAmpX: f,
|
|
352
|
+
waveAmpY: d,
|
|
353
|
+
friction: w,
|
|
354
|
+
tension: A,
|
|
355
|
+
maxCursorMove: R,
|
|
356
|
+
xGap: m,
|
|
357
|
+
yGap: y
|
|
358
|
+
};
|
|
359
|
+
}, [
|
|
360
|
+
a,
|
|
361
|
+
o,
|
|
362
|
+
t,
|
|
363
|
+
f,
|
|
364
|
+
d,
|
|
365
|
+
w,
|
|
366
|
+
A,
|
|
367
|
+
R,
|
|
368
|
+
m,
|
|
369
|
+
y
|
|
370
|
+
]), ce(() => {
|
|
371
|
+
const X = h.current, N = n.current;
|
|
372
|
+
if (!X || !N) return;
|
|
373
|
+
C.current = X.getContext("2d");
|
|
374
|
+
function G() {
|
|
375
|
+
if (!N || !X) return;
|
|
376
|
+
const i = N.getBoundingClientRect();
|
|
377
|
+
$.current = {
|
|
378
|
+
width: i.width,
|
|
379
|
+
height: i.height,
|
|
380
|
+
left: i.left,
|
|
381
|
+
top: i.top
|
|
382
|
+
}, X.width = i.width, X.height = i.height;
|
|
383
|
+
}
|
|
384
|
+
function b() {
|
|
385
|
+
const { width: i, height: l } = $.current;
|
|
386
|
+
k.current = [];
|
|
387
|
+
const u = i + 200, P = l + 30, { xGap: V, yGap: K } = v.current, Q = Math.ceil(u / V), U = Math.ceil(P / K), T = (i - V * Q) / 2, D = (l - K * U) / 2;
|
|
388
|
+
for (let z = 0; z <= Q; z++) {
|
|
389
|
+
const Z = [];
|
|
390
|
+
for (let M = 0; M <= U; M++) Z.push({
|
|
391
|
+
x: T + V * z,
|
|
392
|
+
y: D + K * M,
|
|
393
|
+
wave: {
|
|
394
|
+
x: 0,
|
|
395
|
+
y: 0
|
|
396
|
+
},
|
|
397
|
+
cursor: {
|
|
398
|
+
x: 0,
|
|
399
|
+
y: 0,
|
|
400
|
+
vx: 0,
|
|
401
|
+
vy: 0
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
k.current.push(Z);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
function H(i) {
|
|
408
|
+
const l = k.current, u = _.current, P = B.current, { waveSpeedX: V, waveSpeedY: K, waveAmpX: Q, waveAmpY: U, friction: T, tension: D, maxCursorMove: z } = v.current;
|
|
409
|
+
l.forEach((Z) => {
|
|
410
|
+
Z.forEach((M) => {
|
|
411
|
+
const ie = P.perlin2((M.x + i * V) * 2e-3, (M.y + i * K) * 15e-4) * 12;
|
|
412
|
+
M.wave.x = Math.cos(ie) * Q, M.wave.y = Math.sin(ie) * U;
|
|
413
|
+
const ee = M.x - u.sx, se = M.y - u.sy, ne = Math.hypot(ee, se), J = Math.max(175, u.vs);
|
|
414
|
+
if (ne < J) {
|
|
415
|
+
const p = 1 - ne / J, S = Math.cos(ne * 1e-3) * p;
|
|
416
|
+
M.cursor.vx += Math.cos(u.a) * S * J * u.vs * 65e-5, M.cursor.vy += Math.sin(u.a) * S * J * u.vs * 65e-5;
|
|
417
|
+
}
|
|
418
|
+
M.cursor.vx += (0 - M.cursor.x) * D, M.cursor.vy += (0 - M.cursor.y) * D, M.cursor.vx *= T, M.cursor.vy *= T, M.cursor.x += M.cursor.vx * 2, M.cursor.y += M.cursor.vy * 2, M.cursor.x = Math.min(z, Math.max(-z, M.cursor.x)), M.cursor.y = Math.min(z, Math.max(-z, M.cursor.y));
|
|
419
|
+
});
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
function F(i, l = !0) {
|
|
423
|
+
const u = i.x + i.wave.x + (l ? i.cursor.x : 0), P = i.y + i.wave.y + (l ? i.cursor.y : 0);
|
|
424
|
+
return {
|
|
425
|
+
x: Math.round(u * 10) / 10,
|
|
426
|
+
y: Math.round(P * 10) / 10
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
function re() {
|
|
430
|
+
const { width: i, height: l } = $.current, u = C.current;
|
|
431
|
+
u && (u.clearRect(0, 0, i, l), u.beginPath(), u.strokeStyle = v.current.lineColor, k.current.forEach((P) => {
|
|
432
|
+
let V = F(P[0], !1);
|
|
433
|
+
u.moveTo(V.x, V.y), P.forEach((K, Q) => {
|
|
434
|
+
const U = Q === P.length - 1;
|
|
435
|
+
V = F(K, !U);
|
|
436
|
+
const T = F(P[Q + 1] || P[P.length - 1], !U);
|
|
437
|
+
u.lineTo(V.x, V.y), U && u.moveTo(T.x, T.y);
|
|
438
|
+
});
|
|
439
|
+
}), u.stroke());
|
|
440
|
+
}
|
|
441
|
+
function q(i) {
|
|
442
|
+
if (!N) return;
|
|
443
|
+
const l = _.current;
|
|
444
|
+
l.sx += (l.x - l.sx) * 0.1, l.sy += (l.y - l.sy) * 0.1;
|
|
445
|
+
const u = l.x - l.lx, P = l.y - l.ly, V = Math.hypot(u, P);
|
|
446
|
+
l.v = V, l.vs += (V - l.vs) * 0.1, l.vs = Math.min(100, l.vs), l.lx = l.x, l.ly = l.y, l.a = Math.atan2(P, u), N.style.setProperty("--x", `${l.sx}px`), N.style.setProperty("--y", `${l.sy}px`), H(i), re(), L.current = requestAnimationFrame(q);
|
|
447
|
+
}
|
|
448
|
+
function c() {
|
|
449
|
+
G(), b();
|
|
450
|
+
}
|
|
451
|
+
function e(i) {
|
|
452
|
+
x(i.clientX, i.clientY);
|
|
453
|
+
}
|
|
454
|
+
function s(i) {
|
|
455
|
+
const l = i.touches[0];
|
|
456
|
+
x(l.clientX, l.clientY);
|
|
457
|
+
}
|
|
458
|
+
function x(i, l) {
|
|
459
|
+
const u = _.current, P = $.current;
|
|
460
|
+
u.x = i - P.left, u.y = l - P.top, u.set || (u.sx = u.x, u.sy = u.y, u.lx = u.x, u.ly = u.y, u.set = !0);
|
|
461
|
+
}
|
|
462
|
+
return G(), b(), L.current = requestAnimationFrame(q), window.addEventListener("resize", c), window.addEventListener("mousemove", e), window.addEventListener("touchmove", s, { passive: !1 }), () => {
|
|
463
|
+
window.removeEventListener("resize", c), window.removeEventListener("mousemove", e), window.removeEventListener("touchmove", s), L.current !== null && cancelAnimationFrame(L.current);
|
|
464
|
+
};
|
|
465
|
+
}, []), W("div", {
|
|
466
|
+
ref: n,
|
|
467
|
+
className: `${we.waves} ${I}`,
|
|
468
|
+
style: {
|
|
469
|
+
position: "absolute",
|
|
470
|
+
top: 0,
|
|
471
|
+
left: 0,
|
|
472
|
+
margin: 0,
|
|
473
|
+
padding: 0,
|
|
474
|
+
width: "100%",
|
|
475
|
+
height: "100%",
|
|
476
|
+
overflow: "hidden",
|
|
477
|
+
backgroundColor: r,
|
|
478
|
+
...g
|
|
479
|
+
},
|
|
480
|
+
children: W("canvas", {
|
|
481
|
+
ref: h,
|
|
482
|
+
className: we.wavesCanvas
|
|
483
|
+
})
|
|
484
|
+
});
|
|
485
|
+
}, st = (a) => {
|
|
486
|
+
const { currentTheme: r } = ue();
|
|
487
|
+
return W(Ve, {
|
|
488
|
+
lineColor: ae(() => {
|
|
489
|
+
const o = r.colors.variables.primary || "rgb(59, 130, 246)", t = (m, y, w, A = 0.4) => `rgb(${Math.round(m + (255 - m) * A)}, ${Math.round(y + (255 - y) * A)}, ${Math.round(w + (255 - w) * A)})`;
|
|
490
|
+
if (o.startsWith("#")) {
|
|
491
|
+
const m = o.slice(1);
|
|
492
|
+
return t(parseInt(m.slice(0, 2), 16), parseInt(m.slice(2, 4), 16), parseInt(m.slice(4, 6), 16));
|
|
493
|
+
}
|
|
494
|
+
const f = o.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
495
|
+
if (f) return t(parseInt(f[1], 10), parseInt(f[2], 10), parseInt(f[3], 10));
|
|
496
|
+
const d = o.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);
|
|
497
|
+
return d ? t(parseInt(d[1], 10), parseInt(d[2], 10), parseInt(d[3], 10)) : o;
|
|
498
|
+
}, [r]),
|
|
499
|
+
backgroundColor: "transparent",
|
|
500
|
+
waveSpeedX: 0.05,
|
|
501
|
+
waveSpeedY: 0.01,
|
|
502
|
+
waveAmpX: 40,
|
|
503
|
+
waveAmpY: 20,
|
|
504
|
+
...a
|
|
505
|
+
});
|
|
506
|
+
};
|
|
507
|
+
const Xe = "style-module__squaresCanvas___22kMc";
|
|
508
|
+
var He = { squaresCanvas: Xe }, Ge = ({ direction: a = "right", speed: r = 1, borderColor: o = "#999", squareSize: t = 40, hoverFillColor: f = "#222", className: d = "", style: m = {} }) => {
|
|
509
|
+
const y = E(null), w = E(null), A = E(0), R = E(0), g = E({
|
|
510
|
+
x: 0,
|
|
511
|
+
y: 0
|
|
512
|
+
}), I = E(null);
|
|
513
|
+
return ce(() => {
|
|
514
|
+
const n = y.current;
|
|
515
|
+
if (!n) return;
|
|
516
|
+
const h = n.getContext("2d"), C = () => {
|
|
517
|
+
n.width = n.offsetWidth, n.height = n.offsetHeight, A.current = Math.ceil(n.width / t) + 1, R.current = Math.ceil(n.height / t) + 1;
|
|
518
|
+
};
|
|
519
|
+
window.addEventListener("resize", C), C();
|
|
520
|
+
const $ = () => {
|
|
521
|
+
if (!h) return;
|
|
522
|
+
h.clearRect(0, 0, n.width, n.height);
|
|
523
|
+
const v = Math.floor(g.current.x / t) * t, L = Math.floor(g.current.y / t) * t;
|
|
524
|
+
for (let N = v; N < n.width + t; N += t) for (let G = L; G < n.height + t; G += t) {
|
|
525
|
+
const b = N - g.current.x % t, H = G - g.current.y % t;
|
|
526
|
+
I.current && Math.floor((N - v) / t) === I.current.x && Math.floor((G - L) / t) === I.current.y && (h.fillStyle = f, h.fillRect(b, H, t, t)), h.strokeStyle = o, h.strokeRect(b, H, t, t);
|
|
527
|
+
}
|
|
528
|
+
const X = h.createRadialGradient(n.width / 2, n.height / 2, 0, n.width / 2, n.height / 2, Math.sqrt(n.width ** 2 + n.height ** 2) / 2);
|
|
529
|
+
X.addColorStop(0, "rgba(0, 0, 0, 0)"), X.addColorStop(1, "#060010"), h.fillStyle = X, h.fillRect(0, 0, n.width, n.height);
|
|
530
|
+
}, B = () => {
|
|
531
|
+
const v = Math.max(r, 0.1);
|
|
532
|
+
switch (a) {
|
|
533
|
+
case "right":
|
|
534
|
+
g.current.x = (g.current.x - v + t) % t;
|
|
535
|
+
break;
|
|
536
|
+
case "left":
|
|
537
|
+
g.current.x = (g.current.x + v + t) % t;
|
|
538
|
+
break;
|
|
539
|
+
case "up":
|
|
540
|
+
g.current.y = (g.current.y + v + t) % t;
|
|
541
|
+
break;
|
|
542
|
+
case "down":
|
|
543
|
+
g.current.y = (g.current.y - v + t) % t;
|
|
544
|
+
break;
|
|
545
|
+
case "diagonal":
|
|
546
|
+
g.current.x = (g.current.x - v + t) % t, g.current.y = (g.current.y - v + t) % t;
|
|
547
|
+
break;
|
|
548
|
+
default:
|
|
549
|
+
break;
|
|
550
|
+
}
|
|
551
|
+
$(), w.current = requestAnimationFrame(B);
|
|
552
|
+
}, k = (v) => {
|
|
553
|
+
const L = n.getBoundingClientRect(), X = v.clientX - L.left, N = v.clientY - L.top, G = Math.floor(g.current.x / t) * t, b = Math.floor(g.current.y / t) * t, H = Math.floor((X + g.current.x - G) / t), F = Math.floor((N + g.current.y - b) / t);
|
|
554
|
+
(!I.current || I.current.x !== H || I.current.y !== F) && (I.current = {
|
|
555
|
+
x: H,
|
|
556
|
+
y: F
|
|
557
|
+
});
|
|
558
|
+
}, _ = () => {
|
|
559
|
+
I.current = null;
|
|
560
|
+
};
|
|
561
|
+
return n.addEventListener("mousemove", k), n.addEventListener("mouseleave", _), w.current = requestAnimationFrame(B), () => {
|
|
562
|
+
window.removeEventListener("resize", C), w.current && cancelAnimationFrame(w.current), n.removeEventListener("mousemove", k), n.removeEventListener("mouseleave", _);
|
|
563
|
+
};
|
|
564
|
+
}, [
|
|
565
|
+
a,
|
|
566
|
+
r,
|
|
567
|
+
o,
|
|
568
|
+
f,
|
|
569
|
+
t
|
|
570
|
+
]), W("canvas", {
|
|
571
|
+
ref: y,
|
|
572
|
+
className: `${He.squaresCanvas} ${d}`,
|
|
573
|
+
style: m
|
|
574
|
+
});
|
|
575
|
+
}, ct = (a) => {
|
|
576
|
+
const { currentTheme: r } = ue();
|
|
577
|
+
return W(Ge, {
|
|
578
|
+
borderColor: ae(() => {
|
|
579
|
+
const o = r.colors.variables.border5 || r.colors.variables.fg || "#271E37";
|
|
580
|
+
if (o.startsWith("#")) return o;
|
|
581
|
+
const t = o.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
582
|
+
return t ? `#${parseInt(t[1], 10).toString(16).padStart(2, "0")}${parseInt(t[2], 10).toString(16).padStart(2, "0")}${parseInt(t[3], 10).toString(16).padStart(2, "0")}` : o;
|
|
583
|
+
}, [r]),
|
|
584
|
+
hoverFillColor: ae(() => {
|
|
585
|
+
const o = r.colors.variables.bg3 || r.colors.variables.border3 || "#222222", t = (d, m, y, w = 0.3) => `rgb(${Math.round(d * (1 - w))}, ${Math.round(m * (1 - w))}, ${Math.round(y * (1 - w))})`;
|
|
586
|
+
if (o.startsWith("#")) {
|
|
587
|
+
const d = o.slice(1);
|
|
588
|
+
return t(parseInt(d.slice(0, 2), 16), parseInt(d.slice(2, 4), 16), parseInt(d.slice(4, 6), 16));
|
|
589
|
+
}
|
|
590
|
+
const f = o.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
591
|
+
return f ? t(parseInt(f[1], 10), parseInt(f[2], 10), parseInt(f[3], 10)) : o;
|
|
592
|
+
}, [r]),
|
|
593
|
+
speed: 0.5,
|
|
594
|
+
squareSize: 40,
|
|
595
|
+
direction: "diagonal",
|
|
596
|
+
...a
|
|
597
|
+
});
|
|
598
|
+
};
|
|
599
|
+
const ze = "style-module__container___HkxIe", De = "style-module__canvas___MR9JX", Ye = "style-module__outerVignette___i75nw", Oe = "style-module__centerVignette___n9uVG";
|
|
600
|
+
var le = {
|
|
601
|
+
container: ze,
|
|
602
|
+
canvas: De,
|
|
603
|
+
outerVignette: Ye,
|
|
604
|
+
centerVignette: Oe
|
|
605
|
+
}, Ue = fe(({ glitchColors: a = [
|
|
606
|
+
"#2b4539",
|
|
607
|
+
"#61dca3",
|
|
608
|
+
"#61b3dc"
|
|
609
|
+
], glitchSpeed: r = 500, centerVignette: o = !1, outerVignette: t = !0, smooth: f = !0, characters: d = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!@#$&*()-_+=/[]{};:<>.,0123456789", className: m = "", style: y = {} }) => {
|
|
610
|
+
const w = E(null), A = E(null), R = E([]), g = E({
|
|
611
|
+
columns: 0,
|
|
612
|
+
rows: 0
|
|
613
|
+
}), I = E(null), n = E(Date.now()), h = ae(() => Array.from(d), [d]), C = E(/* @__PURE__ */ new Map()), $ = 16, B = 10, k = 20, _ = te(() => h[Math.floor(Math.random() * h.length)], [h]), v = te(() => a[Math.floor(Math.random() * a.length)], [a]), L = te((c) => {
|
|
614
|
+
if (C.current.has(c)) return C.current.get(c);
|
|
615
|
+
const e = c.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, (i, l, u, P) => l + l + u + u + P + P), s = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e), x = s ? {
|
|
616
|
+
r: parseInt(s[1], 16),
|
|
617
|
+
g: parseInt(s[2], 16),
|
|
618
|
+
b: parseInt(s[3], 16)
|
|
619
|
+
} : null;
|
|
620
|
+
return C.current.set(c, x), x;
|
|
621
|
+
}, []), X = (c, e, s) => {
|
|
622
|
+
const x = {
|
|
623
|
+
r: Math.round(c.r + (e.r - c.r) * s),
|
|
624
|
+
g: Math.round(c.g + (e.g - c.g) * s),
|
|
625
|
+
b: Math.round(c.b + (e.b - c.b) * s)
|
|
626
|
+
};
|
|
627
|
+
return `rgb(${x.r}, ${x.g}, ${x.b})`;
|
|
628
|
+
}, N = (c, e) => ({
|
|
629
|
+
columns: Math.ceil(c / B),
|
|
630
|
+
rows: Math.ceil(e / k)
|
|
631
|
+
}), G = (c, e) => {
|
|
632
|
+
g.current = {
|
|
633
|
+
columns: c,
|
|
634
|
+
rows: e
|
|
635
|
+
};
|
|
636
|
+
const s = c * e;
|
|
637
|
+
R.current = Array.from({ length: s }, () => ({
|
|
638
|
+
char: _(),
|
|
639
|
+
color: v(),
|
|
640
|
+
targetColor: v(),
|
|
641
|
+
colorProgress: 1
|
|
642
|
+
}));
|
|
643
|
+
}, b = () => {
|
|
644
|
+
const c = w.current;
|
|
645
|
+
if (!c) return;
|
|
646
|
+
const e = c.parentElement;
|
|
647
|
+
if (!e) return;
|
|
648
|
+
const s = window.devicePixelRatio || 1, x = e.getBoundingClientRect();
|
|
649
|
+
c.width = x.width * s, c.height = x.height * s, c.style.width = `${x.width}px`, c.style.height = `${x.height}px`, I.current && I.current.setTransform(s, 0, 0, s, 0, 0);
|
|
650
|
+
const { columns: i, rows: l } = N(x.width, x.height);
|
|
651
|
+
G(i, l), H();
|
|
652
|
+
}, H = te(() => {
|
|
653
|
+
if (!I.current || R.current.length === 0) return;
|
|
654
|
+
const c = I.current, e = w.current;
|
|
655
|
+
e && (c.clearRect(0, 0, e.width, e.height), c.font = `${$}px monospace`, c.textBaseline = "top", c.textAlign = "left", R.current.forEach((s, x) => {
|
|
656
|
+
const i = x % g.current.columns * B, l = Math.floor(x / g.current.columns) * k;
|
|
657
|
+
c.fillStyle = s.color, c.fillText(s.char, i, l);
|
|
658
|
+
}));
|
|
659
|
+
}, []), F = te(() => {
|
|
660
|
+
if (!R.current || R.current.length === 0) return;
|
|
661
|
+
const c = Math.max(1, Math.floor(R.current.length * 0.02));
|
|
662
|
+
for (let e = 0; e < c; e++) {
|
|
663
|
+
const s = Math.floor(Math.random() * R.current.length);
|
|
664
|
+
R.current[s] && (R.current[s].char = _(), R.current[s].targetColor = v(), f ? R.current[s].colorProgress = 0 : (R.current[s].color = R.current[s].targetColor, R.current[s].colorProgress = 1));
|
|
665
|
+
}
|
|
666
|
+
}, [
|
|
667
|
+
_,
|
|
668
|
+
v,
|
|
669
|
+
f
|
|
670
|
+
]), re = te(() => {
|
|
671
|
+
let c = !1, e = 0;
|
|
672
|
+
R.current.forEach((s) => {
|
|
673
|
+
if (s.colorProgress < 1) {
|
|
674
|
+
e++, s.colorProgress += 0.03, s.colorProgress > 1 && (s.colorProgress = 1);
|
|
675
|
+
const x = L(s.color), i = L(s.targetColor);
|
|
676
|
+
x && i && (s.color = X(x, i, s.colorProgress), c = !0);
|
|
677
|
+
}
|
|
678
|
+
}), c && e > 0 && H();
|
|
679
|
+
}, [L, H]), q = te(() => {
|
|
680
|
+
const c = Date.now();
|
|
681
|
+
c - n.current >= r ? (F(), H(), n.current = c) : f && re(), A.current = requestAnimationFrame(q);
|
|
682
|
+
}, [
|
|
683
|
+
r,
|
|
684
|
+
f,
|
|
685
|
+
F,
|
|
686
|
+
re
|
|
687
|
+
]);
|
|
688
|
+
return ce(() => {
|
|
689
|
+
const c = w.current;
|
|
690
|
+
if (!c) return;
|
|
691
|
+
I.current = c.getContext("2d"), b(), q();
|
|
692
|
+
let e;
|
|
693
|
+
const s = () => {
|
|
694
|
+
clearTimeout(e), e = setTimeout(() => {
|
|
695
|
+
A.current && cancelAnimationFrame(A.current), b(), q();
|
|
696
|
+
}, 100);
|
|
697
|
+
};
|
|
698
|
+
return window.addEventListener("resize", s), () => {
|
|
699
|
+
A.current && cancelAnimationFrame(A.current), window.removeEventListener("resize", s), clearTimeout(e), C.current.clear();
|
|
700
|
+
};
|
|
701
|
+
}, [
|
|
702
|
+
r,
|
|
703
|
+
f,
|
|
704
|
+
a,
|
|
705
|
+
q
|
|
706
|
+
]), Ee("div", {
|
|
707
|
+
className: `${le.container} ${m}`,
|
|
708
|
+
style: y,
|
|
709
|
+
children: [
|
|
710
|
+
W("canvas", {
|
|
711
|
+
ref: w,
|
|
712
|
+
className: le.canvas
|
|
713
|
+
}),
|
|
714
|
+
t && W("div", { className: le.outerVignette }),
|
|
715
|
+
o && W("div", { className: le.centerVignette })
|
|
716
|
+
]
|
|
717
|
+
});
|
|
718
|
+
}), We = fe((a) => {
|
|
719
|
+
const { currentTheme: r } = ue();
|
|
720
|
+
return W(Ue, {
|
|
721
|
+
glitchColors: ae(() => {
|
|
722
|
+
const o = r.colors.variables.primary || "#FA1E16", t = r.colors.variables.info || "#0095ff", f = r.colors.variables.success || "#00d68f", d = (m) => {
|
|
723
|
+
if (m.startsWith("#")) return m;
|
|
724
|
+
const y = m.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
725
|
+
return y ? `#${parseInt(y[1], 10).toString(16).padStart(2, "0")}${parseInt(y[2], 10).toString(16).padStart(2, "0")}${parseInt(y[3], 10).toString(16).padStart(2, "0")}` : m;
|
|
726
|
+
};
|
|
727
|
+
return [
|
|
728
|
+
d(o),
|
|
729
|
+
d(t),
|
|
730
|
+
d(f)
|
|
731
|
+
];
|
|
732
|
+
}, [r]),
|
|
733
|
+
glitchSpeed: 300,
|
|
734
|
+
centerVignette: !0,
|
|
735
|
+
outerVignette: !1,
|
|
736
|
+
smooth: !0,
|
|
737
|
+
...a
|
|
738
|
+
});
|
|
739
|
+
});
|
|
740
|
+
We.displayName = "LetterGlitchBackground";
|
|
741
|
+
const qe = "style-module__container___Hh3-c";
|
|
742
|
+
var Ke = { container: qe }, je = () => {
|
|
743
|
+
const r = document.createElement("canvas");
|
|
744
|
+
r.width = 64, r.height = 64;
|
|
745
|
+
const o = r.getContext("2d");
|
|
746
|
+
if (!o) throw new Error("2D context not available");
|
|
747
|
+
o.fillStyle = "black", o.fillRect(0, 0, r.width, r.height);
|
|
748
|
+
const t = new Le(r);
|
|
749
|
+
t.minFilter = xe, t.magFilter = xe, t.generateMipmaps = !1;
|
|
750
|
+
const f = [];
|
|
751
|
+
let d = null;
|
|
752
|
+
const m = 64;
|
|
753
|
+
let y = 0.1 * 64;
|
|
754
|
+
const w = 1 / m, A = () => {
|
|
755
|
+
o.fillStyle = "black", o.fillRect(0, 0, r.width, r.height);
|
|
756
|
+
}, R = (n) => {
|
|
757
|
+
const h = {
|
|
758
|
+
x: n.x * 64,
|
|
759
|
+
y: (1 - n.y) * 64
|
|
760
|
+
};
|
|
761
|
+
let C = 1;
|
|
762
|
+
const $ = (v) => Math.sin(v * Math.PI / 2), B = (v) => -v * (v - 2);
|
|
763
|
+
n.age < m * 0.3 ? C = $(n.age / (m * 0.3)) : C = B(1 - (n.age - m * 0.3) / (m * 0.7)) || 0, C *= n.force;
|
|
764
|
+
const k = `${(n.vx + 1) / 2 * 255}, ${(n.vy + 1) / 2 * 255}, ${C * 255}`, _ = 320;
|
|
765
|
+
o.shadowOffsetX = _, o.shadowOffsetY = _, o.shadowBlur = y, o.shadowColor = `rgba(${k},${0.22 * C})`, o.beginPath(), o.fillStyle = "rgba(255,0,0,1)", o.arc(h.x - _, h.y - _, y, 0, Math.PI * 2), o.fill();
|
|
766
|
+
};
|
|
767
|
+
return {
|
|
768
|
+
canvas: r,
|
|
769
|
+
texture: t,
|
|
770
|
+
addTouch: (n) => {
|
|
771
|
+
let h = 0, C = 0, $ = 0;
|
|
772
|
+
if (d) {
|
|
773
|
+
const B = n.x - d.x, k = n.y - d.y;
|
|
774
|
+
if (B === 0 && k === 0) return;
|
|
775
|
+
const _ = B * B + k * k, v = Math.sqrt(_);
|
|
776
|
+
C = B / (v || 1), $ = k / (v || 1), h = Math.min(_ * 1e4, 1);
|
|
777
|
+
}
|
|
778
|
+
d = {
|
|
779
|
+
x: n.x,
|
|
780
|
+
y: n.y
|
|
781
|
+
}, f.push({
|
|
782
|
+
x: n.x,
|
|
783
|
+
y: n.y,
|
|
784
|
+
age: 0,
|
|
785
|
+
force: h,
|
|
786
|
+
vx: C,
|
|
787
|
+
vy: $
|
|
788
|
+
});
|
|
789
|
+
},
|
|
790
|
+
update: () => {
|
|
791
|
+
A();
|
|
792
|
+
for (let n = f.length - 1; n >= 0; n--) {
|
|
793
|
+
const h = f[n], C = h.force * w * (1 - h.age / m);
|
|
794
|
+
h.x += h.vx * C, h.y += h.vy * C, h.age++, h.age > m && f.splice(n, 1);
|
|
795
|
+
}
|
|
796
|
+
for (let n = 0; n < f.length; n++) R(f[n]);
|
|
797
|
+
t.needsUpdate = !0;
|
|
798
|
+
},
|
|
799
|
+
set radiusScale(n) {
|
|
800
|
+
y = 0.1 * 64 * n;
|
|
801
|
+
},
|
|
802
|
+
get radiusScale() {
|
|
803
|
+
return y / (0.1 * 64);
|
|
804
|
+
},
|
|
805
|
+
size: 64
|
|
806
|
+
};
|
|
807
|
+
}, Je = (a, r) => new Re("LiquidEffect", `
|
|
808
|
+
uniform sampler2D uTexture;
|
|
809
|
+
uniform float uStrength;
|
|
810
|
+
uniform float uTime;
|
|
811
|
+
uniform float uFreq;
|
|
812
|
+
|
|
813
|
+
void mainUv(inout vec2 uv) {
|
|
814
|
+
vec4 tex = texture2D(uTexture, uv);
|
|
815
|
+
float vx = tex.r * 2.0 - 1.0;
|
|
816
|
+
float vy = tex.g * 2.0 - 1.0;
|
|
817
|
+
float intensity = tex.b;
|
|
818
|
+
|
|
819
|
+
float wave = 0.5 + 0.5 * sin(uTime * uFreq + intensity * 6.2831853);
|
|
820
|
+
|
|
821
|
+
float amt = uStrength * intensity * wave;
|
|
822
|
+
|
|
823
|
+
uv += vec2(vx, vy) * amt;
|
|
824
|
+
}
|
|
825
|
+
`, { uniforms: /* @__PURE__ */ new Map([
|
|
826
|
+
["uTexture", new oe(a)],
|
|
827
|
+
["uStrength", new oe(r?.strength ?? 0.025)],
|
|
828
|
+
["uTime", new oe(0)],
|
|
829
|
+
["uFreq", new oe(r?.freq ?? 4.5)]
|
|
830
|
+
]) }), Me = {
|
|
831
|
+
square: 0,
|
|
832
|
+
circle: 1,
|
|
833
|
+
triangle: 2,
|
|
834
|
+
diamond: 3
|
|
835
|
+
}, Qe = `
|
|
836
|
+
void main() {
|
|
837
|
+
gl_Position = vec4(position, 1.0);
|
|
838
|
+
}
|
|
839
|
+
`, Ze = `
|
|
840
|
+
precision highp float;
|
|
841
|
+
|
|
842
|
+
uniform vec3 uColor;
|
|
843
|
+
uniform vec2 uResolution;
|
|
844
|
+
uniform float uTime;
|
|
845
|
+
uniform float uPixelSize;
|
|
846
|
+
uniform float uScale;
|
|
847
|
+
uniform float uDensity;
|
|
848
|
+
uniform float uPixelJitter;
|
|
849
|
+
uniform int uEnableRipples;
|
|
850
|
+
uniform float uRippleSpeed;
|
|
851
|
+
uniform float uRippleThickness;
|
|
852
|
+
uniform float uRippleIntensity;
|
|
853
|
+
uniform float uEdgeFade;
|
|
854
|
+
|
|
855
|
+
uniform int uShapeType;
|
|
856
|
+
const int SHAPE_SQUARE = 0;
|
|
857
|
+
const int SHAPE_CIRCLE = 1;
|
|
858
|
+
const int SHAPE_TRIANGLE = 2;
|
|
859
|
+
const int SHAPE_DIAMOND = 3;
|
|
860
|
+
|
|
861
|
+
const int MAX_CLICKS = 10;
|
|
862
|
+
|
|
863
|
+
uniform vec2 uClickPos [MAX_CLICKS];
|
|
864
|
+
uniform float uClickTimes[MAX_CLICKS];
|
|
865
|
+
|
|
866
|
+
out vec4 fragColor;
|
|
867
|
+
|
|
868
|
+
float Bayer2(vec2 a) {
|
|
869
|
+
a = floor(a);
|
|
870
|
+
return fract(a.x / 2. + a.y * a.y * .75);
|
|
871
|
+
}
|
|
872
|
+
#define Bayer4(a) (Bayer2(.5*(a))*0.25 + Bayer2(a))
|
|
873
|
+
#define Bayer8(a) (Bayer4(.5*(a))*0.25 + Bayer2(a))
|
|
874
|
+
|
|
875
|
+
#define FBM_OCTAVES 5
|
|
876
|
+
#define FBM_LACUNARITY 1.25
|
|
877
|
+
#define FBM_GAIN 1.0
|
|
878
|
+
|
|
879
|
+
float hash11(float n){ return fract(sin(n)*43758.5453); }
|
|
880
|
+
|
|
881
|
+
float vnoise(vec3 p){
|
|
882
|
+
vec3 ip = floor(p);
|
|
883
|
+
vec3 fp = fract(p);
|
|
884
|
+
float n000 = hash11(dot(ip + vec3(0.0,0.0,0.0), vec3(1.0,57.0,113.0)));
|
|
885
|
+
float n100 = hash11(dot(ip + vec3(1.0,0.0,0.0), vec3(1.0,57.0,113.0)));
|
|
886
|
+
float n010 = hash11(dot(ip + vec3(0.0,1.0,0.0), vec3(1.0,57.0,113.0)));
|
|
887
|
+
float n110 = hash11(dot(ip + vec3(1.0,1.0,0.0), vec3(1.0,57.0,113.0)));
|
|
888
|
+
float n001 = hash11(dot(ip + vec3(0.0,0.0,1.0), vec3(1.0,57.0,113.0)));
|
|
889
|
+
float n101 = hash11(dot(ip + vec3(1.0,0.0,1.0), vec3(1.0,57.0,113.0)));
|
|
890
|
+
float n011 = hash11(dot(ip + vec3(0.0,1.0,1.0), vec3(1.0,57.0,113.0)));
|
|
891
|
+
float n111 = hash11(dot(ip + vec3(1.0,1.0,1.0), vec3(1.0,57.0,113.0)));
|
|
892
|
+
vec3 w = fp*fp*fp*(fp*(fp*6.0-15.0)+10.0);
|
|
893
|
+
float x00 = mix(n000, n100, w.x);
|
|
894
|
+
float x10 = mix(n010, n110, w.x);
|
|
895
|
+
float x01 = mix(n001, n101, w.x);
|
|
896
|
+
float x11 = mix(n011, n111, w.x);
|
|
897
|
+
float y0 = mix(x00, x10, w.y);
|
|
898
|
+
float y1 = mix(x01, x11, w.y);
|
|
899
|
+
return mix(y0, y1, w.z) * 2.0 - 1.0;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
float fbm2(vec2 uv, float t){
|
|
903
|
+
vec3 p = vec3(uv * uScale, t);
|
|
904
|
+
float amp = 1.0;
|
|
905
|
+
float freq = 1.0;
|
|
906
|
+
float sum = 1.0;
|
|
907
|
+
for (int i = 0; i < FBM_OCTAVES; ++i){
|
|
908
|
+
sum += amp * vnoise(p * freq);
|
|
909
|
+
freq *= FBM_LACUNARITY;
|
|
910
|
+
amp *= FBM_GAIN;
|
|
911
|
+
}
|
|
912
|
+
return sum * 0.5 + 0.5;
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
float maskCircle(vec2 p, float cov){
|
|
916
|
+
float r = sqrt(cov) * .25;
|
|
917
|
+
float d = length(p - 0.5) - r;
|
|
918
|
+
float aa = 0.5 * fwidth(d);
|
|
919
|
+
return cov * (1.0 - smoothstep(-aa, aa, d * 2.0));
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
float maskTriangle(vec2 p, vec2 id, float cov){
|
|
923
|
+
bool flip = mod(id.x + id.y, 2.0) > 0.5;
|
|
924
|
+
if (flip) p.x = 1.0 - p.x;
|
|
925
|
+
float r = sqrt(cov);
|
|
926
|
+
float d = p.y - r*(1.0 - p.x);
|
|
927
|
+
float aa = fwidth(d);
|
|
928
|
+
return cov * clamp(0.5 - d/aa, 0.0, 1.0);
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
float maskDiamond(vec2 p, float cov){
|
|
932
|
+
float r = sqrt(cov) * 0.564;
|
|
933
|
+
return step(abs(p.x - 0.49) + abs(p.y - 0.49), r);
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
void main(){
|
|
937
|
+
float pixelSize = uPixelSize;
|
|
938
|
+
vec2 fragCoord = gl_FragCoord.xy - uResolution * .5;
|
|
939
|
+
float aspectRatio = uResolution.x / uResolution.y;
|
|
940
|
+
|
|
941
|
+
vec2 pixelId = floor(fragCoord / pixelSize);
|
|
942
|
+
vec2 pixelUV = fract(fragCoord / pixelSize);
|
|
943
|
+
|
|
944
|
+
float cellPixelSize = 8.0 * pixelSize;
|
|
945
|
+
vec2 cellId = floor(fragCoord / cellPixelSize);
|
|
946
|
+
vec2 cellCoord = cellId * cellPixelSize;
|
|
947
|
+
vec2 uv = cellCoord / uResolution * vec2(aspectRatio, 1.0);
|
|
948
|
+
|
|
949
|
+
float base = fbm2(uv, uTime * 0.05);
|
|
950
|
+
base = base * 0.5 - 0.65;
|
|
951
|
+
|
|
952
|
+
float feed = base + (uDensity - 0.5) * 0.3;
|
|
953
|
+
|
|
954
|
+
float speed = uRippleSpeed;
|
|
955
|
+
float thickness = uRippleThickness;
|
|
956
|
+
const float dampT = 1.0;
|
|
957
|
+
const float dampR = 10.0;
|
|
958
|
+
|
|
959
|
+
if (uEnableRipples == 1) {
|
|
960
|
+
for (int i = 0; i < MAX_CLICKS; ++i){
|
|
961
|
+
vec2 pos = uClickPos[i];
|
|
962
|
+
if (pos.x < 0.0) continue;
|
|
963
|
+
float cellPixelSize = 8.0 * pixelSize;
|
|
964
|
+
vec2 cuv = (((pos - uResolution * .5 - cellPixelSize * .5) / (uResolution))) * vec2(aspectRatio, 1.0);
|
|
965
|
+
float t = max(uTime - uClickTimes[i], 0.0);
|
|
966
|
+
float r = distance(uv, cuv);
|
|
967
|
+
float waveR = speed * t;
|
|
968
|
+
float ring = exp(-pow((r - waveR) / thickness, 2.0));
|
|
969
|
+
float atten = exp(-dampT * t) * exp(-dampR * r);
|
|
970
|
+
feed = max(feed, ring * atten * uRippleIntensity);
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
float bayer = Bayer8(fragCoord / uPixelSize) - 0.5;
|
|
975
|
+
float bw = step(0.5, feed + bayer);
|
|
976
|
+
|
|
977
|
+
float h = fract(sin(dot(floor(fragCoord / uPixelSize), vec2(127.1, 311.7))) * 43758.5453);
|
|
978
|
+
float jitterScale = 1.0 + (h - 0.5) * uPixelJitter;
|
|
979
|
+
float coverage = bw * jitterScale;
|
|
980
|
+
float M;
|
|
981
|
+
if (uShapeType == SHAPE_CIRCLE) M = maskCircle (pixelUV, coverage);
|
|
982
|
+
else if (uShapeType == SHAPE_TRIANGLE) M = maskTriangle(pixelUV, pixelId, coverage);
|
|
983
|
+
else if (uShapeType == SHAPE_DIAMOND) M = maskDiamond(pixelUV, coverage);
|
|
984
|
+
else M = coverage;
|
|
985
|
+
|
|
986
|
+
if (uEdgeFade > 0.0) {
|
|
987
|
+
vec2 norm = gl_FragCoord.xy / uResolution;
|
|
988
|
+
float edge = min(min(norm.x, norm.y), min(1.0 - norm.x, 1.0 - norm.y));
|
|
989
|
+
float fade = smoothstep(0.0, uEdgeFade, edge);
|
|
990
|
+
M *= fade;
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
vec3 color = uColor;
|
|
994
|
+
|
|
995
|
+
// sRGB gamma correction - convert linear to sRGB for accurate color output
|
|
996
|
+
vec3 srgbColor = mix(
|
|
997
|
+
color * 12.92,
|
|
998
|
+
1.055 * pow(color, vec3(1.0 / 2.4)) - 0.055,
|
|
999
|
+
step(0.0031308, color)
|
|
1000
|
+
);
|
|
1001
|
+
|
|
1002
|
+
fragColor = vec4(srgbColor, M);
|
|
1003
|
+
}
|
|
1004
|
+
`, me = 10, Ce = fe(({ variant: a = "square", pixelSize: r = 3, color: o = "#B19EEF", className: t, style: f, antialias: d = !0, patternScale: m = 2, patternDensity: y = 1, liquid: w = !1, liquidStrength: A = 0.1, liquidRadius: R = 1, pixelSizeJitter: g = 0, enableRipples: I = !0, rippleIntensityScale: n = 1, rippleThickness: h = 0.1, rippleSpeed: C = 0.3, liquidWobbleSpeed: $ = 4.5, autoPauseOffscreen: B = !0, speed: k = 0.5, transparent: _ = !0, edgeFade: v = 0.5, noiseAmount: L = 0 }) => {
|
|
1005
|
+
const X = E(null), N = E({ visible: !0 }), G = E(k), b = E(null), H = E(null);
|
|
1006
|
+
return ce(() => {
|
|
1007
|
+
const F = X.current;
|
|
1008
|
+
if (!F) return;
|
|
1009
|
+
G.current = k;
|
|
1010
|
+
const re = [
|
|
1011
|
+
"antialias",
|
|
1012
|
+
"liquid",
|
|
1013
|
+
"noiseAmount"
|
|
1014
|
+
], q = {
|
|
1015
|
+
antialias: d,
|
|
1016
|
+
liquid: w,
|
|
1017
|
+
noiseAmount: L
|
|
1018
|
+
};
|
|
1019
|
+
let c = !1;
|
|
1020
|
+
if (!b.current) c = !0;
|
|
1021
|
+
else if (H.current) {
|
|
1022
|
+
for (const e of re) if (H.current[e] !== q[e]) {
|
|
1023
|
+
c = !0;
|
|
1024
|
+
break;
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
if (c) {
|
|
1028
|
+
if (b.current) {
|
|
1029
|
+
const p = b.current;
|
|
1030
|
+
p.resizeObserver?.disconnect(), cancelAnimationFrame(p.raf), p.quad?.geometry.dispose(), p.material.dispose(), p.composer?.dispose(), p.renderer.dispose(), p.renderer.domElement.parentElement === F && F.removeChild(p.renderer.domElement), b.current = null;
|
|
1031
|
+
}
|
|
1032
|
+
const e = new Fe({
|
|
1033
|
+
canvas: document.createElement("canvas"),
|
|
1034
|
+
antialias: d,
|
|
1035
|
+
alpha: !0,
|
|
1036
|
+
powerPreference: "high-performance"
|
|
1037
|
+
});
|
|
1038
|
+
e.domElement.style.width = "100%", e.domElement.style.height = "100%", e.setPixelRatio(Math.min(window.devicePixelRatio || 1, 1.5)), F.appendChild(e.domElement), _ ? e.setClearAlpha(0) : e.setClearColor(0, 1);
|
|
1039
|
+
const s = {
|
|
1040
|
+
uResolution: { value: new ye(0, 0) },
|
|
1041
|
+
uTime: { value: 0 },
|
|
1042
|
+
uColor: { value: new Pe(o) },
|
|
1043
|
+
uClickPos: { value: Array.from({ length: me }, () => new ye(-1, -1)) },
|
|
1044
|
+
uClickTimes: { value: new Float32Array(me) },
|
|
1045
|
+
uShapeType: { value: Me[a] ?? 0 },
|
|
1046
|
+
uPixelSize: { value: r * e.getPixelRatio() },
|
|
1047
|
+
uScale: { value: m },
|
|
1048
|
+
uDensity: { value: y },
|
|
1049
|
+
uPixelJitter: { value: g },
|
|
1050
|
+
uEnableRipples: { value: I ? 1 : 0 },
|
|
1051
|
+
uRippleSpeed: { value: C },
|
|
1052
|
+
uRippleThickness: { value: h },
|
|
1053
|
+
uRippleIntensity: { value: n },
|
|
1054
|
+
uEdgeFade: { value: v }
|
|
1055
|
+
}, x = new Ie(), i = new Se(-1, 1, 1, -1, 0, 1), l = new ke({
|
|
1056
|
+
vertexShader: Qe,
|
|
1057
|
+
fragmentShader: Ze,
|
|
1058
|
+
uniforms: s,
|
|
1059
|
+
transparent: !0,
|
|
1060
|
+
depthTest: !1,
|
|
1061
|
+
depthWrite: !1,
|
|
1062
|
+
glslVersion: Te
|
|
1063
|
+
}), u = new _e(new Ae(2, 2), l);
|
|
1064
|
+
x.add(u);
|
|
1065
|
+
const P = new be(), V = () => {
|
|
1066
|
+
const p = F.clientWidth || 1, S = F.clientHeight || 1;
|
|
1067
|
+
e.setSize(p, S, !1), s.uResolution.value.set(e.domElement.width, e.domElement.height), b.current?.composer && b.current.composer.setSize(e.domElement.width, e.domElement.height), s.uPixelSize.value = r * e.getPixelRatio();
|
|
1068
|
+
};
|
|
1069
|
+
V();
|
|
1070
|
+
const K = new ResizeObserver(V);
|
|
1071
|
+
K.observe(F);
|
|
1072
|
+
const U = (() => {
|
|
1073
|
+
if (typeof window < "u" && window.crypto?.getRandomValues) {
|
|
1074
|
+
const p = new Uint32Array(1);
|
|
1075
|
+
return window.crypto.getRandomValues(p), p[0] / 4294967295;
|
|
1076
|
+
}
|
|
1077
|
+
return Math.random();
|
|
1078
|
+
})() * 1e3;
|
|
1079
|
+
let T, D, z;
|
|
1080
|
+
if (w) {
|
|
1081
|
+
D = je(), D.radiusScale = R, T = new ve(e);
|
|
1082
|
+
const p = new ge(x, i);
|
|
1083
|
+
z = Je(D.texture, {
|
|
1084
|
+
strength: A,
|
|
1085
|
+
freq: $
|
|
1086
|
+
});
|
|
1087
|
+
const S = new pe(i, z);
|
|
1088
|
+
S.renderToScreen = !0, T.addPass(p), T.addPass(S);
|
|
1089
|
+
}
|
|
1090
|
+
if (L > 0) {
|
|
1091
|
+
T || (T = new ve(e), T.addPass(new ge(x, i)));
|
|
1092
|
+
const p = new pe(i, new Re("NoiseEffect", "uniform float uTime; uniform float uAmount; float hash(vec2 p){ return fract(sin(dot(p, vec2(127.1,311.7))) * 43758.5453);} void mainUv(inout vec2 uv){} void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){ float n=hash(floor(uv*vec2(1920.0,1080.0))+floor(uTime*60.0)); float g=(n-0.5)*uAmount; outputColor=inputColor+vec4(vec3(g),0.0);} ", { uniforms: /* @__PURE__ */ new Map([["uTime", new oe(0)], ["uAmount", new oe(L)]]) }));
|
|
1093
|
+
p.renderToScreen = !0, T && T.passes.length > 0 && T.passes.forEach((S) => {
|
|
1094
|
+
const Y = S;
|
|
1095
|
+
Y.renderToScreen = !1;
|
|
1096
|
+
}), T.addPass(p);
|
|
1097
|
+
}
|
|
1098
|
+
T && T.setSize(e.domElement.width, e.domElement.height);
|
|
1099
|
+
const Z = (p) => {
|
|
1100
|
+
const S = e.domElement.getBoundingClientRect(), Y = e.domElement.width / S.width, j = e.domElement.height / S.height;
|
|
1101
|
+
return {
|
|
1102
|
+
fx: (p.clientX - S.left) * Y,
|
|
1103
|
+
fy: (S.height - (p.clientY - S.top)) * j,
|
|
1104
|
+
w: e.domElement.width,
|
|
1105
|
+
h: e.domElement.height
|
|
1106
|
+
};
|
|
1107
|
+
}, M = (p) => {
|
|
1108
|
+
const { fx: S, fy: Y } = Z(p), j = b.current?.clickIx ?? 0;
|
|
1109
|
+
s.uClickPos.value[j].set(S, Y), s.uClickTimes.value[j] = s.uTime.value, b.current && (b.current.clickIx = (j + 1) % me);
|
|
1110
|
+
}, ie = (p) => {
|
|
1111
|
+
if (!D) return;
|
|
1112
|
+
const { fx: S, fy: Y, w: j, h: de } = Z(p);
|
|
1113
|
+
D.addTouch({
|
|
1114
|
+
x: S / j,
|
|
1115
|
+
y: Y / de
|
|
1116
|
+
});
|
|
1117
|
+
};
|
|
1118
|
+
e.domElement.addEventListener("pointerdown", M, { passive: !0 }), e.domElement.addEventListener("pointermove", ie, { passive: !0 });
|
|
1119
|
+
let ee = 0, se = 0;
|
|
1120
|
+
const ne = 1e3 / 30, J = (p) => {
|
|
1121
|
+
if (B && !N.current.visible) {
|
|
1122
|
+
ee = requestAnimationFrame(J);
|
|
1123
|
+
return;
|
|
1124
|
+
}
|
|
1125
|
+
const S = p - se;
|
|
1126
|
+
if (S < ne) {
|
|
1127
|
+
ee = requestAnimationFrame(J);
|
|
1128
|
+
return;
|
|
1129
|
+
}
|
|
1130
|
+
if (se = p - S % ne, s.uTime.value = U + P.getElapsedTime() * G.current, z) {
|
|
1131
|
+
const Y = z.uniforms.get("uTime");
|
|
1132
|
+
Y && (Y.value = s.uTime.value);
|
|
1133
|
+
}
|
|
1134
|
+
T ? (D && D.update(), T.passes.forEach((Y) => {
|
|
1135
|
+
const j = Y;
|
|
1136
|
+
j.effects && j.effects.forEach((de) => {
|
|
1137
|
+
const he = de.uniforms?.get("uTime");
|
|
1138
|
+
he && (he.value = s.uTime.value);
|
|
1139
|
+
});
|
|
1140
|
+
}), T.render()) : e.render(x, i), ee = requestAnimationFrame(J);
|
|
1141
|
+
};
|
|
1142
|
+
ee = requestAnimationFrame((p) => {
|
|
1143
|
+
se = p, J(p);
|
|
1144
|
+
}), b.current = {
|
|
1145
|
+
renderer: e,
|
|
1146
|
+
scene: x,
|
|
1147
|
+
camera: i,
|
|
1148
|
+
material: l,
|
|
1149
|
+
clock: P,
|
|
1150
|
+
clickIx: 0,
|
|
1151
|
+
uniforms: s,
|
|
1152
|
+
resizeObserver: K,
|
|
1153
|
+
raf: ee,
|
|
1154
|
+
quad: u,
|
|
1155
|
+
timeOffset: U,
|
|
1156
|
+
composer: T,
|
|
1157
|
+
touch: D,
|
|
1158
|
+
liquidEffect: z
|
|
1159
|
+
};
|
|
1160
|
+
} else {
|
|
1161
|
+
const e = b.current;
|
|
1162
|
+
if (e.uniforms.uShapeType.value = Me[a] ?? 0, e.uniforms.uPixelSize.value = r * e.renderer.getPixelRatio(), e.uniforms.uColor.value.set(o), e.uniforms.uScale.value = m, e.uniforms.uDensity.value = y, e.uniforms.uPixelJitter.value = g, e.uniforms.uEnableRipples.value = I ? 1 : 0, e.uniforms.uRippleIntensity.value = n, e.uniforms.uRippleThickness.value = h, e.uniforms.uRippleSpeed.value = C, e.uniforms.uEdgeFade.value = v, _ ? e.renderer.setClearAlpha(0) : e.renderer.setClearColor(0, 1), e.liquidEffect) {
|
|
1163
|
+
const s = e.liquidEffect, x = s.uniforms.get("uStrength");
|
|
1164
|
+
x && (x.value = A);
|
|
1165
|
+
const i = s.uniforms.get("uFreq");
|
|
1166
|
+
i && (i.value = $);
|
|
1167
|
+
}
|
|
1168
|
+
e.touch && (e.touch.radiusScale = R);
|
|
1169
|
+
}
|
|
1170
|
+
return H.current = q, () => {
|
|
1171
|
+
if (b.current && c || !b.current) return;
|
|
1172
|
+
const e = b.current;
|
|
1173
|
+
e.resizeObserver?.disconnect(), cancelAnimationFrame(e.raf), e.quad?.geometry.dispose(), e.material.dispose(), e.composer?.dispose(), e.renderer.dispose(), e.renderer.domElement.parentElement === F && F.removeChild(e.renderer.domElement), b.current = null;
|
|
1174
|
+
};
|
|
1175
|
+
}, [
|
|
1176
|
+
d,
|
|
1177
|
+
w,
|
|
1178
|
+
L,
|
|
1179
|
+
r,
|
|
1180
|
+
m,
|
|
1181
|
+
y,
|
|
1182
|
+
I,
|
|
1183
|
+
n,
|
|
1184
|
+
h,
|
|
1185
|
+
C,
|
|
1186
|
+
g,
|
|
1187
|
+
v,
|
|
1188
|
+
_,
|
|
1189
|
+
A,
|
|
1190
|
+
R,
|
|
1191
|
+
$,
|
|
1192
|
+
B,
|
|
1193
|
+
a,
|
|
1194
|
+
o,
|
|
1195
|
+
k
|
|
1196
|
+
]), W("div", {
|
|
1197
|
+
ref: X,
|
|
1198
|
+
className: `${Ke.container} ${t ?? ""}`,
|
|
1199
|
+
style: f,
|
|
1200
|
+
"aria-label": "PixelBlast interactive background"
|
|
1201
|
+
});
|
|
1202
|
+
});
|
|
1203
|
+
Ce.displayName = "PixelBlast";
|
|
1204
|
+
var et = fe((a) => {
|
|
1205
|
+
const { currentTheme: r } = ue();
|
|
1206
|
+
return W(Ce, {
|
|
1207
|
+
color: ae(() => {
|
|
1208
|
+
const o = r.colors.variables.primary || "#B19EEF";
|
|
1209
|
+
return ((f) => {
|
|
1210
|
+
if (f.startsWith("#")) return f;
|
|
1211
|
+
const d = f.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
1212
|
+
return d ? `#${parseInt(d[1], 10).toString(16).padStart(2, "0")}${parseInt(d[2], 10).toString(16).padStart(2, "0")}${parseInt(d[3], 10).toString(16).padStart(2, "0")}` : f;
|
|
1213
|
+
})(o);
|
|
1214
|
+
}, [r]),
|
|
1215
|
+
variant: "square",
|
|
1216
|
+
pixelSize: 6,
|
|
1217
|
+
patternScale: 2,
|
|
1218
|
+
patternDensity: 1,
|
|
1219
|
+
pixelSizeJitter: 0,
|
|
1220
|
+
enableRipples: !0,
|
|
1221
|
+
rippleSpeed: 0.3,
|
|
1222
|
+
rippleThickness: 0.12,
|
|
1223
|
+
rippleIntensityScale: 1.2,
|
|
1224
|
+
liquid: !1,
|
|
1225
|
+
liquidStrength: 0.12,
|
|
1226
|
+
liquidRadius: 1.2,
|
|
1227
|
+
liquidWobbleSpeed: 5,
|
|
1228
|
+
speed: 0.3,
|
|
1229
|
+
edgeFade: 0.25,
|
|
1230
|
+
transparent: !0,
|
|
1231
|
+
antialias: !1,
|
|
1232
|
+
...a
|
|
1233
|
+
});
|
|
1234
|
+
});
|
|
1235
|
+
et.displayName = "PixelBlastBackground";
|
|
1236
|
+
export {
|
|
1237
|
+
st as i,
|
|
1238
|
+
We as n,
|
|
1239
|
+
ct as r,
|
|
1240
|
+
et as t
|
|
1241
|
+
};
|
|
1242
|
+
|
|
1243
|
+
//# sourceMappingURL=chunk-animations-Brp-bsaE.mjs.map
|