ai-wrapped 1.16.0 → 1.18.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/LICENSE +24 -0
- package/dist/assets/Aurora-gPgXaQaG.js +145 -0
- package/dist/assets/{BotAvatar-DF0epPmz.js → BotAvatar-Bur2fckZ.js} +1 -1
- package/dist/assets/{CrystalizedBall-8nXHKUrK.js → CrystalizedBall-KWGPAJYI.js} +1 -1
- package/dist/assets/DarkVeil-BgGKjyIE.js +164 -0
- package/dist/assets/{EchoText-BBpfwkNe.js → EchoText-BrB32uyp.js} +1 -1
- package/dist/assets/FaultyTerminal-DDw4c9b4.js +391 -0
- package/dist/assets/Galaxy-Dgc9RDEH.js +197 -0
- package/dist/assets/{GlowCursor-Cyc4E_Sy.js → GlowCursor-BZCHElFf.js} +1 -1
- package/dist/assets/{Heatwave-BRCZhums.js → Heatwave-CJzverw9.js} +1 -1
- package/dist/assets/Iridescence-BvMXvo4z.js +103 -0
- package/dist/assets/LetterGlitch-BfoWmQyO.js +94 -0
- package/dist/assets/{LightTunnel-BhYVyLW0.js → LightTunnel-Dig-ybUd.js} +1 -1
- package/dist/assets/{LineSpiral-DXvjTFr3.js → LineSpiral-BORPdW5M.js} +1 -1
- package/dist/assets/Plasma-CHJExTBw.js +113 -0
- package/dist/assets/Prism-19JE2gzg.js +78 -0
- package/dist/assets/{SideRays-D3YRo98l.js → SideRays-DcOr-gOm.js} +1 -1
- package/dist/assets/{SlicedWaves-_jMt9oC8.js → SlicedWaves-BUD_9aqV.js} +1 -1
- package/dist/assets/{SplitFlapText-Cm16Tvxb.js → SplitFlapText-D5KE4_3P.js} +1 -1
- package/dist/assets/{Strands-Bn08Tum0.js → Strands-CtNx3Esy.js} +1 -1
- package/dist/assets/{TechText-CQvGbyFP.js → TechText-BtSyI_Dm.js} +1 -1
- package/dist/assets/Threads-H6WESD1W.js +124 -0
- package/dist/assets/index-BstFwFxc.js +161 -0
- package/dist/assets/index-yPH2MNv-.css +1 -0
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/skills/ai-wrapped/SKILL.md +3 -1
- package/src/bun/aggregator.ts +7 -9
- package/src/bun/discovery/claude.ts +29 -7
- package/src/bun/headless.ts +2 -0
- package/src/bun/normalizer.ts +12 -0
- package/src/bun/parsers/additional.ts +26 -2
- package/src/bun/parsers/claude.ts +57 -0
- package/src/bun/parsers/codex.ts +28 -17
- package/src/bun/parsers/promptCounts.test.ts +53 -0
- package/src/bun/promptWords.test.ts +17 -0
- package/src/bun/promptWords.ts +39 -0
- package/src/bun/queries.ts +4 -0
- package/src/bun/scan.test.ts +64 -0
- package/src/bun/scan.ts +101 -38
- package/src/bun/store.ts +49 -2
- package/src/shared/buildPayload.ts +1 -0
- package/src/shared/schema.ts +2 -0
- package/src/shared/session-types.ts +4 -0
- package/src/shared/shareData.ts +22 -2
- package/dist/assets/index-CH-7pBbW.js +0 -161
- package/dist/assets/index-Dh3d1sc7.css +0 -1
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import{r as R,m as Ae,j as ie}from"./index-BstFwFxc.js";const _e=`#version 300 es
|
|
2
|
+
in vec2 aPosition;
|
|
3
|
+
void main() {
|
|
4
|
+
gl_Position = vec4(aPosition, 0.0, 1.0);
|
|
5
|
+
}`,Pe=`#version 300 es
|
|
6
|
+
precision highp float;
|
|
7
|
+
uniform vec2 uView;
|
|
8
|
+
uniform vec2 uScale;
|
|
9
|
+
uniform float uZoom;
|
|
10
|
+
uniform vec2 uTurn;
|
|
11
|
+
uniform float uTime;
|
|
12
|
+
uniform float uFlow;
|
|
13
|
+
uniform float uWarp;
|
|
14
|
+
uniform vec3 uSeed;
|
|
15
|
+
uniform vec4 uPointer;
|
|
16
|
+
uniform vec2 uDrag;
|
|
17
|
+
uniform float uUnfold;
|
|
18
|
+
uniform float uDither;
|
|
19
|
+
out vec4 outColor;
|
|
20
|
+
|
|
21
|
+
vec4 sigmoid(vec4 x) {
|
|
22
|
+
return 1.0 / (1.0 + exp(-x));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
vec4 cppn(vec2 coordinate, vec3 latent) {
|
|
26
|
+
vec4 buf[8];
|
|
27
|
+
buf[6]=vec4(coordinate.x,coordinate.y,latent.x,latent.y);
|
|
28
|
+
buf[7]=vec4(latent.z,sqrt(coordinate.x*coordinate.x+coordinate.y*coordinate.y),0.,0.);
|
|
29
|
+
buf[0]=mat4(vec4(6.5404263,-3.6126034,0.7590882,-1.13613),vec4(2.4582713,3.1660357,1.2219609,0.06276096),vec4(-5.478085,-6.159632,1.8701609,-4.7742867),vec4(6.039214,-5.542865,-0.90925294,3.251348))*buf[6]+mat4(vec4(0.8473259,-5.722911,3.975766,1.6522468),vec4(-0.24321538,0.5839259,-1.7661959,-5.350116),vec4(0.,0.,0.,0.),vec4(0.,0.,0.,0.))*buf[7]+vec4(0.21808943,1.1243913,-1.7969975,5.0294676);
|
|
30
|
+
buf[1]=mat4(vec4(-3.3522482,-6.0612736,0.55641043,-4.4719114),vec4(0.8631464,1.7432913,5.643898,1.6106541),vec4(2.4941394,-3.5012043,1.7184316,6.357333),vec4(3.310376,8.209261,1.1355612,-1.165539))*buf[6]+mat4(vec4(5.24046,-13.034365,0.009859298,15.870829),vec4(2.987511,3.129433,-0.89023495,-1.6822904),vec4(0.,0.,0.,0.),vec4(0.,0.,0.,0.))*buf[7]+vec4(-5.9457836,-6.573602,-0.8812491,1.5436668);
|
|
31
|
+
buf[0]=sigmoid(buf[0]);buf[1]=sigmoid(buf[1]);
|
|
32
|
+
buf[2]=mat4(vec4(-15.219568,8.095543,-2.429353,-1.9381982),vec4(-5.951362,4.3115187,2.6393783,1.274315),vec4(-7.3145227,6.7297835,5.2473326,5.9411426),vec4(5.0796127,8.979051,-1.7278991,-1.158976))*buf[6]+mat4(vec4(-11.967154,-11.608155,6.1486754,11.237008),vec4(2.124141,-6.263192,-1.7050359,-0.7021966),vec4(0.,0.,0.,0.),vec4(0.,0.,0.,0.))*buf[7]+vec4(-4.17164,-3.2281182,-4.576417,-3.6401186);
|
|
33
|
+
buf[3]=mat4(vec4(3.1832156,-13.738922,1.879223,3.233465),vec4(0.64300746,12.768129,1.9141049,0.50990224),vec4(-0.049295485,4.4807224,1.4733979,1.801449),vec4(5.0039253,13.000481,3.3991797,-4.5561905))*buf[6]+mat4(vec4(-0.1285731,7.720628,-3.1425676,4.742367),vec4(0.6393625,3.714393,-0.8108378,-0.39174938),vec4(0.,0.,0.,0.),vec4(0.,0.,0.,0.))*buf[7]+vec4(-1.1811101,-21.621881,0.7851888,1.2329718);
|
|
34
|
+
buf[2]=sigmoid(buf[2]);buf[3]=sigmoid(buf[3]);
|
|
35
|
+
buf[4]=mat4(vec4(5.214916,-7.183024,2.7228765,2.6592617),vec4(-5.601878,-25.3591,4.067988,0.4602802),vec4(-10.57759,24.286327,21.102104,37.546658),vec4(4.3024497,-1.9625226,2.3458803,-1.372816))*buf[0]+mat4(vec4(-17.6526,-10.507558,2.2587414,12.462782),vec4(6.265566,-502.75443,-12.642513,0.9112289),vec4(-10.983244,20.741234,-9.701768,-0.7635988),vec4(5.383626,1.4819539,-4.1911616,-4.8444734))*buf[1]+mat4(vec4(12.785233,-16.345072,-0.39901125,1.7955981),vec4(-30.48365,-1.8345358,1.4542528,-1.1118771),vec4(19.872723,-7.337935,-42.941723,-98.52709),vec4(8.337645,-2.7312303,-2.2927687,-36.142323))*buf[2]+mat4(vec4(-16.298317,3.5471997,-0.44300047,-9.444417),vec4(57.5077,-35.609753,16.163465,-4.1534753),vec4(-0.07470326,-3.8656476,-7.0901804,3.1523974),vec4(-12.559385,-7.077619,1.490437,-0.8211543))*buf[3]+vec4(-7.67914,15.927437,1.3207729,-1.6686112);
|
|
36
|
+
buf[5]=mat4(vec4(-1.4109162,-0.372762,-3.770383,-21.367174),vec4(-6.2103205,-9.35908,0.92529047,8.82561),vec4(11.460242,-22.348068,13.625772,-18.693201),vec4(-0.3429052,-3.9905605,-2.4626114,-0.45033523))*buf[0]+mat4(vec4(7.3481627,-4.3661838,-6.3037653,-3.868115),vec4(1.5462853,6.5488915,1.9701879,-0.58291394),vec4(6.5858274,-2.2180402,3.7127688,-1.3730392),vec4(-5.7973905,10.134961,-2.3395722,-5.965605))*buf[1]+mat4(vec4(-2.5132585,-6.6685553,-1.4029363,-0.16285264),vec4(-0.37908727,0.53738135,4.389061,-1.3024765),vec4(-0.70647055,2.0111287,-5.1659346,-3.728635),vec4(-13.562562,10.487719,-0.9173751,-2.6487076))*buf[2]+mat4(vec4(-8.645013,6.5546675,-6.3944063,-5.5933375),vec4(-0.57783127,-1.077275,36.91025,5.736769),vec4(14.283112,3.7146652,7.1452246,-4.5958776),vec4(2.7192075,3.6021907,-4.366337,-2.3653464))*buf[3]+vec4(-5.9000807,-4.329569,1.2427121,8.59503);
|
|
37
|
+
buf[4]=sigmoid(buf[4]);buf[5]=sigmoid(buf[5]);
|
|
38
|
+
buf[6]=mat4(vec4(-1.61102,0.7970257,1.4675229,0.20917463),vec4(-28.793737,-7.1390953,1.5025433,4.656581),vec4(-10.94861,39.66238,0.74318546,-10.095605),vec4(-0.7229728,-1.5483948,0.7301322,2.1687684))*buf[0]+mat4(vec4(3.2547753,21.489103,-1.0194173,-3.3100595),vec4(-3.7316632,-3.3792162,-7.223193,-0.23685838),vec4(13.1804495,0.7916005,5.338587,5.687114),vec4(-4.167605,-17.798311,-6.815736,-1.6451967))*buf[1]+mat4(vec4(0.604885,-7.800309,-7.213122,-2.741014),vec4(-3.522382,-0.12359311,-0.5258442,0.43852118),vec4(9.6752825,-22.853785,2.062431,0.099892326),vec4(-4.3196306,-17.730087,2.5184598,5.30267))*buf[2]+mat4(vec4(-6.545563,-15.790176,-6.0438633,-5.415399),vec4(-43.591583,28.551912,-16.00161,18.84728),vec4(4.212382,8.394307,3.0958717,8.657522),vec4(-5.0237565,-4.450633,-4.4768,-5.5010443))*buf[3]+mat4(vec4(1.6985557,-67.05806,6.897715,1.9004834),vec4(1.8680354,2.3915145,2.5231109,4.081538),vec4(11.158006,1.7294737,2.0738268,7.386411),vec4(-4.256034,-306.24686,8.258898,-17.132736))*buf[4]+mat4(vec4(1.6889864,-4.5852966,3.8534803,-6.3482175),vec4(1.3543309,-1.2640043,9.932754,2.9079645),vec4(-5.2770967,0.07150358,-0.13962056,3.3269649),vec4(28.34703,-4.918278,6.1044083,4.085355))*buf[5]+vec4(6.6818056,12.522166,-3.7075126,-4.104386);
|
|
39
|
+
buf[7]=mat4(vec4(-8.265602,-4.7027016,5.098234,0.7509808),vec4(8.6507845,-17.15949,16.51939,-8.884479),vec4(-4.036479,-2.3946867,-2.6055532,-1.9866527),vec4(-2.2167742,-1.8135649,-5.9759874,4.8846445))*buf[0]+mat4(vec4(6.7790847,3.5076547,-2.8191125,-2.7028968),vec4(-5.743024,-0.27844876,1.4958696,-5.0517144),vec4(13.122226,15.735168,-2.9397483,-4.101023),vec4(-14.375265,-5.030483,-6.2599335,2.9848232))*buf[1]+mat4(vec4(4.0950394,-0.94011575,-5.674733,4.755022),vec4(4.3809423,4.8310084,1.7425908,-3.437416),vec4(2.117492,0.16342592,-104.56341,16.949184),vec4(-5.22543,-2.994248,3.8350096,-1.9364246))*buf[2]+mat4(vec4(-5.900337,1.7946124,-13.604192,-3.8060522),vec4(6.6583457,31.911177,25.164474,91.81147),vec4(11.840538,4.1503043,-0.7314397,6.768467),vec4(-6.3967767,4.034772,6.1714606,-0.32874924))*buf[3]+mat4(vec4(3.4992442,-196.91893,-8.923708,2.8142626),vec4(3.4806502,-3.1846354,5.1725626,5.1804223),vec4(-2.4009497,15.585794,1.2863957,2.0252278),vec4(-71.25271,-62.441242,-8.138444,0.50670296))*buf[4]+mat4(vec4(-12.291733,-11.176166,-7.3474145,4.390294),vec4(10.805477,5.6337385,-0.9385842,-4.7348723),vec4(-12.869276,-7.039391,5.3029537,7.5436664),vec4(1.4593618,8.91898,3.5101583,5.840625))*buf[5]+vec4(2.2415268,-6.705987,-0.98861027,-2.117676);
|
|
40
|
+
buf[6]=sigmoid(buf[6]);buf[7]=sigmoid(buf[7]);
|
|
41
|
+
buf[0]=mat4(vec4(1.6794263,1.3817469,2.9625452,0.),vec4(-1.8834411,-1.4806935,-3.5924516,0.),vec4(-1.3279216,-1.0918057,-2.3124623,0.),vec4(0.2662234,0.23235129,0.44178495,0.))*buf[0]+mat4(vec4(-0.6299101,-0.5945583,-0.9125601,0.),vec4(0.17828953,0.18300213,0.18182953,0.),vec4(-2.96544,-2.5819945,-4.9001055,0.),vec4(1.4195864,1.1868085,2.5176322,0.))*buf[1]+mat4(vec4(-1.2584374,-1.0552157,-2.1688404,0.),vec4(-0.7200217,-0.52666044,-1.438251,0.),vec4(0.15345335,0.15196142,0.272854,0.),vec4(0.945728,0.8861938,1.2766753,0.))*buf[2]+mat4(vec4(-2.4218085,-1.968602,-4.35166,0.),vec4(-22.683098,-18.0544,-41.954372,0.),vec4(0.63792,0.5470648,1.1078634,0.),vec4(-1.5489894,-1.3075932,-2.6444845,0.))*buf[3]+mat4(vec4(-0.49252132,-0.39877754,-0.91366625,0.),vec4(0.95609266,0.7923952,1.640221,0.),vec4(0.30616966,0.15693925,0.8639857,0.),vec4(1.1825981,0.94504964,2.176963,0.))*buf[4]+mat4(vec4(0.35446745,0.3293795,0.59547555,0.),vec4(-0.58784515,-0.48177817,-1.0614829,0.),vec4(2.5271258,1.9991658,4.6846647,0.),vec4(0.13042648,0.08864098,0.30187556,0.))*buf[5]+mat4(vec4(-1.7718065,-1.4033192,-3.3355875,0.),vec4(3.1664357,2.638297,5.378702,0.),vec4(-3.1724713,-2.6107926,-5.549295,0.),vec4(-2.851368,-2.249092,-5.3013067,0.))*buf[6]+mat4(vec4(1.5203838,1.2212278,2.8404984,0.),vec4(1.5210563,1.2651345,2.683903,0.),vec4(2.9789467,2.4364579,5.2347264,0.),vec4(2.2270417,1.8825914,3.8028636,0.))*buf[7]+vec4(-1.5468478,-3.6171484,0.24762098,0.);
|
|
42
|
+
buf[0]=sigmoid(buf[0]);
|
|
43
|
+
return vec4(buf[0].x,buf[0].y,buf[0].z,1.);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
float hash(vec2 p) {
|
|
47
|
+
p = fract(p * vec2(123.34, 456.21));
|
|
48
|
+
p += dot(p, p + 45.32);
|
|
49
|
+
return fract(p.x * p.y);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
mat2 rotate(float a) {
|
|
53
|
+
float c = cos(a);
|
|
54
|
+
float s = sin(a);
|
|
55
|
+
return mat2(c, s, -s, c);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
void main() {
|
|
59
|
+
vec2 css = gl_FragCoord.xy * uScale;
|
|
60
|
+
vec2 uv = (css * 2.0 - uView) / uView.y;
|
|
61
|
+
uv.y = -uv.y;
|
|
62
|
+
vec2 anchor = vec2(uView.x / uView.y, -1.0);
|
|
63
|
+
|
|
64
|
+
vec2 pointer = vec2(uPointer.x * 2.0 - uView.x, uPointer.y * 2.0 - uView.y) / uView.y;
|
|
65
|
+
vec2 offset = uv - pointer;
|
|
66
|
+
float touch = uPointer.z * exp(-dot(offset, offset) / (uPointer.w * uPointer.w));
|
|
67
|
+
uv = pointer + rotate(touch * 0.6) * offset;
|
|
68
|
+
uv -= uDrag * touch;
|
|
69
|
+
|
|
70
|
+
float t = uTime;
|
|
71
|
+
uv = rotate(0.06 * uFlow * sin(t * 0.17)) * uv;
|
|
72
|
+
uv += 0.05 * uFlow * vec2(sin(t * 0.21), cos(t * 0.13));
|
|
73
|
+
uv = anchor + mat2(uTurn.x, uTurn.y, -uTurn.y, uTurn.x) * uv * 2.0 / uZoom;
|
|
74
|
+
uv += uWarp * vec2(sin(uv.y * 6.283 + t * 0.5), cos(uv.x * 6.283 + t * 0.5)) * 0.05;
|
|
75
|
+
|
|
76
|
+
vec3 latent = uSeed + 0.1 * uFlow * vec3(sin(0.3 * t), sin(0.69 * t), sin(0.44 * t));
|
|
77
|
+
latent += touch * vec3(0.12, -0.1, 0.16);
|
|
78
|
+
latent.z += uUnfold;
|
|
79
|
+
|
|
80
|
+
vec3 veil = cppn(uv, latent).rgb;
|
|
81
|
+
veil += (hash(gl_FragCoord.xy) - 0.5) * uDither;
|
|
82
|
+
outColor = vec4(veil, 1.0);
|
|
83
|
+
}`,Se=`#version 300 es
|
|
84
|
+
precision highp float;
|
|
85
|
+
uniform sampler2D uField;
|
|
86
|
+
uniform vec2 uResolution;
|
|
87
|
+
uniform vec2 uTexel;
|
|
88
|
+
uniform vec3 uColor;
|
|
89
|
+
uniform vec3 uInk;
|
|
90
|
+
uniform float uGain;
|
|
91
|
+
uniform float uSheen;
|
|
92
|
+
uniform float uGlow;
|
|
93
|
+
uniform float uPresence;
|
|
94
|
+
uniform float uGrain;
|
|
95
|
+
uniform float uFade;
|
|
96
|
+
uniform float uOpacity;
|
|
97
|
+
uniform float uTime;
|
|
98
|
+
uniform float uLightMode;
|
|
99
|
+
uniform vec4 uLight;
|
|
100
|
+
out vec4 outColor;
|
|
101
|
+
|
|
102
|
+
float hash(vec2 p) {
|
|
103
|
+
p = fract(p * vec2(123.34, 456.21));
|
|
104
|
+
p += dot(p, p + 45.32);
|
|
105
|
+
return fract(p.x * p.y);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
float smootherstep(float edge, float x) {
|
|
109
|
+
float t = clamp(x / max(edge, 0.0001), 0.0, 1.0);
|
|
110
|
+
return t * t * t * (t * (t * 6.0 - 15.0) + 10.0);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
float level(vec2 uv, float lod) {
|
|
114
|
+
return textureLod(uField, uv, lod).b;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
void main() {
|
|
118
|
+
vec2 uv = gl_FragCoord.xy / uResolution;
|
|
119
|
+
float base = clamp(level(uv, 0.0), 0.0, 1.0);
|
|
120
|
+
float glow = 0.0;
|
|
121
|
+
glow += level(uv, 2.0) * 0.4;
|
|
122
|
+
glow += level(uv, 3.0) * 0.3;
|
|
123
|
+
glow += level(uv, 4.0) * 0.2;
|
|
124
|
+
glow += level(uv, 5.0) * 0.1;
|
|
125
|
+
|
|
126
|
+
float dx = level(uv + vec2(uTexel.x, 0.0), 0.0) - level(uv - vec2(uTexel.x, 0.0), 0.0);
|
|
127
|
+
float dy = level(uv + vec2(0.0, uTexel.y), 0.0) - level(uv - vec2(0.0, uTexel.y), 0.0);
|
|
128
|
+
vec2 slope = vec2(dx / (2.0 * uTexel.x) * (uResolution.y / uResolution.x), dy / (2.0 * uTexel.y));
|
|
129
|
+
vec3 normal = normalize(vec3(-slope * 0.12, 1.0));
|
|
130
|
+
vec2 pixel = gl_FragCoord.xy / uResolution.y;
|
|
131
|
+
vec3 toLight = normalize(vec3(uLight.xy - pixel, 0.7));
|
|
132
|
+
vec3 halfway = normalize(toLight + vec3(0.0, 0.0, 1.0));
|
|
133
|
+
float facing = max(dot(normal, halfway), 0.0);
|
|
134
|
+
float sheen = pow(facing, 40.0) * smoothstep(0.08, 0.7, base);
|
|
135
|
+
float near = uLight.z * exp(-dot(uLight.xy - pixel, uLight.xy - pixel) / 0.2);
|
|
136
|
+
|
|
137
|
+
float energy = pow(base, 2.2) * uGain * (1.0 + near * 0.4);
|
|
138
|
+
energy += pow(glow, 2.2) * uGlow * uGain;
|
|
139
|
+
energy *= uPresence;
|
|
140
|
+
vec3 light = uColor * energy;
|
|
141
|
+
light += uColor * energy * energy * 0.35;
|
|
142
|
+
vec3 gleam = mix(uColor * 2.0, vec3(1.0), 0.55);
|
|
143
|
+
light += gleam * sheen * uSheen * (0.8 + near * 0.4) * uPresence;
|
|
144
|
+
|
|
145
|
+
float edge = uFade * 0.5;
|
|
146
|
+
float mask = smootherstep(edge, uv.x) * smootherstep(edge, 1.0 - uv.x) * smootherstep(edge, uv.y) * smootherstep(edge, 1.0 - uv.y);
|
|
147
|
+
mask *= uOpacity;
|
|
148
|
+
float grain = (hash(gl_FragCoord.xy + fract(uTime * 7.31) * 113.0) - 0.5) * uGrain;
|
|
149
|
+
float dither = (hash(gl_FragCoord.yx + 31.7) - 0.5) / 255.0;
|
|
150
|
+
|
|
151
|
+
float peak = max(light.r, max(light.g, light.b));
|
|
152
|
+
if (uLightMode > 0.5) {
|
|
153
|
+
float cover = 1.0 - exp(-peak * 1.6);
|
|
154
|
+
vec3 ink = mix(uInk, uInk * 0.82, smoothstep(0.5, 1.0, cover));
|
|
155
|
+
ink = mix(ink, vec3(1.0), clamp(sheen * uSheen * 1.5, 0.0, 1.0) * 0.8);
|
|
156
|
+
float alpha = clamp(cover * 0.85 * (1.0 + grain) + dither, 0.0, 1.0) * mask;
|
|
157
|
+
outColor = vec4(ink * alpha, alpha);
|
|
158
|
+
} else {
|
|
159
|
+
vec3 color = 1.0 - exp(-light);
|
|
160
|
+
color = pow(color, vec3(1.0 / 2.2));
|
|
161
|
+
color = clamp(color + grain * peak + dither, 0.0, 1.0) * mask;
|
|
162
|
+
outColor = vec4(color, max(color.r, max(color.g, color.b)));
|
|
163
|
+
}
|
|
164
|
+
}`,Le=1.8,ue=9e5,S=(a,m,s)=>Math.min(s,Math.max(m,a)),Xe=a=>{const m=Number(a)||0;if(!m)return[0,0,0];const s=v=>{const u=Math.sin(m*12.9898+v*78.233)*43758.5453;return u-Math.floor(u)-.5};return[s(1),s(2),s(3)]},fe=(a,m,s)=>{const v=a.createShader(m);return v?(a.shaderSource(v,s),a.compileShader(v),a.getShaderParameter(v,a.COMPILE_STATUS)?v:(a.deleteShader(v),null)):null},le=(a,m)=>{const s=fe(a,a.VERTEX_SHADER,_e),v=fe(a,a.FRAGMENT_SHADER,m),u=a.createProgram();if(!s||!v||!u)return null;if(a.attachShader(u,s),a.attachShader(u,v),a.bindAttribLocation(u,0,"aPosition"),a.linkProgram(u),a.deleteShader(s),a.deleteShader(v),!a.getProgramParameter(u,a.LINK_STATUS))return a.deleteProgram(u),null;const L={},V=a.getProgramParameter(u,a.ACTIVE_UNIFORMS);for(let F=0;F<V;F++){const A=a.getActiveUniform(u,F);A&&(L[A.name]=a.getUniformLocation(u,A.name))}return{program:u,uniforms:L}},Ce=({color:a="#6b12ff",speed:m=.5,scale:s=1,rotation:v=0,flow:u=1,warp:L=0,variation:V=0,brightness:F=1,sheen:A=0,glow:ve=.4,grain:se=.03,quality:me=.5,mouseInteraction:he=!0,mouseStrength:de=1,intro:ge=!0,fade:xe=0,opacity:be=1,lightMode:pe=!1,paused:ye=!1,dpr:Ee,className:Te="",...we})=>{const q=R.useRef(null),H=R.useRef(null),O=R.useRef(null),j={color:String(a),speed:m,scale:Math.max(.1,s),rotation:v,flow:Math.max(0,u),warp:Math.max(0,L),variation:V,brightness:Math.max(0,F),sheen:Math.max(0,A),glow:Math.max(0,ve),grain:Math.max(0,se),quality:S(me,.25,1),mouseInteraction:he,mouseStrength:Math.max(0,de),intro:ge,fade:S(xe,0,1),opacity:S(be,0,1),lightMode:pe,paused:ye,dpr:Ee},x=R.useRef(j);return x.current=j,R.useEffect(()=>{const p=q.current,g=H.current,e=g?.getContext("webgl2",{alpha:!0,premultipliedAlpha:!0,antialias:!1,depth:!1,stencil:!1,powerPreference:"high-performance"});if(!p||!g||!e)return;const Q=!!e.getExtension("EXT_color_buffer_float"),X=le(e,Pe),D=le(e,Se);if(!X||!D)return;const Z=e.createBuffer(),Y=e.createVertexArray();e.bindVertexArray(Y),e.bindBuffer(e.ARRAY_BUFFER,Z),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,3,-1,-1,3]),e.STATIC_DRAW),e.enableVertexAttribArray(0),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0);const _=e.createTexture(),B=e.createFramebuffer(),h={width:0,height:0},Me=(o,n)=>{if(h.width===o&&h.height===n)return;h.width=o,h.height=n,e.bindTexture(e.TEXTURE_2D,_);const r=Math.floor(Math.log2(Math.max(o,n)))+1;e.texStorage2D(e.TEXTURE_2D,r,Q?e.RGBA16F:e.RGBA8,o,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindFramebuffer(e.FRAMEBUFFER,B),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,_,0)},y=document.createElement("canvas").getContext("2d",{willReadFrequently:!0}),C=Ae().matches,K=new Map,Re=o=>{const n=K.get(o);if(n)return n;let r=[1,1,1];if(y){y.clearRect(0,0,1,1),y.fillStyle="#ffffff",y.fillStyle=o,y.fillRect(0,0,1,1);const[d,l,M]=y.getImageData(0,0,1,1).data;r=[d,l,M].map(P=>Math.pow(P/255,2.2))}return K.set(o,r),r},f={width:1,height:1,fieldWidth:1,fieldHeight:1},c={x:0,y:0,inside:!1},t={clock:0,intro:x.current.intro&&!C?0:1,touch:0,x:0,y:0,dragX:0,dragY:0,lightX:.5,lightY:.15};let E=0,T=0,U=!0;const N=()=>{const o=x.current,n=t.intro*t.intro*t.intro*(t.intro*(t.intro*6-15)+10);e.bindVertexArray(Y),Me(f.fieldWidth,f.fieldHeight);const r=X.uniforms;e.bindFramebuffer(e.FRAMEBUFFER,B),e.viewport(0,0,h.width,h.height),e.useProgram(X.program);const d=o.rotation*Math.PI/180,[l,M,P]=Xe(o.variation);e.uniform2f(r.uView,f.width,f.height),e.uniform2f(r.uScale,f.width/h.width,f.height/h.height),e.uniform1f(r.uZoom,o.scale),e.uniform2f(r.uTurn,Math.cos(d),Math.sin(d)),e.uniform1f(r.uTime,t.clock),e.uniform1f(r.uFlow,o.flow),e.uniform1f(r.uWarp,o.warp),e.uniform3f(r.uSeed,.3948333106474662+l,.36+M,.14+P),e.uniform4f(r.uPointer,t.x,t.y,t.touch*o.mouseStrength*.9,.42),e.uniform2f(r.uDrag,t.dragX*2/f.height,t.dragY*2/f.height),e.uniform1f(r.uUnfold,(1-n)*.45),e.uniform1f(r.uDither,Q?0:1/255),e.drawArrays(e.TRIANGLES,0,3),e.bindTexture(e.TEXTURE_2D,_),e.generateMipmap(e.TEXTURE_2D);const i=D.uniforms,b=Re(o.color),W=.2126*b[0]+.7152*b[1]+.0722*b[2],I=Math.min(1,.2/Math.max(W,.001)),k=b.map(G=>Math.pow(Math.min(1,G*I),1/2.2));e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,g.width,g.height),e.useProgram(D.program),e.uniform2f(i.uResolution,g.width,g.height),e.uniform2f(i.uTexel,1/h.width,1/h.height),e.uniform3fv(i.uColor,b),e.uniform3fv(i.uInk,k),e.uniform1f(i.uGain,1.15*o.brightness),e.uniform1f(i.uSheen,.5*o.sheen),e.uniform1f(i.uGlow,o.glow),e.uniform1f(i.uPresence,n),e.uniform1f(i.uGrain,o.grain),e.uniform1f(i.uFade,o.fade),e.uniform1f(i.uOpacity,o.opacity),e.uniform1f(i.uTime,t.clock%1e3),e.uniform1f(i.uLightMode,o.lightMode?1:0),e.uniform4f(i.uLight,t.lightX*f.width/f.height,1-t.lightY,t.touch*o.mouseStrength,0),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,_),e.uniform1i(i.uField,0),e.drawArrays(e.TRIANGLES,0,3)},J=o=>{if(E=0,!U||document.hidden)return;const n=x.current,r=T?Math.min(.05,(o-T)/1e3):1/60;T=o;const d=!n.paused&&!C;d&&(t.clock+=r*n.speed),!n.intro||C?t.intro=1:t.intro<1&&(t.intro=Math.min(1,t.intro+r/Le));const l=n.mouseInteraction&&c.inside&&!C;l&&t.touch<.01&&(t.x=c.x,t.y=c.y);const M=1-Math.exp(-r*9),P=t.x,i=t.y;t.x+=(c.x-t.x)*M,t.y+=(c.y-t.y)*M;const b=(t.x-P)/Math.max(r,.001),W=(t.y-i)/Math.max(r,.001),I=1-Math.exp(-r*5);t.dragX+=(S(b*.12,-120,120)-t.dragX)*I,t.dragY+=(S(-W*.12,-120,120)-t.dragY)*I,t.touch+=((l?1:0)-t.touch)*(1-Math.exp(-r*(l?3:1.6)));const k=l?c.x/f.width:.5,G=l?c.y/f.height:.15,ce=1-Math.exp(-r*4);t.lightX+=(k-t.lightX)*ce,t.lightY+=(G-t.lightY)*ce,N();const Fe=t.intro<1||Math.abs((l?1:0)-t.touch)>.002||Math.abs(t.dragX)+Math.abs(t.dragY)>.05||Math.abs(c.x-t.x)+Math.abs(c.y-t.y)>.3||Math.abs(k-t.lightX)+Math.abs(G-t.lightY)>5e-4;d||Fe?E=requestAnimationFrame(J):T=0},w=()=>{!E&&U&&!document.hidden&&(E=requestAnimationFrame(J))},z=()=>{const o=x.current,n=Math.max(1,p.clientWidth),r=Math.max(1,p.clientHeight),d=Math.min(o.dpr||window.devicePixelRatio||1,2);f.width=n,f.height=r,g.width=Math.max(1,Math.round(n*d)),g.height=Math.max(1,Math.round(r*d));let l=o.quality;n*r*l*l>ue&&(l=Math.sqrt(ue/(n*r))),f.fieldWidth=Math.max(1,Math.round(n*l)),f.fieldHeight=Math.max(1,Math.round(r*l)),N(),w()},$=o=>{const n=p.getBoundingClientRect();c.x=o.clientX-n.left,c.y=o.clientY-n.top,c.inside=c.x>=0&&c.y>=0&&c.x<=n.width&&c.y<=n.height,w()},ee=()=>{c.inside=!1,w()},te=()=>{T=0,w()},oe=new ResizeObserver(z);oe.observe(p);const re=new IntersectionObserver(o=>{U=o.some(n=>n.isIntersecting),U&&(T=0,w())});re.observe(p),window.addEventListener("pointermove",$,{passive:!0}),document.documentElement.addEventListener("pointerleave",ee),document.addEventListener("visibilitychange",te),z();let ae=x.current.quality,ne=x.current.dpr;return O.current=()=>{const o=x.current;if(o.quality!==ae||o.dpr!==ne){ae=o.quality,ne=o.dpr,z();return}E||N(),w()},()=>{cancelAnimationFrame(E),O.current=null,oe.disconnect(),re.disconnect(),window.removeEventListener("pointermove",$),document.documentElement.removeEventListener("pointerleave",ee),document.removeEventListener("visibilitychange",te),e.deleteTexture(_),e.deleteFramebuffer(B),e.deleteProgram(X.program),e.deleteProgram(D.program),e.deleteBuffer(Z),e.deleteVertexArray(Y),g.isConnected||e.getExtension("WEBGL_lose_context")?.loseContext()}},[]),R.useEffect(()=>{O.current?.()}),ie.jsx("div",{ref:q,className:["relative h-full w-full overflow-hidden",Te].filter(Boolean).join(" "),...we,children:ie.jsx("canvas",{ref:H,className:"absolute inset-0 block h-full w-full","aria-hidden":"true"})})};export{Ce as DarkVeil,Ce as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as M,m as Yt,j as _}from"./index-
|
|
1
|
+
import{r as M,m as Yt,j as _}from"./index-BstFwFxc.js";const Wt=typeof window>"u"?M.useEffect:M.useLayoutEffect,a=(i,C,L)=>Math.min(Math.max(i,C),L),Tt={right:{x:1,y:0},left:{x:-1,y:0},up:{x:0,y:-1},down:{x:0,y:1},diagonal:{x:.72,y:.72}},Ft={linear:i=>i,"ease-out":i=>1-Math.pow(1-i,3),"ease-in-out":i=>i<.5?4*i*i*i:1-Math.pow(-2*i+2,3)/2,snappy:i=>1-Math.pow(1-i,5)},Jt=7200,Kt=2600,Zt=1100,te=80,K=i=>i instanceof Element?[i.scrollLeft||0,i.scrollTop||0]:[window.scrollX,window.scrollY],ne=({text:i="Motion Echo",echoes:C=12,lag:L=.24,offset:Z=36,direction:tt="right",fade:et=.72,blur:nt=3,tint:ot="#7dd3fc",echoColors:P,echoStyle:Rt="solid",echoScale:rt=1,mode:Y="both",trail:S="pointer",clickBurst:j=!0,cursorRadius:st=320,duration:at=900,ease:it="ease-out",fontSize:Lt="clamp(3rem, 9vw, 7rem)",fontWeight:Nt=800,color:$t="currentColor",className:At="",style:kt})=>{const ct=M.useRef(null),lt=M.useRef(null),E=M.useRef([]),[B,It]=M.useState(!1),l=B?0:a(Math.round(C),0,24),_t=M.useMemo(()=>Array.from({length:l},(r,d)=>l-d),[l]),N=Array.isArray(P)&&P.length?P:null,Ct=j&&l>0,Pt=r=>{if(N){const d=l>1?(r-1)/(l-1):0;return`color-mix(in srgb, ${N[N.length-1]} ${Math.round(d*100)}%, ${N[0]})`}return ot?`color-mix(in srgb, ${ot} ${Math.min(72,18+r*5)}%, currentColor)`:void 0};M.useEffect(()=>{if(!window.matchMedia)return;const r=Yt(),d=()=>It(r.matches);return d(),()=>r.removeEventListener?.("change",d)},[]),Wt(()=>{const r=ct.current;if(!r||B||Yt().matches)return;const d=Tt[tt]||Tt.right,u=a(Number(Z)||0,0,120),dt=a(Number(st)||320,40,1200),D=a(Number(L)||.16,.02,.5),ht=a(Number(et)||.64,.1,.95),$=a(Number(nt)||0,0,16),Bt=a(Number(rt)||1,.25,2.5),ut=Math.max(0,Number(at)||0),Dt=Ft[it]||Ft["ease-out"],A=Y==="entrance"||Y==="both",O=Y==="pointer"||Y==="both",Ot=!!window.matchMedia?.("(hover: hover) and (pointer: fine)").matches,q=O&&S==="auto",G=O&&S==="scroll",ft=O&&Ot&&!G,qt=.12+D*1.1,Gt=a(u/36,.35,2.5),k=u*4,t={targetX:0,targetY:0,lastTargetX:0,lastTargetY:0,activity:A?1:0,positions:Array.from({length:l+1},(e,n)=>{const o=A?u*(n+.35):0;return{x:d.x*o,y:d.y*o}}),bends:Array.from({length:l+1},()=>({x:0,y:0})),startTime:performance.now(),lastTime:0,drift:0,phase:0,pointerNear:!1,pointerTime:-1/0,visible:!0,pushX:0,pushY:0,velocityX:0,velocityY:0,bursts:[]};let T=0;for(let e=1;e<=l;e+=1){const n=E.current[e];n&&(n.style.filter=$>0?`blur(${($*e/l).toFixed(2)}px)`:"none")}const Ut=e=>{t.bursts=t.bursts.filter(n=>{const o=e-n.start;let h=!1;return n.nodes.forEach((s,f)=>{const y=(o-f*te)/Zt;y<1&&(h=!0);const p=a(y,0,1),m=1-Math.pow(1-p,3),b=1+m*.34*Gt,g=.75*Math.pow(ht,f*.5),z=y<=0?0:Math.min(1,p*8)*Math.pow(1-p,1.5)*g;s.style.transform=`translate3d(${n.x.toFixed(2)}px, ${n.y.toFixed(2)}px, 0) scale(${b.toFixed(4)})`,s.style.opacity=z.toFixed(3),s.style.filter=$>0?`blur(${($*.3*m).toFixed(2)}px)`:"none"}),h||n.nodes.forEach(s=>s.remove()),h})},U=e=>{T=0;const n=t.lastTime?a(e-t.lastTime,0,64):16.67,o=n/16.67;t.lastTime=e;const h=e-t.startTime,s=A&&ut>0?a(h/ut,0,1):1,f=A?1-Dt(s):0,y=Math.hypot(t.targetX-t.lastTargetX,t.targetY-t.lastTargetY);if(t.lastTargetX=t.targetX,t.lastTargetY=t.targetY,q){const c=!ft||!t.pointerNear||e-t.pointerTime>Kt;t.drift+=((c?1:0)-t.drift)*(1-Math.pow(.965,o)),t.phase+=n/Jt*Math.PI*2}if(G){const c=1-Math.pow(.7,o);t.velocityX+=(t.pushX/Math.max(o,.25)-t.velocityX)*c,t.velocityY+=(t.pushY/Math.max(o,.25)-t.velocityY)*c,t.pushX=0,t.pushY=0}const p=Math.hypot(t.velocityX,t.velocityY),m=a(-t.velocityX*3.2,-k,k),b=a(-t.velocityY*3.2,-k,k),g=t.targetX*(1-t.drift),z=t.targetY*(1-t.drift);let H=0,Q=0;for(let c=0;c<=l;c+=1){const R=E.current[c],x=t.positions[c],v=t.bends[c];if(!R||!x||!v)continue;const w=l?c/l:0,vt=f*u*(c+.35);let W=g+d.x*vt,J=z+d.y*vt;if(t.drift>5e-4){const X=t.phase-c*qt,Xt=u*t.drift*(.25+.75*w);W+=Math.sin(X)*Xt,J+=Math.sin(X)*Math.cos(X)*Xt*1.3}const Mt=1-Math.pow(1-a(.34/(1+c*D*4.2),.018,.36),o),bt=1-Math.pow(1-.3/(1+w*(1+D*8)),o);x.x+=(W-x.x)*Mt,x.y+=(J-x.y)*Mt,v.x+=(m*w-v.x)*bt,v.y+=(b*w-v.y)*bt,Q=Math.max(Q,Math.abs(W-x.x),Math.abs(J-x.y),Math.abs(m*w-v.x),Math.abs(b*w-v.y));const wt=x.x+v.x,Et=x.y+v.y,Qt=1+(Bt-1)*w;if(R.style.transform=`translate3d(${wt.toFixed(3)}px, ${Et.toFixed(3)}px, 0) scale(${Qt.toFixed(4)})`,c>0){const X=t.positions[0];H=Math.max(H,Math.hypot(wt-X.x,Et-X.y))}}const Vt=u>0?a(H/(u*2.25),0,1):0,zt=u>0?a(y/(u*.35),0,1):0,Ht=Math.max(f,Vt,zt,t.drift*.9,a(p/5,0,1));t.activity+=(Ht-t.activity)*(1-Math.pow(.82,o)),Ut(e);const xt=s<1||t.activity>.002||Q>.05||p>.02||t.bursts.length>0||q&&t.visible;xt||(t.activity=0);for(let c=1;c<=l;c+=1){const R=E.current[c];R&&(R.style.opacity=String(Math.pow(ht,c)*t.activity))}xt&&(T=requestAnimationFrame(U))},F=()=>{T||(t.lastTime=0,T=requestAnimationFrame(U))},pt=e=>{const n=r.getBoundingClientRect();if(!n.width||!n.height)return;const o=e.clientX-(n.left+n.width/2),h=e.clientY-(n.top+n.height/2),s=Math.hypot(o,h),f=s>0?a(s/dt,0,1):0,y=s>0?o/s:0,p=s>0?h/s:0;t.targetX=y*f*u,t.targetY=p*f*u*.72,t.pointerNear=s<=dt,t.pointerTime=performance.now(),F()},mt=e=>{e.relatedTarget||(t.targetX=0,t.targetY=0,t.pointerNear=!1,F())},I=new WeakMap,yt=e=>{const n=e.target;if(!(n instanceof Document)&&!(n instanceof Element&&n.contains(r)))return;const[o,h]=K(n),s=I.get(n);I.set(n,[o,h]),s&&(t.pushX-=o-s[0],t.pushY-=h-s[1],F())},gt=e=>{const n=lt.current,o=r.getBoundingClientRect();if(!n||!l||!o.width||!o.height)return;const h=a((e.clientX-o.left)/o.width,0,1)*100,s=a((e.clientY-o.top)/o.height,0,1)*100,f=a(Math.round(l/3)+2,3,6),y=t.positions[0],p=[];for(let m=0;m<f;m+=1){const b=E.current[1+Math.round(m/Math.max(1,f-1)*(l-1))];if(!b)continue;const g=b.cloneNode(!0);g.removeAttribute("data-echo-index"),g.style.transformOrigin=`${h.toFixed(1)}% ${s.toFixed(1)}%`,g.style.opacity="0",n.appendChild(g),p.push(g)}for(t.bursts.push({start:performance.now(),x:y?.x||0,y:y?.y||0,nodes:p});t.bursts.length>4;)t.bursts.shift()?.nodes.forEach(m=>m.remove());F()};if(ft&&(window.addEventListener("pointermove",pt,{passive:!0}),document.addEventListener("pointerout",mt)),G){I.set(document,K(document));for(let e=r.parentElement;e;e=e.parentElement)I.set(e,K(e));document.addEventListener("scroll",yt,{capture:!0,passive:!0})}j&&r.addEventListener("click",gt);let V;return q&&typeof IntersectionObserver<"u"&&(V=new IntersectionObserver(e=>{t.visible=e[e.length-1].isIntersecting,t.visible&&F()}),V.observe(r)),U(t.startTime),()=>{cancelAnimationFrame(T),window.removeEventListener("pointermove",pt),document.removeEventListener("pointerout",mt),document.removeEventListener("scroll",yt,{capture:!0}),r.removeEventListener("click",gt),V?.disconnect(),t.bursts.forEach(e=>e.nodes.forEach(n=>n.remove()))}},[nt,j,st,tt,at,it,l,rt,et,L,Y,Z,B,S]);const St={fontSize:Lt,fontWeight:Nt,color:$t,cursor:Ct?"pointer":void 0,...kt},jt=["pointer-events-none absolute inset-0 block origin-center transform-gpu backface-hidden will-change-[transform,opacity] motion-reduce:hidden",Rt==="outline"?"[-webkit-text-fill-color:transparent] [-webkit-text-stroke:max(1px,0.014em)_currentColor]":""].join(" ").trim();return _.jsxs("span",{ref:ct,className:`relative inline-block whitespace-nowrap select-none leading-[0.9] tracking-[-0.04em] [contain:layout_style] [font-kerning:normal] [text-rendering:geometricPrecision] ${At}`.trim(),style:St,children:[_t.map(r=>_.jsx("span",{"aria-hidden":"true",className:jt,"data-echo-index":r,ref:d=>{E.current[r]=d},style:{color:Pt(r),opacity:0},children:i},`echo-${r}`)),_.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0",ref:lt}),_.jsx("span",{className:"pointer-events-none relative z-[2] block transform-gpu text-shadow-[0_0.035em_0_rgba(255,255,255,0.04)] will-change-transform motion-reduce:[transform:none]!","data-echo-index":"0",ref:r=>{E.current[0]=r},children:i})]})};export{ne as default};
|
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
import{r as A,m as ze,j as ye}from"./index-BstFwFxc.js";const Ve=2,C=4,He={glitch:.7,degauss:1.6},qe={blocks:0,dots:1,characters:2},$e={none:0,glitch:1,degauss:2},je=[[".###.","#..##","#.#.#","##..#",".###."],["..#..",".##..","..#..","..#..",".###."],["####.","....#",".###.","#....","#####"],["####.","....#",".###.","....#","####."],["#..#.","#..#.","#####","...#.","...#."],["#####","#....","####.","....#","####."],[".###.","#....","####.","#...#",".###."],["#####","....#","...#.","..#..","..#.."],[".###.","#...#",".###.","#...#",".###."],[".###.","#...#",".####","....#",".###."],[".###.","#...#","#####","#...#","#...#"],["####.","#...#","####.","#...#","####."],[".####","#....","#....","#....",".####"],["####.","#...#","#...#","#...#","####."],["#####","#....","####.","#....","#####"],["#####","#....","####.","#....","#...."],[".....","..#..",".###.","..#..","....."],[".....",".....",".###.",".....","....."],[".#...","..#..","...#.","..#..",".#..."],["....#","...#.","..#..",".#...","#...."],[".....","#.#.#",".###.","#.#.#","....."],[".....","#####",".....","#####","....."],[".....",".....",".....",".....","#####"]],J=je.map(o=>o.reduce((c,u,a)=>{let s=c;for(let y=0;y<5;y++)u[y]==="#"&&(s+=2**(a*5+y));return s},0)),Ye=`#version 300 es
|
|
2
|
+
void main() {
|
|
3
|
+
vec2 p = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));
|
|
4
|
+
gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);
|
|
5
|
+
}`,We=`
|
|
6
|
+
float time;
|
|
7
|
+
|
|
8
|
+
float noise(vec2 p) {
|
|
9
|
+
return sin(p.x * 10.0) * sin(p.y * (3.0 + sin(time * 0.090909))) + 0.2;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
mat2 rotate(float angle) {
|
|
13
|
+
float c = cos(angle);
|
|
14
|
+
float s = sin(angle);
|
|
15
|
+
return mat2(c, -s, s, c);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
float fbm(vec2 p) {
|
|
19
|
+
p *= 1.1;
|
|
20
|
+
float f = 0.0;
|
|
21
|
+
float amp = 0.5 * uNoiseAmp;
|
|
22
|
+
mat2 modify0 = rotate(time * 0.02);
|
|
23
|
+
f += amp * noise(p);
|
|
24
|
+
p = modify0 * p * 2.0;
|
|
25
|
+
amp *= 0.454545;
|
|
26
|
+
mat2 modify1 = rotate(time * 0.02);
|
|
27
|
+
f += amp * noise(p);
|
|
28
|
+
p = modify1 * p * 2.0;
|
|
29
|
+
amp *= 0.454545;
|
|
30
|
+
f += amp * noise(p);
|
|
31
|
+
return f;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
float pattern(vec2 p) {
|
|
35
|
+
vec2 offset1 = vec2(1.0);
|
|
36
|
+
vec2 offset0 = vec2(0.0);
|
|
37
|
+
mat2 rot01 = rotate(0.1 * time);
|
|
38
|
+
mat2 rot1 = rotate(0.1);
|
|
39
|
+
vec2 q = vec2(fbm(p + offset1), fbm(rot01 * p + offset1));
|
|
40
|
+
vec2 r = vec2(fbm(rot1 * q + offset0), fbm(q + offset0));
|
|
41
|
+
return fbm(p + r);
|
|
42
|
+
}
|
|
43
|
+
`,Ke=`#version 300 es
|
|
44
|
+
precision highp float;
|
|
45
|
+
precision highp int;
|
|
46
|
+
|
|
47
|
+
uniform float iTime;
|
|
48
|
+
uniform vec2 uGridMul;
|
|
49
|
+
uniform float uNoiseAmp;
|
|
50
|
+
uniform float uScale;
|
|
51
|
+
uniform vec2 uMouse;
|
|
52
|
+
uniform float uMouseStrength;
|
|
53
|
+
uniform float uUseMouse;
|
|
54
|
+
uniform float uPageLoadProgress;
|
|
55
|
+
uniform float uUsePageLoadAnimation;
|
|
56
|
+
uniform ivec2 uOrigin;
|
|
57
|
+
uniform sampler2D uPrev0;
|
|
58
|
+
uniform sampler2D uPrev1;
|
|
59
|
+
uniform float uDecay;
|
|
60
|
+
uniform float uFresh;
|
|
61
|
+
uniform float uHover;
|
|
62
|
+
|
|
63
|
+
layout(location = 0) out vec4 outRings;
|
|
64
|
+
layout(location = 1) out vec4 outExtra;
|
|
65
|
+
${We}
|
|
66
|
+
void main() {
|
|
67
|
+
time = iTime * 0.333333;
|
|
68
|
+
ivec2 texel = ivec2(gl_FragCoord.xy);
|
|
69
|
+
vec2 grid = uGridMul * 15.0;
|
|
70
|
+
vec2 s = vec2(texel + uOrigin) / grid;
|
|
71
|
+
float intensity = pattern(s * 0.1) * 1.3 - 0.03;
|
|
72
|
+
float lift = 0.0;
|
|
73
|
+
float strike = 0.0;
|
|
74
|
+
|
|
75
|
+
if (uUseMouse > 0.5) {
|
|
76
|
+
vec2 mouseWorld = uMouse * uScale;
|
|
77
|
+
float distToMouse = distance(s, mouseWorld);
|
|
78
|
+
float mouseInfluence = exp(-distToMouse * 8.0) * uMouseStrength * 10.0;
|
|
79
|
+
intensity += mouseInfluence;
|
|
80
|
+
float ripple = sin(distToMouse * 20.0 - iTime * 5.0) * 0.1 * mouseInfluence;
|
|
81
|
+
intensity += ripple;
|
|
82
|
+
lift = mouseInfluence;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (uUsePageLoadAnimation > 0.5) {
|
|
86
|
+
float cellRandom = fract(sin(dot(s, vec2(12.9898, 78.233))) * 43758.5453);
|
|
87
|
+
float cellDelay = cellRandom * 0.8;
|
|
88
|
+
float cellProgress = clamp((uPageLoadProgress - cellDelay) / 0.2, 0.0, 1.0);
|
|
89
|
+
float fadeAlpha = smoothstep(0.0, 1.0, cellProgress);
|
|
90
|
+
intensity *= fadeAlpha;
|
|
91
|
+
strike = sin(3.14159265 * cellProgress) * step(0.1, intensity);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
vec4 on0 = step(vec4(0.1), intensity - vec4(0.0, 1.0, 2.0, 4.0) * 0.0625);
|
|
95
|
+
vec2 on1 = step(vec2(0.1), intensity - vec2(5.0, 8.0) * 0.0625);
|
|
96
|
+
float level = clamp((intensity - 0.1) / 0.6, 0.0, 1.0);
|
|
97
|
+
float heat = max(clamp(lift / 3.0, 0.0, 1.0) * uHover, strike);
|
|
98
|
+
|
|
99
|
+
vec4 prev0 = texelFetch(uPrev0, texel, 0) * (1.0 - uFresh);
|
|
100
|
+
vec4 prev1 = texelFetch(uPrev1, texel, 0) * (1.0 - uFresh);
|
|
101
|
+
vec4 fade0 = max(prev0 * uDecay - 1.0 / 255.0, 0.0);
|
|
102
|
+
vec4 fade1 = max(prev1 * uDecay - 1.0 / 255.0, 0.0);
|
|
103
|
+
|
|
104
|
+
outRings = max(on0, fade0);
|
|
105
|
+
outExtra = vec4(max(on1, fade1.xy), max(level, fade1.z), max(heat, fade1.w));
|
|
106
|
+
}`,Qe=`const uint FONT[${J.length}] = uint[${J.length}](${J.map(o=>`${o}u`).join(", ")});`,Je=`#version 300 es
|
|
107
|
+
precision highp float;
|
|
108
|
+
precision highp int;
|
|
109
|
+
|
|
110
|
+
uniform float iTime;
|
|
111
|
+
uniform vec3 iResolution;
|
|
112
|
+
uniform float uScale;
|
|
113
|
+
uniform vec2 uGridMul;
|
|
114
|
+
uniform float uDigitSize;
|
|
115
|
+
uniform float uScanlineIntensity;
|
|
116
|
+
uniform float uGlitchAmount;
|
|
117
|
+
uniform float uFlickerAmount;
|
|
118
|
+
uniform float uChromaticAberration;
|
|
119
|
+
uniform float uDither;
|
|
120
|
+
uniform float uCurvature;
|
|
121
|
+
uniform vec3 uTint;
|
|
122
|
+
uniform float uBrightness;
|
|
123
|
+
uniform float uLightMode;
|
|
124
|
+
uniform sampler2D uRings0;
|
|
125
|
+
uniform sampler2D uRings1;
|
|
126
|
+
uniform ivec2 uOrigin;
|
|
127
|
+
uniform ivec2 uCellCount;
|
|
128
|
+
uniform int uGlyphs;
|
|
129
|
+
uniform float uGlow;
|
|
130
|
+
uniform float uScramble;
|
|
131
|
+
uniform float uMouseGlow;
|
|
132
|
+
uniform float uVignette;
|
|
133
|
+
uniform vec4 uClicks[${C}];
|
|
134
|
+
uniform int uClickMode;
|
|
135
|
+
uniform float uClickSeconds;
|
|
136
|
+
uniform float uClock;
|
|
137
|
+
|
|
138
|
+
out vec4 outColor;
|
|
139
|
+
|
|
140
|
+
${Qe}
|
|
141
|
+
|
|
142
|
+
float time;
|
|
143
|
+
float clickTear;
|
|
144
|
+
float clickSplit;
|
|
145
|
+
float pixelHeat;
|
|
146
|
+
|
|
147
|
+
float hash21(vec2 p) {
|
|
148
|
+
p = fract(p * 234.56);
|
|
149
|
+
p += dot(p, p + 34.56);
|
|
150
|
+
return fract(p.x * p.y);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
float hashCell(vec2 p) {
|
|
154
|
+
vec3 q = fract(vec3(p.xyx) * 0.1031);
|
|
155
|
+
q += dot(q, q.yzx + 33.33);
|
|
156
|
+
return fract((q.x + q.y) * q.z);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
ivec2 cellTexel(vec2 cell) {
|
|
160
|
+
return clamp(ivec2(cell) - uOrigin, ivec2(0), uCellCount - 1);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
float ringValue(float n, vec4 r0, vec4 r1) {
|
|
164
|
+
if (n < 0.5) return r0.x;
|
|
165
|
+
if (n < 1.5) return r0.y;
|
|
166
|
+
if (n < 2.5) return r0.z;
|
|
167
|
+
if (n < 4.5) return r0.w;
|
|
168
|
+
if (n < 5.5) return r1.x;
|
|
169
|
+
return r1.y;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
float digit(vec2 p) {
|
|
173
|
+
vec2 grid = uGridMul * 15.0;
|
|
174
|
+
vec2 cell = floor(p * grid);
|
|
175
|
+
ivec2 texel = cellTexel(cell);
|
|
176
|
+
vec4 r0 = texelFetch(uRings0, texel, 0);
|
|
177
|
+
vec4 r1 = texelFetch(uRings1, texel, 0);
|
|
178
|
+
float boost = 1.0 + r1.w * uMouseGlow * 1.3;
|
|
179
|
+
pixelHeat = max(pixelHeat, r1.w);
|
|
180
|
+
p = fract(p * grid);
|
|
181
|
+
p *= uDigitSize;
|
|
182
|
+
|
|
183
|
+
float px5 = p.x * 5.0;
|
|
184
|
+
float py5 = (1.0 - p.y) * 5.0;
|
|
185
|
+
float x = fract(px5);
|
|
186
|
+
float y = fract(py5);
|
|
187
|
+
float i = floor(py5) - 2.0;
|
|
188
|
+
float j = floor(px5) - 2.0;
|
|
189
|
+
float inside = step(0.0, p.x) * step(p.x, 1.0) * step(0.0, p.y) * step(p.y, 1.0);
|
|
190
|
+
|
|
191
|
+
if (uGlyphs == 2) {
|
|
192
|
+
float rate = 1.2 + r1.w * uScramble * 18.0;
|
|
193
|
+
float phase = hashCell(cell * 1.37 + 4.1);
|
|
194
|
+
float epoch = floor(iTime * rate + phase * 7.0);
|
|
195
|
+
float pick = hashCell(cell + vec2(epoch * 0.731, epoch * 1.913));
|
|
196
|
+
uint glyph = FONT[int(min(pick * float(FONT.length()), float(FONT.length()) - 1.0))];
|
|
197
|
+
int bit = int(i + 2.0) * 5 + int(j + 2.0);
|
|
198
|
+
float lit = float((glyph >> uint(clamp(bit, 0, 24))) & 1u);
|
|
199
|
+
float glow = max(r0.x, r1.z);
|
|
200
|
+
float shade = 0.35 + 0.65 * r1.z;
|
|
201
|
+
return inside * lit * glow * shade * boost * (0.2 + y * 0.8) * (0.75 + x * 0.25);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
float n = i * i + j * j;
|
|
205
|
+
float on = ringValue(n, r0, r1);
|
|
206
|
+
if (uGlyphs == 1) {
|
|
207
|
+
vec2 d = vec2(x, y) - 0.5;
|
|
208
|
+
float radius = 0.36 + 0.06 * on;
|
|
209
|
+
float edge = fwidth(px5) * 0.75;
|
|
210
|
+
float dot = 1.0 - smoothstep(radius - edge, radius + edge, length(d));
|
|
211
|
+
return inside * on * dot * boost * (0.55 + 0.45 * (1.0 - length(d) / 0.5));
|
|
212
|
+
}
|
|
213
|
+
float brightness = on * (0.2 + y * 0.8) * (0.75 + x * 0.25);
|
|
214
|
+
return inside * brightness * boost;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
float onOff(float a, float b, float c) {
|
|
218
|
+
return step(c, sin(iTime + a * cos(iTime * b))) * uFlickerAmount;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
float displace(vec2 look) {
|
|
222
|
+
float y = look.y - mod(iTime * 0.25, 1.0);
|
|
223
|
+
float window = 1.0 / (1.0 + 50.0 * y * y);
|
|
224
|
+
return sin(look.y * 20.0 + iTime) * 0.0125 * onOff(4.0, 2.0, 0.8) * (1.0 + cos(iTime * 60.0)) * window;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
vec2 getLight(vec2 p) {
|
|
228
|
+
float bar = step(mod(p.y + time * 20.0, 1.0), 0.2) * 0.4 + 1.0;
|
|
229
|
+
bar *= uScanlineIntensity;
|
|
230
|
+
|
|
231
|
+
float displacement = displace(p);
|
|
232
|
+
p.x += displacement;
|
|
233
|
+
|
|
234
|
+
if (uGlitchAmount != 1.0) {
|
|
235
|
+
float extra = displacement * (uGlitchAmount - 1.0);
|
|
236
|
+
p.x += extra;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
p.x += clickTear;
|
|
240
|
+
|
|
241
|
+
float middle = digit(p);
|
|
242
|
+
|
|
243
|
+
const float off = 0.002;
|
|
244
|
+
float sum = digit(p + vec2(-off, -off)) + digit(p + vec2(0.0, -off)) + digit(p + vec2(off, -off)) +
|
|
245
|
+
digit(p + vec2(-off, 0.0)) + digit(p + vec2(0.0, 0.0)) + digit(p + vec2(off, 0.0)) +
|
|
246
|
+
digit(p + vec2(-off, off)) + digit(p + vec2(0.0, off)) + digit(p + vec2(off, off));
|
|
247
|
+
|
|
248
|
+
return vec2(0.9 * middle, sum * 0.1 * bar);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
float glowAt(vec2 p) {
|
|
252
|
+
vec2 grid = uGridMul * 15.0;
|
|
253
|
+
vec2 cell = floor(p * grid);
|
|
254
|
+
vec2 cellPx = iResolution.xy / (uScale * grid);
|
|
255
|
+
float sigma = 0.5 * min(cellPx.x, cellPx.y);
|
|
256
|
+
float center = 0.5 * min(1.0, 1.0 / max(uDigitSize, 0.001));
|
|
257
|
+
float total = 0.0;
|
|
258
|
+
for (int oy = -1; oy <= 1; oy++) {
|
|
259
|
+
for (int ox = -1; ox <= 1; ox++) {
|
|
260
|
+
vec2 c = cell + vec2(float(ox), float(oy));
|
|
261
|
+
ivec2 texel = cellTexel(c);
|
|
262
|
+
vec4 r0 = texelFetch(uRings0, texel, 0);
|
|
263
|
+
vec4 r1 = texelFetch(uRings1, texel, 0);
|
|
264
|
+
float emission = uGlyphs == 2
|
|
265
|
+
? max(r0.x, r1.z) * (0.35 + 0.65 * r1.z) * 0.45
|
|
266
|
+
: (r0.x + 4.0 * (r0.y + r0.z + r0.w + r1.y) + 8.0 * r1.x) / 25.0;
|
|
267
|
+
emission *= 1.0 + r1.w * uMouseGlow * 1.6;
|
|
268
|
+
vec2 d = (p - (c + center) / grid) * iResolution.xy / uScale;
|
|
269
|
+
total += emission * exp(-dot(d, d) / (2.0 * sigma * sigma));
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return total;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
vec2 barrel(vec2 uv) {
|
|
276
|
+
vec2 c = uv * 2.0 - 1.0;
|
|
277
|
+
float r2 = dot(c, c);
|
|
278
|
+
c *= 1.0 + uCurvature * r2;
|
|
279
|
+
return c * 0.5 + 0.5;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
void main() {
|
|
283
|
+
time = iTime * 0.333333;
|
|
284
|
+
vec2 uv = gl_FragCoord.xy / iResolution.xy;
|
|
285
|
+
|
|
286
|
+
if (uCurvature != 0.0) {
|
|
287
|
+
uv = barrel(uv);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
clickTear = 0.0;
|
|
291
|
+
clickSplit = 0.0;
|
|
292
|
+
if (uClickMode > 0) {
|
|
293
|
+
for (int k = 0; k < ${C}; k++) {
|
|
294
|
+
vec4 click = uClicks[k];
|
|
295
|
+
if (click.w <= 0.0) continue;
|
|
296
|
+
float age = uClock - click.z;
|
|
297
|
+
if (age < 0.0 || age > uClickSeconds) continue;
|
|
298
|
+
float life = age / uClickSeconds;
|
|
299
|
+
float envelope = (1.0 - life) * (1.0 - life);
|
|
300
|
+
if (uClickMode == 1) {
|
|
301
|
+
float tick = floor(age * 30.0);
|
|
302
|
+
float bands = 14.0 + 26.0 * hashCell(vec2(click.z, tick * 0.37));
|
|
303
|
+
float row = floor(uv.y * bands);
|
|
304
|
+
float pickRow = hashCell(vec2(row + tick * 7.0, click.z * 17.0));
|
|
305
|
+
float torn = step(0.42, pickRow);
|
|
306
|
+
float reach = exp(-abs(uv.y - click.y) * 2.5);
|
|
307
|
+
float shift = (hashCell(vec2(row * 1.7 + tick, click.z)) - 0.5) * 0.22;
|
|
308
|
+
clickTear += shift * torn * envelope * reach;
|
|
309
|
+
clickSplit = max(clickSplit, envelope * reach * (0.4 + 0.6 * torn));
|
|
310
|
+
} else {
|
|
311
|
+
vec2 aspect = vec2(iResolution.x / iResolution.y, 1.0);
|
|
312
|
+
vec2 delta = (uv - click.xy) * aspect;
|
|
313
|
+
float dist = length(delta);
|
|
314
|
+
float front = age * 1.6;
|
|
315
|
+
float band = exp(-pow((dist - front) / 0.18, 2.0));
|
|
316
|
+
float wave = sin((dist - front) * 40.0) * band;
|
|
317
|
+
uv += delta / aspect * wave * 0.05 * envelope;
|
|
318
|
+
clickSplit = max(clickSplit, envelope * band);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
vec2 p = uv * uScale;
|
|
324
|
+
pixelHeat = 0.0;
|
|
325
|
+
vec2 lightG = getLight(p);
|
|
326
|
+
float heat = pixelHeat;
|
|
327
|
+
vec2 lightR = lightG;
|
|
328
|
+
vec2 lightB = lightG;
|
|
329
|
+
|
|
330
|
+
float split = uChromaticAberration + clickSplit * 6.0;
|
|
331
|
+
if (split != 0.0) {
|
|
332
|
+
vec2 ca = vec2(split) / iResolution.xy;
|
|
333
|
+
lightR = getLight(p + ca);
|
|
334
|
+
lightB = getLight(p - ca);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
if (uGlow > 0.0) {
|
|
338
|
+
float bloom = uGlow * 0.2 * glowAt(p);
|
|
339
|
+
lightR.y += bloom;
|
|
340
|
+
lightG.y += bloom;
|
|
341
|
+
lightB.y += bloom;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
vec3 core = vec3(lightR.x, lightG.x, lightB.x);
|
|
345
|
+
vec3 halo = vec3(lightR.y, lightG.y, lightB.y);
|
|
346
|
+
vec3 raw = core + halo;
|
|
347
|
+
|
|
348
|
+
vec3 luma = vec3(0.2126, 0.7152, 0.0722);
|
|
349
|
+
float peak = max(uTint.r, max(uTint.g, uTint.b));
|
|
350
|
+
float phosphor = clamp(uGlow, 0.0, 1.0);
|
|
351
|
+
vec3 vividTint = clamp(mix(vec3(dot(uTint, luma)), uTint, 1.0 + 0.8 * phosphor), 0.0, 1.0);
|
|
352
|
+
vec3 coreTint = mix(uTint, vec3(peak), phosphor * 0.45 * smoothstep(0.45, 0.9, core));
|
|
353
|
+
vec3 col = core * coreTint + halo * vividTint;
|
|
354
|
+
col += (vec3(1.0) - uTint) * min(raw, vec3(1.0)) * heat * uMouseGlow * 0.6;
|
|
355
|
+
col *= uBrightness;
|
|
356
|
+
|
|
357
|
+
if (uVignette > 0.0) {
|
|
358
|
+
float edge = 0.04 + 0.22 * uVignette;
|
|
359
|
+
vec2 fade = smoothstep(vec2(0.0), vec2(edge), uv) * smoothstep(vec2(0.0), vec2(edge), 1.0 - uv);
|
|
360
|
+
float mask = fade.x * fade.y;
|
|
361
|
+
mask = mask * mask * (3.0 - 2.0 * mask);
|
|
362
|
+
float keep = mix(1.0, mask, clamp(uVignette * 1.5, 0.0, 1.0));
|
|
363
|
+
col *= keep;
|
|
364
|
+
core *= keep;
|
|
365
|
+
halo *= keep;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
if (uLightMode > 0.5) {
|
|
369
|
+
vec3 luma = vec3(0.2126, 0.7152, 0.0722);
|
|
370
|
+
float lum = dot(uTint, luma);
|
|
371
|
+
float peak = max(uTint.r, max(uTint.g, uTint.b));
|
|
372
|
+
vec3 hue = uTint / max(peak, 0.0001);
|
|
373
|
+
vec3 vivid = clamp(mix(vec3(dot(hue, luma)), hue, 1.6), 0.0, 1.0);
|
|
374
|
+
vivid = clamp(vivid * (0.3 / max(dot(vivid, luma), 0.0001)), 0.0, 1.0);
|
|
375
|
+
vec3 ink = mix(uTint, vivid, smoothstep(0.3, 0.6, lum));
|
|
376
|
+
vec3 cover = (core * 1.15 + halo * 0.4) * uBrightness * (1.0 + heat * uMouseGlow * 0.4);
|
|
377
|
+
if (uDither > 0.0) cover += (hash21(gl_FragCoord.xy) - 0.5) * (uDither * 0.003922);
|
|
378
|
+
cover = clamp(cover, 0.0, 0.94);
|
|
379
|
+
float alpha = max(cover.r, max(cover.g, cover.b));
|
|
380
|
+
outColor = vec4(alpha - cover * (1.0 - ink), alpha);
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
if (uDither > 0.0) {
|
|
385
|
+
float rnd = hash21(gl_FragCoord.xy);
|
|
386
|
+
col += (rnd - 0.5) * (uDither * 0.003922);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
col = clamp(col, 0.0, 1.0);
|
|
390
|
+
outColor = vec4(col, max(col.r, max(col.g, col.b)));
|
|
391
|
+
}`,S=(o,c,u)=>Math.min(u,Math.max(c,o)),Ee=(o,c,u)=>{const a=o.createShader(c);return a?(o.shaderSource(a,u),o.compileShader(a),o.getShaderParameter(a,o.COMPILE_STATUS)?a:(o.deleteShader(a),null)):null},Re=(o,c)=>{const u=Ee(o,o.VERTEX_SHADER,Ye),a=Ee(o,o.FRAGMENT_SHADER,c),s=o.createProgram();if(!u||!a||!s)return null;if(o.attachShader(s,u),o.attachShader(s,a),o.linkProgram(s),o.deleteShader(u),o.deleteShader(a),!o.getProgramParameter(s,o.LINK_STATUS))return o.deleteProgram(s),null;const y={},q=o.getProgramParameter(s,o.ACTIVE_UNIFORMS);for(let F=0;F<q;F++){const U=o.getActiveUniform(s,F);if(!U)continue;const N=U.name.replace(/\[0\]$/,"");y[N]=o.getUniformLocation(s,N)}return{program:s,uniforms:y}},Ze=o=>{let c=String(o||"#ffffff").replace("#","").trim();(c.length===3||c.length===4)&&(c=c.slice(0,3).split("").map(a=>a+a).join(""));const u=parseInt(c.slice(0,6),16);return Number.isNaN(u)?[1,1,1]:[(u>>16&255)/255,(u>>8&255)/255,(u&255)/255]};function ot({scale:o=1,gridMul:c=[2,1],digitSize:u=1.5,timeScale:a=.3,pause:s=!1,scanlineIntensity:y=.3,glitchAmount:q=1,flickerAmount:F=1,noiseAmp:U=1,chromaticAberration:N=0,dither:$=0,curvature:ke=.2,tint:be="#ffffff",mouseReact:Me=!0,mouseStrength:we=.2,pageLoadAnimation:Ae=!0,brightness:Se=1,glyphs:Ce="blocks",glow:Fe=.5,persistence:_e=.5,scramble:Ge=.5,mouseGlow:De=.6,vignette:Pe=.25,clickEffect:Z="glitch",variation:Le,lightMode:Ue=!1,dpr:Ne,className:Oe="",style:Ie,...Xe}){const ee=A.useRef(null),te=A.useRef(null),j=A.useRef(null),oe={scale:Math.max(.05,o),gridX:Math.max(.1,(c?.[0]??2)*15),gridY:Math.max(.1,(c?.[1]??1)*15),digitSize:u,timeScale:a,pause:s,scanlineIntensity:y,glitchAmount:q,flickerAmount:F,noiseAmp:U,chromaticAberration:N,dither:typeof $=="boolean"?$?1:0:$,curvature:ke,tint:be,mouseReact:Me,mouseStrength:we,pageLoadAnimation:Ae,brightness:Se,glyphs:qe[Ce]??0,glow:S(Fe,0,3),persistence:S(_e,0,1),scramble:S(Ge,0,1),mouseGlow:S(De,0,1),vignette:S(Pe,0,1),clickEffect:$e[Z]??0,clickSeconds:He[Z]??1,variation:Le,lightMode:Ue,dpr:Ne},R=A.useRef(oe);return R.current=oe,A.useEffect(()=>{const M=ee.current,p=te.current,e=p?.getContext("webgl2",{alpha:!0,premultipliedAlpha:!0,antialias:!1,depth:!1,stencil:!1});if(!M||!p||!e)return;const O=Re(e,Ke),I=Re(e,Je);if(!O||!I)return;const m=O.uniforms,r=I.uniforms,Y=e.createVertexArray(),ie=()=>{const t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA8,1,1,0,e.RGBA,e.UNSIGNED_BYTE,null),t},_=[0,1].map(()=>{const t=ie(),i=ie(),n=e.createFramebuffer();return e.bindFramebuffer(e.FRAMEBUFFER,n),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT1,e.TEXTURE_2D,i,0),{rings:t,extra:i,framebuffer:n}});e.bindFramebuffer(e.FRAMEBUFFER,null);const w=ze().matches,d={width:1,height:1,ratio:1,columns:1},f={x:0,y:0,w:1,h:1,key:""},v={x:.5,y:.5,inside:!1},k={x:.5,y:.5},E=new Float32Array(C*4);let W=0,X=0,B=0,G=0,K=!0;const re=R.current.variation;let Q=(typeof re=="number"?re*10:Math.random()*100)*R.current.timeScale,D=R.current.pageLoadAnimation&&!w?0:1,P=0,z=0,V=!0,H=0;const ne=t=>{const i=1+Math.max(0,t.curvature)*2,n=.5-.5*i,l=.5+.5*i,g=.06*Math.max(1,Math.abs(t.glitchAmount))*Math.max(1,Math.abs(t.flickerAmount))+.2,x=t.gridX*d.columns,L=Math.floor((n*t.scale-g)*x)-2,T=Math.floor((l*t.scale+g)*x)+2,h=Math.floor((n*t.scale-g)*t.gridY)-2,ge=Math.floor((l*t.scale+g)*t.gridY)+2,xe=`${L}:${T}:${h}:${ge}`;if(xe!==f.key){f.key=xe,f.x=L,f.y=h,f.w=Math.max(1,Math.min(4096,T-L+1)),f.h=Math.max(1,Math.min(4096,ge-h+1));for(const Te of _)for(const Be of[Te.rings,Te.extra])e.bindTexture(e.TEXTURE_2D,Be),e.texImage2D(e.TEXTURE_2D,0,e.RGBA8,f.w,f.h,0,e.RGBA,e.UNSIGNED_BYTE,null);K=!0}},ae=(t,i)=>{const n=_[G],l=_[1-G];e.bindFramebuffer(e.FRAMEBUFFER,l.framebuffer),e.drawBuffers([e.COLOR_ATTACHMENT0,e.COLOR_ATTACHMENT1]),e.viewport(0,0,f.w,f.h),e.disable(e.BLEND),e.useProgram(O.program),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,n.rings),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,n.extra),e.uniform1i(m.uPrev0,0),e.uniform1i(m.uPrev1,1),e.uniform1f(m.iTime,Q),e.uniform2f(m.uGridMul,t.gridX*d.columns/15,t.gridY/15),e.uniform1f(m.uNoiseAmp,t.noiseAmp),e.uniform1f(m.uScale,t.scale),e.uniform2f(m.uMouse,k.x,k.y),e.uniform1f(m.uMouseStrength,t.mouseStrength),e.uniform1f(m.uUseMouse,t.mouseReact?1:0),e.uniform1f(m.uPageLoadProgress,D),e.uniform1f(m.uUsePageLoadAnimation,t.pageLoadAnimation?1:0),e.uniform2i(m.uOrigin,f.x,f.y),e.uniform1f(m.uDecay,i),e.uniform1f(m.uFresh,K?1:0),e.uniform1f(m.uHover,B),e.bindVertexArray(Y),e.drawArrays(e.TRIANGLES,0,3),e.bindFramebuffer(e.FRAMEBUFFER,null),G=1-G,K=!1},le=()=>{const t=R.current,i=_[G];e.viewport(0,0,p.width,p.height),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.useProgram(I.program),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,i.rings),e.activeTexture(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,i.extra),e.uniform1i(r.uRings0,0),e.uniform1i(r.uRings1,1),e.uniform1f(r.iTime,Q),e.uniform3f(r.iResolution,p.width,p.height,p.width/p.height),e.uniform1f(r.uScale,t.scale),e.uniform2f(r.uGridMul,t.gridX*d.columns/15,t.gridY/15),e.uniform1f(r.uDigitSize,t.digitSize),e.uniform1f(r.uScanlineIntensity,t.scanlineIntensity),e.uniform1f(r.uGlitchAmount,w?0:t.glitchAmount),e.uniform1f(r.uFlickerAmount,w?0:t.flickerAmount),e.uniform1f(r.uChromaticAberration,t.chromaticAberration),e.uniform1f(r.uDither,t.dither),e.uniform1f(r.uCurvature,t.curvature),e.uniform3fv(r.uTint,Ze(t.tint)),e.uniform1f(r.uBrightness,t.brightness),e.uniform1f(r.uLightMode,t.lightMode?1:0),e.uniform2i(r.uOrigin,f.x,f.y),e.uniform2i(r.uCellCount,f.w,f.h),e.uniform1i(r.uGlyphs,t.glyphs),e.uniform1f(r.uGlow,t.glow),e.uniform1f(r.uScramble,t.scramble),e.uniform1f(r.uMouseGlow,t.mouseGlow),e.uniform1f(r.uVignette,t.vignette),e.uniform4fv(r.uClicks,E),e.uniform1i(r.uClickMode,t.clickEffect),e.uniform1f(r.uClickSeconds,t.clickSeconds),e.uniform1f(r.uClock,X),e.bindVertexArray(Y),e.drawArrays(e.TRIANGLES,0,3),e.bindVertexArray(null)},ce=()=>{const t=R.current;d.width=Math.max(1,M.clientWidth),d.height=Math.max(1,M.clientHeight),d.ratio=Math.min(t.dpr||window.devicePixelRatio||1,2),d.columns=Math.min(1,d.width/d.height/1.5),p.width=Math.max(1,Math.round(d.width*d.ratio)),p.height=Math.max(1,Math.round(d.height*d.ratio)),ne(t),ae(t,0),le(),b()},ue=t=>{if(P=0,!V||document.hidden)return;const i=R.current,n=z?S((t-z)/1e3,.001,1/20):1/60;z=t,X+=n,!i.pause&&!w&&(Q+=n*i.timeScale);const l=v.inside?v.x:.5,g=v.inside?v.y:.5,x=1-Math.exp(-n/(v.inside?.19988:.6));k.x+=(l-k.x)*x,k.y+=(g-k.y)*x,B+=((v.inside?1:0)-B)*(1-Math.exp(-n/.35));for(let h=0;h<C;h++)E[h*4+3]>0&&X-E[h*4+2]>i.clickSeconds&&(E[h*4+3]=0);ne(i);const L=i.persistence>0?Math.exp(-n/(.08+i.persistence*1.4)):0;ae(i,L),le(),D<1&&(D=Math.min(1,D+n/Ve));let T=!(i.pause||w)||D<1;T=T||Math.abs(l-k.x)+Math.abs(g-k.y)>1e-4,T=T||Math.abs((v.inside?1:0)-B)>.001;for(let h=0;h<C;h++)T=T||E[h*4+3]>0;H=T?0:H+n,H<2.5&&(P=requestAnimationFrame(ue))};function b(){H=0,!P&&V&&!document.hidden&&(z=0,P=requestAnimationFrame(ue))}const fe=t=>{const i=M.getBoundingClientRect(),n=(t.clientX-i.left)/Math.max(i.width,1),l=1-(t.clientY-i.top)/Math.max(i.height,1);return{x:n,y:l,inside:n>=0&&n<=1&&l>=0&&l<=1}},se=t=>{const{x:i,y:n,inside:l}=fe(t),g=v.inside;v.inside=l,l&&(v.x=i,v.y=n),(l||g)&&b()},me=t=>{const i=R.current,{x:n,y:l,inside:g}=fe(t);if(!g||w||!i.clickEffect)return;const x=W*4;E[x]=n,E[x+1]=l,E[x+2]=X,E[x+3]=1,W=(W+1)%C,b()},de=()=>{v.inside=!1,b()},he=()=>b(),ve=new ResizeObserver(ce);ve.observe(M);const pe=new IntersectionObserver(t=>{V=t.some(i=>i.isIntersecting),V&&b()});return pe.observe(M),window.addEventListener("pointermove",se,{passive:!0}),window.addEventListener("pointerdown",me,{passive:!0}),document.documentElement.addEventListener("pointerleave",de),document.addEventListener("visibilitychange",he),ce(),j.current=b,()=>{cancelAnimationFrame(P),j.current=null,ve.disconnect(),pe.disconnect(),window.removeEventListener("pointermove",se),window.removeEventListener("pointerdown",me),document.documentElement.removeEventListener("pointerleave",de),document.removeEventListener("visibilitychange",he);for(const t of _)e.deleteTexture(t.rings),e.deleteTexture(t.extra),e.deleteFramebuffer(t.framebuffer);e.deleteVertexArray(Y),e.deleteProgram(O.program),e.deleteProgram(I.program),p.isConnected||e.getExtension("WEBGL_lose_context")?.loseContext()}},[]),A.useEffect(()=>{j.current?.()}),ye.jsx("div",{ref:ee,className:["relative h-full w-full overflow-hidden",Oe].filter(Boolean).join(" "),style:Ie,...Xe,children:ye.jsx("canvas",{ref:te,className:"absolute inset-0 block h-full w-full","aria-hidden":"true"})})}export{ot as default};
|