cos-design 3.5.3 → 3.5.4
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/CHANGELOG.md +10 -0
- package/dist/index.cjs +3 -3
- package/dist/index.css +1 -1
- package/dist/index.js +466 -300
- package/dist/src/components/smokeFog/index.d.ts +13 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -433,7 +433,7 @@ import './index.css';var d = {
|
|
|
433
433
|
gravity: Math.random() * .15 + .12
|
|
434
434
|
};
|
|
435
435
|
});
|
|
436
|
-
},
|
|
436
|
+
}, ee = e(({ width: e = 800, height: r = 400, auto: a = !0, particleCount: s = 120 }, c) => {
|
|
437
437
|
let d = o(null), f = o([]), p = o(0), m = o({
|
|
438
438
|
width: e,
|
|
439
439
|
height: r,
|
|
@@ -486,8 +486,8 @@ import './index.css';var d = {
|
|
|
486
486
|
})]
|
|
487
487
|
});
|
|
488
488
|
});
|
|
489
|
-
|
|
490
|
-
var
|
|
489
|
+
ee.displayName = "Confetti";
|
|
490
|
+
var P = {
|
|
491
491
|
cyberGrid: "cos-cyberGrid-VgJwl",
|
|
492
492
|
canvas: "cos-canvas--Mq-O"
|
|
493
493
|
}, te = ({ width: e = 800, height: t = 500, color: r = "#00f0ff", speed: i = 1 }) => {
|
|
@@ -532,14 +532,14 @@ var ee = {
|
|
|
532
532
|
i,
|
|
533
533
|
e
|
|
534
534
|
]), /* @__PURE__ */ l("div", {
|
|
535
|
-
className:
|
|
535
|
+
className: P.cyberGrid,
|
|
536
536
|
style: {
|
|
537
537
|
width: e,
|
|
538
538
|
height: t
|
|
539
539
|
},
|
|
540
540
|
children: /* @__PURE__ */ l("canvas", {
|
|
541
541
|
ref: a,
|
|
542
|
-
className:
|
|
542
|
+
className: P.canvas,
|
|
543
543
|
style: {
|
|
544
544
|
width: e,
|
|
545
545
|
height: t
|
|
@@ -1786,33 +1786,33 @@ var L = {
|
|
|
1786
1786
|
}
|
|
1787
1787
|
})
|
|
1788
1788
|
});
|
|
1789
|
-
},
|
|
1789
|
+
}, Ze = {
|
|
1790
1790
|
neonText: "cos-neonText-JMP7i",
|
|
1791
1791
|
text: "cos-text-GTO-0",
|
|
1792
1792
|
flicker: "cos-flicker-nXceV",
|
|
1793
1793
|
"neon-flicker": "cos-neon-flicker-uDkmM",
|
|
1794
1794
|
reflection: "cos-reflection-aEYj6"
|
|
1795
|
-
},
|
|
1796
|
-
className:
|
|
1795
|
+
}, Qe = ({ text: e = "NEON", color: t = "#ff00de", fontSize: n = 72, flicker: r = !0 }) => /* @__PURE__ */ u("div", {
|
|
1796
|
+
className: Ze.neonText,
|
|
1797
1797
|
children: [/* @__PURE__ */ l("h1", {
|
|
1798
|
-
className: `${
|
|
1798
|
+
className: `${Ze.text} ${r ? Ze.flicker : ""}`,
|
|
1799
1799
|
style: {
|
|
1800
1800
|
fontSize: n,
|
|
1801
1801
|
"--neon-color": t
|
|
1802
1802
|
},
|
|
1803
1803
|
children: e
|
|
1804
1804
|
}), /* @__PURE__ */ l("p", {
|
|
1805
|
-
className:
|
|
1805
|
+
className: Ze.reflection,
|
|
1806
1806
|
style: {
|
|
1807
1807
|
fontSize: n * .35,
|
|
1808
1808
|
color: t
|
|
1809
1809
|
},
|
|
1810
1810
|
children: e
|
|
1811
1811
|
})]
|
|
1812
|
-
}),
|
|
1812
|
+
}), $e = {
|
|
1813
1813
|
newtonCradle: "cos-newtonCradle-mFl-b",
|
|
1814
1814
|
canvas: "cos-canvas-TWKl5"
|
|
1815
|
-
},
|
|
1815
|
+
}, et = ({ ballCount: e = 5, color: t = "#38bdf8", width: r = 280, height: i = 200 }) => {
|
|
1816
1816
|
let a = o(null), s = Math.max(2, Math.min(e, 7));
|
|
1817
1817
|
return n(() => {
|
|
1818
1818
|
let e = a.current;
|
|
@@ -1875,7 +1875,7 @@ var L = {
|
|
|
1875
1875
|
i,
|
|
1876
1876
|
r
|
|
1877
1877
|
]), /* @__PURE__ */ l("div", {
|
|
1878
|
-
className:
|
|
1878
|
+
className: $e.newtonCradle,
|
|
1879
1879
|
style: {
|
|
1880
1880
|
width: r,
|
|
1881
1881
|
height: i,
|
|
@@ -1883,19 +1883,19 @@ var L = {
|
|
|
1883
1883
|
},
|
|
1884
1884
|
children: /* @__PURE__ */ l("canvas", {
|
|
1885
1885
|
ref: a,
|
|
1886
|
-
className:
|
|
1886
|
+
className: $e.canvas,
|
|
1887
1887
|
style: {
|
|
1888
1888
|
width: r,
|
|
1889
1889
|
height: i
|
|
1890
1890
|
}
|
|
1891
1891
|
})
|
|
1892
1892
|
});
|
|
1893
|
-
},
|
|
1893
|
+
}, tt = {
|
|
1894
1894
|
orbitalChart: "cos-orbitalChart-XLORB",
|
|
1895
1895
|
canvas: "cos-canvas-hGVud",
|
|
1896
1896
|
legend: "cos-legend-Np9Mm",
|
|
1897
1897
|
swatch: "cos-swatch-xEKvA"
|
|
1898
|
-
},
|
|
1898
|
+
}, nt = [
|
|
1899
1899
|
{
|
|
1900
1900
|
label: "A",
|
|
1901
1901
|
value: 30,
|
|
@@ -1916,7 +1916,7 @@ var L = {
|
|
|
1916
1916
|
value: 25,
|
|
1917
1917
|
color: "#4ade80"
|
|
1918
1918
|
}
|
|
1919
|
-
],
|
|
1919
|
+
], rt = ({ data: e = nt, size: t = 240 }) => {
|
|
1920
1920
|
let r = o(null);
|
|
1921
1921
|
return n(() => {
|
|
1922
1922
|
let n = r.current;
|
|
@@ -1945,23 +1945,23 @@ var L = {
|
|
|
1945
1945
|
cancelAnimationFrame(u), p();
|
|
1946
1946
|
};
|
|
1947
1947
|
}, [e, t]), /* @__PURE__ */ u("div", {
|
|
1948
|
-
className:
|
|
1948
|
+
className: tt.orbitalChart,
|
|
1949
1949
|
style: {
|
|
1950
1950
|
width: t,
|
|
1951
1951
|
height: t
|
|
1952
1952
|
},
|
|
1953
1953
|
children: [/* @__PURE__ */ l("canvas", {
|
|
1954
1954
|
ref: r,
|
|
1955
|
-
className:
|
|
1955
|
+
className: tt.canvas,
|
|
1956
1956
|
style: {
|
|
1957
1957
|
width: t,
|
|
1958
1958
|
height: t
|
|
1959
1959
|
}
|
|
1960
1960
|
}), /* @__PURE__ */ l("ul", {
|
|
1961
|
-
className:
|
|
1961
|
+
className: tt.legend,
|
|
1962
1962
|
children: e.map((e) => /* @__PURE__ */ u("li", { children: [
|
|
1963
1963
|
/* @__PURE__ */ l("span", {
|
|
1964
|
-
className:
|
|
1964
|
+
className: tt.swatch,
|
|
1965
1965
|
style: { background: e.color }
|
|
1966
1966
|
}),
|
|
1967
1967
|
e.label,
|
|
@@ -1971,11 +1971,11 @@ var L = {
|
|
|
1971
1971
|
] }, e.label))
|
|
1972
1972
|
})]
|
|
1973
1973
|
});
|
|
1974
|
-
},
|
|
1974
|
+
}, it = {
|
|
1975
1975
|
particleNetwork: "cos-particleNetwork-GSZq-",
|
|
1976
1976
|
canvas: "cos-canvas-E-BGP",
|
|
1977
1977
|
hint: "cos-hint-LEO5o"
|
|
1978
|
-
},
|
|
1978
|
+
}, at = ({ width: e = 800, height: r = 500, particleCount: i = 60, linkDistance: a = 120, repelRadius: s = 150, color: c = "#38bdf8" }) => {
|
|
1979
1979
|
let d = o(null), f = o([]), p = o({
|
|
1980
1980
|
x: -1e3,
|
|
1981
1981
|
y: -1e3
|
|
@@ -2058,14 +2058,14 @@ var L = {
|
|
|
2058
2058
|
};
|
|
2059
2059
|
};
|
|
2060
2060
|
return /* @__PURE__ */ u("div", {
|
|
2061
|
-
className:
|
|
2061
|
+
className: it.particleNetwork,
|
|
2062
2062
|
style: {
|
|
2063
2063
|
width: e,
|
|
2064
2064
|
height: r
|
|
2065
2065
|
},
|
|
2066
2066
|
children: [/* @__PURE__ */ l("canvas", {
|
|
2067
2067
|
ref: d,
|
|
2068
|
-
className:
|
|
2068
|
+
className: it.canvas,
|
|
2069
2069
|
style: {
|
|
2070
2070
|
width: e,
|
|
2071
2071
|
height: r
|
|
@@ -2075,14 +2075,14 @@ var L = {
|
|
|
2075
2075
|
onTouchMove: _,
|
|
2076
2076
|
onTouchEnd: y
|
|
2077
2077
|
}), /* @__PURE__ */ l("p", {
|
|
2078
|
-
className:
|
|
2078
|
+
className: it.hint,
|
|
2079
2079
|
children: "移动鼠标或手指与粒子互动"
|
|
2080
2080
|
})]
|
|
2081
2081
|
});
|
|
2082
|
-
},
|
|
2082
|
+
}, ot = {
|
|
2083
2083
|
plasmaBall: "cos-plasmaBall-xGHSj",
|
|
2084
2084
|
canvas: "cos-canvas-V1CgL"
|
|
2085
|
-
},
|
|
2085
|
+
}, st = ({ width: e = 320, height: t = 320, color: r = "#a78bfa", arcCount: i = 8 }) => {
|
|
2086
2086
|
let a = o(null), s = o({
|
|
2087
2087
|
x: e / 2,
|
|
2088
2088
|
y: t / 2,
|
|
@@ -2143,135 +2143,285 @@ var L = {
|
|
|
2143
2143
|
t,
|
|
2144
2144
|
e
|
|
2145
2145
|
]), /* @__PURE__ */ l("div", {
|
|
2146
|
-
className:
|
|
2146
|
+
className: ot.plasmaBall,
|
|
2147
2147
|
style: {
|
|
2148
2148
|
width: e,
|
|
2149
2149
|
height: t
|
|
2150
2150
|
},
|
|
2151
2151
|
children: /* @__PURE__ */ l("canvas", {
|
|
2152
2152
|
ref: a,
|
|
2153
|
-
className:
|
|
2153
|
+
className: ot.canvas,
|
|
2154
2154
|
style: {
|
|
2155
2155
|
width: e,
|
|
2156
2156
|
height: t
|
|
2157
2157
|
}
|
|
2158
2158
|
})
|
|
2159
2159
|
});
|
|
2160
|
-
},
|
|
2160
|
+
}, ct = {
|
|
2161
2161
|
smokeFog: "cos-smokeFog-SYlts",
|
|
2162
2162
|
canvas: "cos-canvas-iOJV7"
|
|
2163
|
-
},
|
|
2164
|
-
|
|
2163
|
+
}, lt = 10, V = 128, ut = "#d2d4d8", dt = [
|
|
2164
|
+
"#14151c",
|
|
2165
|
+
"#1a1b24",
|
|
2166
|
+
"#0e0f14"
|
|
2167
|
+
], ft = (e, t) => {
|
|
2168
|
+
let n = Math.sin(e * 127.1 + t * 311.7) * 43758.5453;
|
|
2169
|
+
return n - Math.floor(n);
|
|
2170
|
+
}, pt = (e, t) => {
|
|
2171
|
+
let n = Math.floor(e), r = Math.floor(t), i = e - n, a = t - r, o = i * i * (3 - 2 * i), s = a * a * (3 - 2 * a), c = ft(n, r), l = ft(n + 1, r), u = ft(n, r + 1), d = ft(n + 1, r + 1);
|
|
2172
|
+
return c + (l - c) * o + (u - c) * s + (c - l - u + d) * o * s;
|
|
2173
|
+
}, mt = (e, t) => {
|
|
2174
|
+
let n = 0, r = .5, i = 1;
|
|
2175
|
+
for (let a = 0; a < 4; a++) n += r * pt(e * i, t * i), i *= 2.05, r *= .5;
|
|
2176
|
+
return n;
|
|
2177
|
+
}, H = (e, t) => {
|
|
2178
|
+
let n = e.replace("#", "").trim(), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n;
|
|
2179
|
+
if (r.length !== 6) return t;
|
|
2180
|
+
let i = Number.parseInt(r, 16);
|
|
2181
|
+
return Number.isNaN(i) ? t : [
|
|
2182
|
+
i >> 16 & 255,
|
|
2183
|
+
i >> 8 & 255,
|
|
2184
|
+
i & 255
|
|
2185
|
+
];
|
|
2186
|
+
}, ht = (e, t, n) => [
|
|
2187
|
+
Math.round(e[0] + (t[0] - e[0]) * n),
|
|
2188
|
+
Math.round(e[1] + (t[1] - e[1]) * n),
|
|
2189
|
+
Math.round(e[2] + (t[2] - e[2]) * n)
|
|
2190
|
+
], U = (e, t = 1) => t >= 1 ? `rgb(${e[0]} ${e[1]} ${e[2]})` : `rgb(${e[0]} ${e[1]} ${e[2]} / ${t})`, gt = (e) => {
|
|
2191
|
+
if (Array.isArray(e) && e.length >= 3) return [
|
|
2192
|
+
e[0],
|
|
2193
|
+
e[1],
|
|
2194
|
+
e[2]
|
|
2195
|
+
];
|
|
2196
|
+
let t = H(typeof e == "string" ? e : dt[2], [
|
|
2197
|
+
14,
|
|
2198
|
+
15,
|
|
2199
|
+
20
|
|
2200
|
+
]), n = ht(t, [
|
|
2201
|
+
255,
|
|
2202
|
+
255,
|
|
2203
|
+
255
|
|
2204
|
+
], .06);
|
|
2205
|
+
return [
|
|
2206
|
+
U(ht(t, [
|
|
2207
|
+
255,
|
|
2208
|
+
255,
|
|
2209
|
+
255
|
|
2210
|
+
], .1)),
|
|
2211
|
+
U(n),
|
|
2212
|
+
U(t)
|
|
2213
|
+
];
|
|
2214
|
+
}, _t = (e, t) => {
|
|
2215
|
+
let n = document.createElement("canvas");
|
|
2216
|
+
n.width = V, n.height = V;
|
|
2217
|
+
let r = n.getContext("2d"), i = r.createImageData(V, V), a = i.data, o = V / 2, s = V / 2, c = V * .48;
|
|
2218
|
+
for (let n = 0; n < V; n++) for (let r = 0; r < V; r++) {
|
|
2219
|
+
let i = (r - o) / c, l = (n - s) / c, u = Math.hypot(i, l);
|
|
2220
|
+
if (u > 1.15) continue;
|
|
2221
|
+
let d = mt(r * .045 + e * 17.1, n * .045 + e * 9.3) * .7 + mt(r * .09 - e * 3.2, n * .09 + e * 5.7) * .3, f = u + (d - .45) * .55, p = 1 - Math.max(0, f);
|
|
2222
|
+
if (p = Math.max(0, p) ** 1.35, p *= .55 + d * .7, p < .01) continue;
|
|
2223
|
+
let m = (n * V + r) * 4, h = .88 + d * .18;
|
|
2224
|
+
a[m] = Math.min(255, t[0] * h), a[m + 1] = Math.min(255, t[1] * h + 1), a[m + 2] = Math.min(255, t[2] * h + 3), a[m + 3] = Math.min(255, p * 210);
|
|
2225
|
+
}
|
|
2226
|
+
return r.putImageData(i, 0, 0), n;
|
|
2227
|
+
}, vt = (e) => Array.from({ length: lt }, (t, n) => _t(n + 1, e)), yt = (e, t, n = 0) => {
|
|
2228
|
+
let r = 70 + Math.random() * 110, i = Math.min(.92, n * .88), a = t * (1 - n * .92) + r * (.15 - n * .1), o = (.32 + Math.random() * .28) * (1 - n * .55);
|
|
2165
2229
|
return {
|
|
2166
2230
|
x: Math.random() * e,
|
|
2167
|
-
y:
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2231
|
+
y: a,
|
|
2232
|
+
vx: (Math.random() - .5) * .18,
|
|
2233
|
+
vy: -(.08 + Math.random() * .16),
|
|
2234
|
+
size: r * (.7 + i * .55),
|
|
2235
|
+
birthSize: r,
|
|
2236
|
+
maxSize: r * (1.8 + Math.random() * 1.4),
|
|
2237
|
+
rotation: Math.random() * Math.PI * 2,
|
|
2238
|
+
spin: (Math.random() - .5) * .004,
|
|
2239
|
+
age: i,
|
|
2240
|
+
ageSpeed: 4e-4 + Math.random() * 65e-5,
|
|
2241
|
+
opacity: o,
|
|
2242
|
+
sprite: Math.floor(Math.random() * lt),
|
|
2243
|
+
stretch: .85 + Math.random() * .55 + n * .25,
|
|
2244
|
+
receptivity: .5 + Math.random() * .85,
|
|
2245
|
+
mass: .5 + Math.random() * .9,
|
|
2246
|
+
phase: Math.random() * Math.PI * 2,
|
|
2247
|
+
warmth: Math.random()
|
|
2179
2248
|
};
|
|
2180
|
-
},
|
|
2181
|
-
let
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2249
|
+
}, bt = (e, t) => {
|
|
2250
|
+
let n = Math.hypot(e.vx, e.vy);
|
|
2251
|
+
if (n <= t) return;
|
|
2252
|
+
let r = t / n;
|
|
2253
|
+
e.vx *= r, e.vy *= r;
|
|
2254
|
+
}, xt = (e) => e < .06 ? e / .06 : e > .55 ? Math.max(0, 1 - (e - .55) / .45) : 1, St = (e, t) => .22 + Math.min(1, Math.max(0, e / t)) ** 1.15 * .78, Ct = ({ width: e = 800, height: r = 500, density: i = .5, color: a = ut, backgroundColor: s = dt, speed: c = 1, disperseStrength: u = 1, disperseRadius: d = 1, interactive: f = !0 }) => {
|
|
2255
|
+
let p = o(null), m = o([]), h = o([]), g = o(null), _ = o(""), b = o(0), x = o({
|
|
2256
|
+
speed: c,
|
|
2257
|
+
disperseStrength: u,
|
|
2258
|
+
disperseRadius: d,
|
|
2259
|
+
interactive: f,
|
|
2260
|
+
color: a,
|
|
2261
|
+
backgroundColor: s
|
|
2262
|
+
});
|
|
2185
2263
|
n(() => {
|
|
2186
|
-
|
|
2187
|
-
|
|
2264
|
+
x.current = {
|
|
2265
|
+
speed: c,
|
|
2266
|
+
disperseStrength: u,
|
|
2267
|
+
disperseRadius: d,
|
|
2268
|
+
interactive: f,
|
|
2269
|
+
color: a,
|
|
2270
|
+
backgroundColor: s
|
|
2271
|
+
};
|
|
2272
|
+
}, [
|
|
2273
|
+
c,
|
|
2274
|
+
u,
|
|
2275
|
+
d,
|
|
2276
|
+
f,
|
|
2277
|
+
a,
|
|
2278
|
+
s
|
|
2279
|
+
]), n(() => {
|
|
2280
|
+
g.current = vt(H(a, [
|
|
2281
|
+
210,
|
|
2282
|
+
212,
|
|
2283
|
+
216
|
|
2284
|
+
])), _.current = a;
|
|
2285
|
+
}, [a]), n(() => {
|
|
2286
|
+
let t = Math.floor(56 + i * 100);
|
|
2287
|
+
m.current = Array.from({ length: t }, () => yt(e, r, Math.random() ** 1.75));
|
|
2188
2288
|
}, [
|
|
2189
2289
|
i,
|
|
2190
2290
|
r,
|
|
2191
2291
|
e
|
|
2192
2292
|
]);
|
|
2193
|
-
let
|
|
2194
|
-
let i =
|
|
2195
|
-
if (!i) return;
|
|
2196
|
-
let
|
|
2197
|
-
|
|
2293
|
+
let S = t((t, n) => {
|
|
2294
|
+
let i = x.current;
|
|
2295
|
+
if (!i.interactive) return;
|
|
2296
|
+
let a = p.current;
|
|
2297
|
+
if (!a) return;
|
|
2298
|
+
let o = a.getBoundingClientRect(), s = (t - o.left) / o.width * e, c = (n - o.top) / o.height * r, l = y(i.disperseRadius, 0, 3), u = y(i.disperseStrength, 0, 3);
|
|
2299
|
+
h.current.length > 3 && h.current.shift(), h.current.push({
|
|
2198
2300
|
x: s,
|
|
2199
|
-
y:
|
|
2301
|
+
y: c,
|
|
2200
2302
|
life: 1,
|
|
2201
|
-
windAngle: Math.random() * Math.PI * 2,
|
|
2202
2303
|
swirl: Math.random() < .5 ? -1 : 1,
|
|
2203
|
-
|
|
2204
|
-
|
|
2304
|
+
radius: Math.min(e, r) * .08 * l,
|
|
2305
|
+
maxRadius: Math.min(e, r) * (.42 + Math.random() * .12) * l,
|
|
2306
|
+
strength: (.7 + Math.random() * .25) * u
|
|
2205
2307
|
});
|
|
2206
2308
|
}, [r, e]);
|
|
2207
2309
|
return n(() => {
|
|
2208
|
-
let e =
|
|
2310
|
+
let e = p.current;
|
|
2209
2311
|
if (!e) return;
|
|
2210
|
-
let t = (e) =>
|
|
2211
|
-
|
|
2212
|
-
t && d(t.clientX, t.clientY);
|
|
2213
|
-
};
|
|
2214
|
-
return e.addEventListener("click", t), e.addEventListener("touchstart", n, { passive: !0 }), () => {
|
|
2215
|
-
e.removeEventListener("click", t), e.removeEventListener("touchstart", n);
|
|
2312
|
+
let t = (e) => {
|
|
2313
|
+
e.pointerType === "mouse" && e.button !== 0 || S(e.clientX, e.clientY);
|
|
2216
2314
|
};
|
|
2217
|
-
|
|
2218
|
-
|
|
2315
|
+
return e.addEventListener("pointerdown", t), () => e.removeEventListener("pointerdown", t);
|
|
2316
|
+
}, [S]), n(() => {
|
|
2317
|
+
let t = p.current;
|
|
2219
2318
|
if (!t) return;
|
|
2220
|
-
let n = window.devicePixelRatio || 1;
|
|
2221
|
-
t.width = e * n, t.height = r * n;
|
|
2319
|
+
let n = Math.min(window.devicePixelRatio || 1, 2);
|
|
2320
|
+
t.width = Math.floor(e * n), t.height = Math.floor(r * n);
|
|
2222
2321
|
let i = t.getContext("2d");
|
|
2223
2322
|
if (!i) return;
|
|
2224
2323
|
i.setTransform(n, 0, 0, n, 0, 0);
|
|
2225
|
-
let
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2324
|
+
let a = H(x.current.color, [
|
|
2325
|
+
210,
|
|
2326
|
+
212,
|
|
2327
|
+
216
|
|
2328
|
+
]);
|
|
2329
|
+
g.current || (g.current = vt(a), _.current = x.current.color);
|
|
2330
|
+
let o = g.current, s = 0, c = document.hidden, l = v((e) => {
|
|
2331
|
+
c = e;
|
|
2332
|
+
}), u = typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, d = () => {
|
|
2333
|
+
let [t, n, a] = gt(x.current.backgroundColor), o = i.createLinearGradient(0, 0, 0, r);
|
|
2334
|
+
o.addColorStop(0, t), o.addColorStop(.45, n), o.addColorStop(1, a), i.fillStyle = o, i.fillRect(0, 0, e, r);
|
|
2335
|
+
let s = H(a, [
|
|
2336
|
+
14,
|
|
2337
|
+
15,
|
|
2338
|
+
20
|
|
2339
|
+
]), c = ht(s, [
|
|
2340
|
+
255,
|
|
2341
|
+
255,
|
|
2342
|
+
255
|
|
2343
|
+
], .22), l = i.createRadialGradient(e * .5, r * .75, 0, e * .5, r, e * .55);
|
|
2344
|
+
l.addColorStop(0, U(c, .35)), l.addColorStop(1, U(s, 0)), i.fillStyle = l, i.fillRect(0, 0, e, r);
|
|
2345
|
+
}, f = (e) => {
|
|
2346
|
+
let t = xt(e.age) * St(e.y, r);
|
|
2347
|
+
if (t <= .01) return;
|
|
2348
|
+
let n = o[e.sprite], a = e.birthSize + (e.maxSize - e.birthSize) * Math.min(1, e.age * 1.15), s = e.size + (a - e.size) * .35, c = s, l = s * e.stretch;
|
|
2349
|
+
i.save(), i.translate(e.x, e.y), i.rotate(e.rotation), i.globalAlpha = e.opacity * t * (.85 + e.warmth * .2), i.globalCompositeOperation = "screen", i.drawImage(n, -c / 2, -l / 2, c, l), i.restore();
|
|
2350
|
+
}, S = () => {
|
|
2351
|
+
if (b.current = requestAnimationFrame(S), c) return;
|
|
2352
|
+
let t = y(x.current.speed, 0, 3), n = y(x.current.disperseStrength, 0, 3);
|
|
2353
|
+
s += .01 * Math.max(t, .001), d(), _.current !== x.current.color && (g.current = vt(H(x.current.color, [
|
|
2354
|
+
210,
|
|
2355
|
+
212,
|
|
2356
|
+
216
|
|
2357
|
+
])), _.current = x.current.color);
|
|
2358
|
+
let a = g.current ?? o, l = m.current, u = h.current;
|
|
2359
|
+
for (let e = u.length - 1; e >= 0; e--) {
|
|
2360
|
+
let t = u[e], r = 1 - t.life, i = Math.sin(Math.PI * Math.min(1, r * 1.05)) * t.strength;
|
|
2361
|
+
t.radius += (t.maxRadius - t.radius) * .055;
|
|
2362
|
+
for (let e of l) {
|
|
2363
|
+
let r = e.x - t.x, a = e.y - t.y, o = Math.hypot(r, a) || .001;
|
|
2364
|
+
if (o > t.radius) continue;
|
|
2365
|
+
let c = o / t.radius, l = Math.exp(-c * c * 2.2) * (1 - c * .35), u = Math.exp(-(((c - .72) / .32) ** 2)), d = l * .55 + u * .45, f = .72 + .28 * Math.sin(e.phase * 2.7 + s * 1.2 + o * .03), p = d * e.receptivity * f * i;
|
|
2366
|
+
if (p < .02) continue;
|
|
2367
|
+
let m = r / o, h = a / o, g = -h * t.swirl, _ = m * t.swirl, v = 1 / (.65 + e.mass * .7), y = Math.sin(e.phase * 4.2 + s * 1.6) * .35;
|
|
2368
|
+
e.vx += (m * .55 + g * .22 + y * .12) * p * v, e.vy += (h * .48 + _ * .22 - .06) * p * v, e.opacity *= 1 - p * .028, e.maxSize *= 1 + p * .02, e.stretch += p * .012, e.spin += y * p * .004, bt(e, 2.4 * Math.max(n, .35));
|
|
2242
2369
|
}
|
|
2243
|
-
t.life *= .
|
|
2370
|
+
t.life *= .972, t.life < .04 && u.splice(e, 1);
|
|
2244
2371
|
}
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
let
|
|
2248
|
-
|
|
2249
|
-
let
|
|
2250
|
-
|
|
2251
|
-
|
|
2372
|
+
i.save();
|
|
2373
|
+
for (let n = 0; n < l.length; n++) {
|
|
2374
|
+
let o = l[n], c = Math.sin(s * .55 + o.phase) * .16, u = Math.cos(s * .4 + o.phase * 1.3) * .05;
|
|
2375
|
+
o.vx += c * .018 * t, o.vy += u * .01 * t - .0035 * t;
|
|
2376
|
+
let d = Math.hypot(o.vx, o.vy), f = d > .8 ? .975 : .99;
|
|
2377
|
+
o.vx *= f, o.vy *= f, o.x += o.vx * t, o.y += o.vy * t, o.rotation += (o.spin + o.vx * .002) * t, o.age += o.ageSpeed * t;
|
|
2378
|
+
let p = o.birthSize + (o.maxSize - o.birthSize) * Math.min(1, o.age * 1.15);
|
|
2379
|
+
o.size += (p - o.size) * .04;
|
|
2380
|
+
let m = (.3 + o.warmth * .1) * St(o.y, r), h = .006 + .008 * Math.max(0, 1 - d / 2.2);
|
|
2381
|
+
if (o.opacity += (m - o.opacity) * h, o.stretch += (1.05 + (1 - o.y / r) * .55 - o.stretch) * .01, o.age >= 1 || o.y < -o.size || o.opacity < .02) {
|
|
2382
|
+
l[n] = yt(e, r, 0);
|
|
2383
|
+
continue;
|
|
2384
|
+
}
|
|
2385
|
+
o.x < -o.size && (o.x = e + o.size * .5), o.x > e + o.size && (o.x = -o.size * .5);
|
|
2386
|
+
let g = xt(o.age) * St(o.y, r);
|
|
2387
|
+
if (g <= .01) continue;
|
|
2388
|
+
let _ = a[o.sprite], v = o.birthSize + (o.maxSize - o.birthSize) * Math.min(1, o.age * 1.15), y = o.size + (v - o.size) * .35, b = y, x = y * o.stretch;
|
|
2389
|
+
i.save(), i.translate(o.x, o.y), i.rotate(o.rotation), i.globalAlpha = o.opacity * g * (.85 + o.warmth * .2), i.globalCompositeOperation = "screen", i.drawImage(_, -b / 2, -x / 2, b, x), i.restore();
|
|
2390
|
+
}
|
|
2391
|
+
i.restore(), i.globalCompositeOperation = "source-over", i.globalAlpha = 1;
|
|
2252
2392
|
};
|
|
2253
|
-
|
|
2254
|
-
|
|
2393
|
+
if (u) {
|
|
2394
|
+
d();
|
|
2395
|
+
for (let e of m.current) f(e);
|
|
2396
|
+
return i.globalCompositeOperation = "source-over", i.globalAlpha = 1, () => {
|
|
2397
|
+
l();
|
|
2398
|
+
};
|
|
2399
|
+
}
|
|
2400
|
+
return S(), () => {
|
|
2401
|
+
cancelAnimationFrame(b.current), l();
|
|
2255
2402
|
};
|
|
2256
2403
|
}, [r, e]), /* @__PURE__ */ l("div", {
|
|
2257
|
-
className:
|
|
2404
|
+
className: ct.smokeFog,
|
|
2258
2405
|
style: {
|
|
2259
2406
|
width: e,
|
|
2260
2407
|
height: r
|
|
2261
2408
|
},
|
|
2262
2409
|
children: /* @__PURE__ */ l("canvas", {
|
|
2263
|
-
ref:
|
|
2264
|
-
className:
|
|
2410
|
+
ref: p,
|
|
2411
|
+
className: ct.canvas,
|
|
2265
2412
|
style: {
|
|
2266
2413
|
width: e,
|
|
2267
|
-
height: r
|
|
2268
|
-
|
|
2414
|
+
height: r,
|
|
2415
|
+
cursor: f ? "pointer" : "default"
|
|
2416
|
+
},
|
|
2417
|
+
role: "img",
|
|
2418
|
+
"aria-label": f ? "烟雾背景,点击可驱散" : "烟雾背景"
|
|
2269
2419
|
})
|
|
2270
2420
|
});
|
|
2271
|
-
},
|
|
2421
|
+
}, wt = {
|
|
2272
2422
|
solarSystem: "cos-solarSystem-27h8F",
|
|
2273
2423
|
canvas: "cos-canvas-C0nRa"
|
|
2274
|
-
},
|
|
2424
|
+
}, Tt = [
|
|
2275
2425
|
{
|
|
2276
2426
|
name: "Mercury",
|
|
2277
2427
|
radius: 0,
|
|
@@ -2329,10 +2479,10 @@ var L = {
|
|
|
2329
2479
|
size: 2,
|
|
2330
2480
|
parent: 2
|
|
2331
2481
|
}
|
|
2332
|
-
],
|
|
2482
|
+
], Et = ({ width: e = 400, height: t = 400, speed: r = 1, showOrbits: i = !0 }) => {
|
|
2333
2483
|
let a = o(null), s = o([]), c = o([]);
|
|
2334
2484
|
return n(() => {
|
|
2335
|
-
s.current =
|
|
2485
|
+
s.current = Tt.map((e) => ({
|
|
2336
2486
|
...e,
|
|
2337
2487
|
angle: Math.random() * Math.PI * 2
|
|
2338
2488
|
})), c.current = Array.from({ length: 80 }, () => ({
|
|
@@ -2381,24 +2531,24 @@ var L = {
|
|
|
2381
2531
|
r,
|
|
2382
2532
|
e
|
|
2383
2533
|
]), /* @__PURE__ */ l("div", {
|
|
2384
|
-
className:
|
|
2534
|
+
className: wt.solarSystem,
|
|
2385
2535
|
style: {
|
|
2386
2536
|
width: e,
|
|
2387
2537
|
height: t
|
|
2388
2538
|
},
|
|
2389
2539
|
children: /* @__PURE__ */ l("canvas", {
|
|
2390
2540
|
ref: a,
|
|
2391
|
-
className:
|
|
2541
|
+
className: wt.canvas,
|
|
2392
2542
|
style: {
|
|
2393
2543
|
width: e,
|
|
2394
2544
|
height: t
|
|
2395
2545
|
}
|
|
2396
2546
|
})
|
|
2397
2547
|
});
|
|
2398
|
-
},
|
|
2548
|
+
}, Dt = {
|
|
2399
2549
|
snowfall: "cos-snowfall-Q-Dhg",
|
|
2400
2550
|
canvas: "cos-canvas-bJVF8"
|
|
2401
|
-
},
|
|
2551
|
+
}, Ot = ({ width: e = 800, height: r = 500, mode: i = "snow", count: a = 120 }) => {
|
|
2402
2552
|
let s = o(null), c = o([]), u = o(0), d = t((t) => ({
|
|
2403
2553
|
x: Math.random() * e,
|
|
2404
2554
|
y: t ?? Math.random() * r,
|
|
@@ -2445,24 +2595,24 @@ var L = {
|
|
|
2445
2595
|
i,
|
|
2446
2596
|
e
|
|
2447
2597
|
]), /* @__PURE__ */ l("div", {
|
|
2448
|
-
className:
|
|
2598
|
+
className: Dt.snowfall,
|
|
2449
2599
|
style: {
|
|
2450
2600
|
width: e,
|
|
2451
2601
|
height: r
|
|
2452
2602
|
},
|
|
2453
2603
|
children: /* @__PURE__ */ l("canvas", {
|
|
2454
2604
|
ref: s,
|
|
2455
|
-
className:
|
|
2605
|
+
className: Dt.canvas,
|
|
2456
2606
|
style: {
|
|
2457
2607
|
width: e,
|
|
2458
2608
|
height: r
|
|
2459
2609
|
}
|
|
2460
2610
|
})
|
|
2461
2611
|
});
|
|
2462
|
-
},
|
|
2612
|
+
}, kt = {
|
|
2463
2613
|
starfield: "cos-starfield-QTwia",
|
|
2464
2614
|
canvas: "cos-canvas-C2t3g"
|
|
2465
|
-
},
|
|
2615
|
+
}, At = ({ width: e = 800, height: t = 500, starCount: r = 400, speed: i = 1 }) => {
|
|
2466
2616
|
let a = o(null), s = o([]), c = o(0);
|
|
2467
2617
|
return n(() => {
|
|
2468
2618
|
s.current = Array.from({ length: r }, () => ({
|
|
@@ -2505,21 +2655,21 @@ var L = {
|
|
|
2505
2655
|
r,
|
|
2506
2656
|
e
|
|
2507
2657
|
]), /* @__PURE__ */ l("div", {
|
|
2508
|
-
className:
|
|
2658
|
+
className: kt.starfield,
|
|
2509
2659
|
style: {
|
|
2510
2660
|
width: e,
|
|
2511
2661
|
height: t
|
|
2512
2662
|
},
|
|
2513
2663
|
children: /* @__PURE__ */ l("canvas", {
|
|
2514
2664
|
ref: a,
|
|
2515
|
-
className:
|
|
2665
|
+
className: kt.canvas,
|
|
2516
2666
|
style: {
|
|
2517
2667
|
width: e,
|
|
2518
2668
|
height: t
|
|
2519
2669
|
}
|
|
2520
2670
|
})
|
|
2521
2671
|
});
|
|
2522
|
-
},
|
|
2672
|
+
}, W = {
|
|
2523
2673
|
progressChest: "cos-progressChest-Bqcv1",
|
|
2524
2674
|
barWrap: "cos-barWrap-E2pnl",
|
|
2525
2675
|
barTrack: "cos-barTrack-dKLhs",
|
|
@@ -2534,37 +2684,37 @@ var L = {
|
|
|
2534
2684
|
treasure: "cos-treasure-nx-6S",
|
|
2535
2685
|
pop: "cos-pop-uRZvT",
|
|
2536
2686
|
label: "cos-label-61hRe"
|
|
2537
|
-
},
|
|
2687
|
+
}, jt = ({ progress: e = 0, onOpen: t, label: r = "开启宝箱" }) => {
|
|
2538
2688
|
let i = o(!1), a = o(t), s = y(e, 0, 100), c = s >= 100;
|
|
2539
2689
|
return n(() => {
|
|
2540
2690
|
a.current = t;
|
|
2541
2691
|
}, [t]), n(() => {
|
|
2542
2692
|
c && !i.current && (i.current = !0, a.current?.()), c || (i.current = !1);
|
|
2543
2693
|
}, [c]), /* @__PURE__ */ u("div", {
|
|
2544
|
-
className:
|
|
2694
|
+
className: W.progressChest,
|
|
2545
2695
|
children: [
|
|
2546
2696
|
/* @__PURE__ */ u("div", {
|
|
2547
|
-
className:
|
|
2697
|
+
className: W.barWrap,
|
|
2548
2698
|
children: [/* @__PURE__ */ l("div", {
|
|
2549
|
-
className:
|
|
2699
|
+
className: W.barTrack,
|
|
2550
2700
|
children: /* @__PURE__ */ l("div", {
|
|
2551
|
-
className:
|
|
2701
|
+
className: W.barFill,
|
|
2552
2702
|
style: { width: `${s}%` }
|
|
2553
2703
|
})
|
|
2554
2704
|
}), /* @__PURE__ */ u("span", {
|
|
2555
|
-
className:
|
|
2705
|
+
className: W.pct,
|
|
2556
2706
|
children: [s.toFixed(0), "%"]
|
|
2557
2707
|
})]
|
|
2558
2708
|
}),
|
|
2559
2709
|
/* @__PURE__ */ u("div", {
|
|
2560
|
-
className: `${
|
|
2710
|
+
className: `${W.chest} ${c ? W.open : ""}`,
|
|
2561
2711
|
children: [/* @__PURE__ */ u("div", {
|
|
2562
|
-
className:
|
|
2563
|
-
children: [/* @__PURE__ */ l("div", { className:
|
|
2712
|
+
className: W.lid,
|
|
2713
|
+
children: [/* @__PURE__ */ l("div", { className: W.lidTop }), /* @__PURE__ */ l("div", { className: W.lock })]
|
|
2564
2714
|
}), /* @__PURE__ */ l("div", {
|
|
2565
|
-
className:
|
|
2715
|
+
className: W.body,
|
|
2566
2716
|
children: c && /* @__PURE__ */ u("div", {
|
|
2567
|
-
className:
|
|
2717
|
+
className: W.treasure,
|
|
2568
2718
|
children: [
|
|
2569
2719
|
/* @__PURE__ */ l("span", { children: "💎" }),
|
|
2570
2720
|
/* @__PURE__ */ l("span", { children: "✨" }),
|
|
@@ -2574,15 +2724,15 @@ var L = {
|
|
|
2574
2724
|
})]
|
|
2575
2725
|
}),
|
|
2576
2726
|
/* @__PURE__ */ l("p", {
|
|
2577
|
-
className:
|
|
2727
|
+
className: W.label,
|
|
2578
2728
|
children: c ? "宝箱已开启!" : r
|
|
2579
2729
|
})
|
|
2580
2730
|
]
|
|
2581
2731
|
});
|
|
2582
|
-
},
|
|
2732
|
+
}, Mt = {
|
|
2583
2733
|
radarScan: "cos-radarScan-PZaG8",
|
|
2584
2734
|
canvas: "cos-canvas-fUw5N"
|
|
2585
|
-
},
|
|
2735
|
+
}, Nt = ({ size: e = 300, color: t = "#22d3ee", blipCount: r = 5 }) => {
|
|
2586
2736
|
let i = o(null), a = o(0), s = o([]), c = o(0);
|
|
2587
2737
|
return n(() => {
|
|
2588
2738
|
s.current = Array.from({ length: r }, () => ({
|
|
@@ -2619,27 +2769,27 @@ var L = {
|
|
|
2619
2769
|
t,
|
|
2620
2770
|
e
|
|
2621
2771
|
]), /* @__PURE__ */ l("div", {
|
|
2622
|
-
className:
|
|
2772
|
+
className: Mt.radarScan,
|
|
2623
2773
|
style: {
|
|
2624
2774
|
width: e,
|
|
2625
2775
|
height: e
|
|
2626
2776
|
},
|
|
2627
2777
|
children: /* @__PURE__ */ l("canvas", {
|
|
2628
2778
|
ref: i,
|
|
2629
|
-
className:
|
|
2779
|
+
className: Mt.canvas,
|
|
2630
2780
|
style: {
|
|
2631
2781
|
width: e,
|
|
2632
2782
|
height: e
|
|
2633
2783
|
}
|
|
2634
2784
|
})
|
|
2635
2785
|
});
|
|
2636
|
-
},
|
|
2786
|
+
}, G = {
|
|
2637
2787
|
redPacketRain: "cos-redPacketRain-eJ7FW",
|
|
2638
2788
|
canvas: "cos-canvas-direH",
|
|
2639
2789
|
hud: "cos-hud-InqMq",
|
|
2640
2790
|
end: "cos-end-u0J7o",
|
|
2641
2791
|
hint: "cos-hint-sO6ld"
|
|
2642
|
-
},
|
|
2792
|
+
}, Pt = ({ duration: e = 1e4, onGrab: r }) => {
|
|
2643
2793
|
let i = o(null), a = o([]), c = o(0), d = o(0), f = o(0), [p, m] = s(0), [h, g] = s(!0), _ = o(!0), y = o(r);
|
|
2644
2794
|
n(() => {
|
|
2645
2795
|
y.current = r;
|
|
@@ -2685,11 +2835,11 @@ var L = {
|
|
|
2685
2835
|
cancelAnimationFrame(c.current), clearTimeout(l), s();
|
|
2686
2836
|
};
|
|
2687
2837
|
}, [e, b]), /* @__PURE__ */ u("div", {
|
|
2688
|
-
className:
|
|
2838
|
+
className: G.redPacketRain,
|
|
2689
2839
|
children: [
|
|
2690
2840
|
/* @__PURE__ */ l("canvas", {
|
|
2691
2841
|
ref: i,
|
|
2692
|
-
className:
|
|
2842
|
+
className: G.canvas,
|
|
2693
2843
|
style: {
|
|
2694
2844
|
width: 400,
|
|
2695
2845
|
height: 500
|
|
@@ -2703,25 +2853,25 @@ var L = {
|
|
|
2703
2853
|
}
|
|
2704
2854
|
}),
|
|
2705
2855
|
/* @__PURE__ */ u("div", {
|
|
2706
|
-
className:
|
|
2856
|
+
className: G.hud,
|
|
2707
2857
|
children: [/* @__PURE__ */ u("span", { children: ["已抢: ¥", p] }), !h && /* @__PURE__ */ l("span", {
|
|
2708
|
-
className:
|
|
2858
|
+
className: G.end,
|
|
2709
2859
|
children: "红包雨结束"
|
|
2710
2860
|
})]
|
|
2711
2861
|
}),
|
|
2712
2862
|
/* @__PURE__ */ l("p", {
|
|
2713
|
-
className:
|
|
2863
|
+
className: G.hint,
|
|
2714
2864
|
children: "点击红包抢夺"
|
|
2715
2865
|
})
|
|
2716
2866
|
]
|
|
2717
2867
|
});
|
|
2718
|
-
},
|
|
2868
|
+
}, Ft = {
|
|
2719
2869
|
returnCityContainer: "cos-returnCityContainer-6XTxj",
|
|
2720
2870
|
star: "cos-star-a59Dx",
|
|
2721
2871
|
glassWrap: "cos-glassWrap-golMO",
|
|
2722
2872
|
rotate: "cos-rotate-7X9Jj",
|
|
2723
2873
|
glassItem: "cos-glassItem-OwlFI"
|
|
2724
|
-
},
|
|
2874
|
+
}, It = ({ starCount: e, glassCount: t = 8, glassRadius: r = 150 }) => {
|
|
2725
2875
|
let i = o(null), a = o(null);
|
|
2726
2876
|
return n(() => {
|
|
2727
2877
|
let n = i.current, o = a.current;
|
|
@@ -2730,13 +2880,13 @@ var L = {
|
|
|
2730
2880
|
for (let e = 0; e < f; e++) {
|
|
2731
2881
|
let e = window.setTimeout(() => {
|
|
2732
2882
|
let e = document.createElement("div");
|
|
2733
|
-
e.className =
|
|
2883
|
+
e.className = Ft.star, e.style.top = `${Math.random() * d}px`, e.style.left = `${Math.random() * u}px`, n.append(e), c.push(e);
|
|
2734
2884
|
}, Math.random() * 2e3);
|
|
2735
2885
|
s.push(e);
|
|
2736
2886
|
}
|
|
2737
2887
|
for (let e = 0; e < t; e++) {
|
|
2738
2888
|
let n = document.createElement("div");
|
|
2739
|
-
n.className =
|
|
2889
|
+
n.className = Ft.glassItem, n.style.transform = `rotateY(${360 / t * e}deg) translateZ(${r}px)`, o.appendChild(n), l.push(n);
|
|
2740
2890
|
let i = window.setTimeout(() => {
|
|
2741
2891
|
n.style.top = "0px", n.style.opacity = "1";
|
|
2742
2892
|
}, e * 300);
|
|
@@ -2751,16 +2901,16 @@ var L = {
|
|
|
2751
2901
|
r
|
|
2752
2902
|
]), /* @__PURE__ */ l("div", {
|
|
2753
2903
|
ref: i,
|
|
2754
|
-
className:
|
|
2904
|
+
className: Ft.returnCityContainer,
|
|
2755
2905
|
children: /* @__PURE__ */ l("div", {
|
|
2756
2906
|
ref: a,
|
|
2757
|
-
className:
|
|
2907
|
+
className: Ft.glassWrap
|
|
2758
2908
|
})
|
|
2759
2909
|
});
|
|
2760
|
-
},
|
|
2910
|
+
}, Lt = {
|
|
2761
2911
|
ropeChain: "cos-ropeChain-gYaSK",
|
|
2762
2912
|
canvas: "cos-canvas-5i95N"
|
|
2763
|
-
},
|
|
2913
|
+
}, Rt = ({ width: e = 400, height: t = 400, segments: r = 16, color: i = "#38bdf8", gravity: a = .4 }) => {
|
|
2764
2914
|
let s = o(null), c = o([]), u = o({
|
|
2765
2915
|
active: !1,
|
|
2766
2916
|
index: -1
|
|
@@ -2845,14 +2995,14 @@ var L = {
|
|
|
2845
2995
|
r,
|
|
2846
2996
|
e
|
|
2847
2997
|
]), /* @__PURE__ */ l("div", {
|
|
2848
|
-
className:
|
|
2998
|
+
className: Lt.ropeChain,
|
|
2849
2999
|
style: {
|
|
2850
3000
|
width: e,
|
|
2851
3001
|
height: t
|
|
2852
3002
|
},
|
|
2853
3003
|
children: /* @__PURE__ */ l("canvas", {
|
|
2854
3004
|
ref: s,
|
|
2855
|
-
className:
|
|
3005
|
+
className: Lt.canvas,
|
|
2856
3006
|
style: {
|
|
2857
3007
|
width: e,
|
|
2858
3008
|
height: t
|
|
@@ -2875,7 +3025,7 @@ var L = {
|
|
|
2875
3025
|
x: e + n * Math.cos(i),
|
|
2876
3026
|
y: t + n * Math.sin(i)
|
|
2877
3027
|
};
|
|
2878
|
-
},
|
|
3028
|
+
}, zt = ({ value: e = 0, max: t = 100, label: n = "SPEED", color: r = "#f97316" }) => {
|
|
2879
3029
|
let i = -120 + y(t > 0 ? e / t : 0, 0, 1) * 240, o = a(() => {
|
|
2880
3030
|
let e = q(100, 100, 72, -120), t = q(100, 100, 72, 120);
|
|
2881
3031
|
return `M ${e.x} ${e.y} A 72 72 0 1 1 ${t.x} ${t.y}`;
|
|
@@ -2955,7 +3105,7 @@ var L = {
|
|
|
2955
3105
|
dot: "cos-dot-HJEVy",
|
|
2956
3106
|
pulse: "cos-pulse-N6FD1",
|
|
2957
3107
|
name: "cos-name-7zefJ"
|
|
2958
|
-
},
|
|
3108
|
+
}, Bt = ({ steps: e = [
|
|
2959
3109
|
"Start",
|
|
2960
3110
|
"Process",
|
|
2961
3111
|
"Review",
|
|
@@ -2991,11 +3141,11 @@ var L = {
|
|
|
2991
3141
|
]
|
|
2992
3142
|
})
|
|
2993
3143
|
});
|
|
2994
|
-
},
|
|
3144
|
+
}, Vt = {
|
|
2995
3145
|
rippleWater: "cos-rippleWater-wsinI",
|
|
2996
3146
|
canvas: "cos-canvas-XOdSF",
|
|
2997
3147
|
hint: "cos-hint-0JH5D"
|
|
2998
|
-
},
|
|
3148
|
+
}, Ht = "\nattribute vec2 a_pos;\nvarying vec2 v_uv;\nvoid main() {\n v_uv = a_pos * 0.5 + 0.5;\n gl_Position = vec4(a_pos, 0.0, 1.0);\n}\n", Ut = "\nprecision highp float;\n\nuniform float u_time;\nuniform vec2 u_res;\nuniform vec3 u_tint;\nuniform vec3 u_from;\nuniform vec3 u_to;\nuniform sampler2D u_height;\nuniform vec2 u_sim;\nuniform float u_waveAmp;\nuniform float u_waveSpeed;\nuniform float u_shimmer;\nuniform float u_reflection;\n\nvarying vec2 v_uv;\n\nfloat hash(vec2 p) {\n return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);\n}\n\nfloat ambientH(vec2 p, float t) {\n float h = 0.0;\n h += sin(p.x * 3.2 + t * 1.3) * cos(p.y * 2.4 - t * 0.9) * 0.45;\n h += sin(p.x * 6.8 - t * 1.7 + p.y * 1.1) * 0.22;\n h += sin(p.x * 12.0 + p.y * 9.0 + t * 2.4) * 0.08;\n h += sin(p.x * 1.4 + p.y * 1.8 + t * 0.55) * 0.35;\n return h;\n}\n\nfloat sampleHeight(vec2 uv) {\n float rip = texture2D(u_height, uv).r * 2.0 - 1.0;\n vec2 p = uv * vec2(u_res.x / u_res.y, 1.0) * 2.8;\n float amb = ambientH(p, u_time * u_waveSpeed) * 0.035 * u_waveAmp;\n return rip * 0.55 + amb;\n}\n\nvec3 calcNormal(vec2 uv) {\n vec2 e = vec2(1.5 / u_sim.x, 1.5 / u_sim.y);\n float hL = sampleHeight(uv - vec2(e.x, 0.0));\n float hR = sampleHeight(uv + vec2(e.x, 0.0));\n float hD = sampleHeight(uv - vec2(0.0, e.y));\n float hU = sampleHeight(uv + vec2(0.0, e.y));\n return normalize(vec3((hL - hR) * 14.0, (hD - hU) * 14.0, 1.0));\n}\n\nvoid main() {\n vec2 uv = v_uv;\n vec3 n = calcNormal(uv);\n float h = sampleHeight(uv);\n\n vec3 V = normalize(vec3(0.0, 0.25, 1.0));\n vec3 L = normalize(vec3(0.45, 0.75, 0.55));\n\n float ndotl = max(dot(n, L), 0.0);\n float fresnel = pow(1.0 - max(dot(n, V), 0.0), 3.2);\n\n float g = clamp((uv.x + (1.0 - uv.y)) * 0.5, 0.0, 1.0);\n vec3 water = mix(u_from, u_to, g);\n water = mix(water, u_from, clamp(h * 1.8 + ndotl * 0.12, 0.0, 0.28));\n water *= 0.92 + n.y * 0.1;\n\n vec3 sky = mix(u_from * 1.15, vec3(0.85, 0.92, 1.0), 0.45);\n vec3 reflectCol = mix(sky, vec3(0.9, 0.95, 1.0), pow(max(n.y, 0.0), 2.0));\n water = mix(water, reflectCol, fresnel * u_reflection);\n\n vec3 H = normalize(L + V);\n float spec = pow(max(dot(n, H), 0.0), 180.0);\n float glitter = pow(max(dot(n, H), 0.0), 48.0);\n float sparkThresh = step(0.992, glitter) * glitter;\n vec3 sparkle = u_tint * (spec * 1.8 + sparkThresh * 2.5) * u_shimmer\n + vec3(1.0) * sparkThresh * 0.8 * u_shimmer;\n\n float softSpec = pow(max(dot(n, H), 0.0), 16.0) * 0.22 * u_shimmer;\n water += u_tint * softSpec + sparkle;\n\n float crest = smoothstep(0.02, 0.12, abs(h)) * fresnel;\n water += mix(u_tint, vec3(1.0), 0.4) * crest * 0.35;\n\n float vig = smoothstep(1.15, 0.35, length((uv - 0.5) * vec2(1.1, 1.0)));\n water *= 0.88 + 0.12 * vig;\n water += (hash(uv * u_res + u_time) - 0.5) * 0.015;\n\n gl_FragColor = vec4(water, 1.0);\n}\n", Wt = (e) => {
|
|
2999
3149
|
let t = e.replace("#", ""), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t, r = Number.parseInt(n, 16);
|
|
3000
3150
|
return Number.isNaN(r) ? [
|
|
3001
3151
|
.22,
|
|
@@ -3006,16 +3156,29 @@ var L = {
|
|
|
3006
3156
|
(r >> 8 & 255) / 255,
|
|
3007
3157
|
(r & 255) / 255
|
|
3008
3158
|
];
|
|
3009
|
-
},
|
|
3159
|
+
}, Gt = (e, t, n) => {
|
|
3010
3160
|
let r = e.createShader(t);
|
|
3011
3161
|
return r ? (e.shaderSource(r, n), e.compileShader(r), e.getShaderParameter(r, e.COMPILE_STATUS) ? r : (e.deleteShader(r), null)) : null;
|
|
3012
|
-
},
|
|
3013
|
-
let r =
|
|
3162
|
+
}, Kt = (e, t, n) => {
|
|
3163
|
+
let r = Gt(e, e.VERTEX_SHADER, t), i = Gt(e, e.FRAGMENT_SHADER, n);
|
|
3014
3164
|
if (!r || !i) return null;
|
|
3015
3165
|
let a = e.createProgram();
|
|
3016
3166
|
return a ? (e.attachShader(a, r), e.attachShader(a, i), e.linkProgram(a), e.deleteShader(r), e.deleteShader(i), e.getProgramParameter(a, e.LINK_STATUS) ? a : (e.deleteProgram(a), null)) : null;
|
|
3017
|
-
}, Y = 192,
|
|
3018
|
-
|
|
3167
|
+
}, Y = 192, qt = (e) => ({
|
|
3168
|
+
from: Wt(e.fromColor),
|
|
3169
|
+
to: Wt(e.toColor),
|
|
3170
|
+
tint: Wt(e.color),
|
|
3171
|
+
waveAmplitude: e.waveAmplitude,
|
|
3172
|
+
waveSpeed: e.waveSpeed,
|
|
3173
|
+
shimmer: e.shimmer,
|
|
3174
|
+
reflection: e.reflection,
|
|
3175
|
+
rippleStrength: e.rippleStrength,
|
|
3176
|
+
rippleRadius: e.rippleRadius,
|
|
3177
|
+
damping: e.damping,
|
|
3178
|
+
spread: e.spread,
|
|
3179
|
+
interactive: e.interactive
|
|
3180
|
+
}), Jt = ({ width: e = 800, height: r = 500, fromColor: i = "#52ade3", toColor: a = "#013565", color: s = "#a8d8f5", waveAmplitude: c = 1, waveSpeed: d = 1, shimmer: f = 1, reflection: p = .38, rippleStrength: m = 1, rippleRadius: h = 6, damping: g = .985, spread: _ = .5, interactive: b = !0, showHint: x = !0, hint: S = "点击水面产生涟漪" }) => {
|
|
3181
|
+
let C = o(null), w = o(0), T = o(null), E = o(qt({
|
|
3019
3182
|
fromColor: i,
|
|
3020
3183
|
toColor: a,
|
|
3021
3184
|
color: s,
|
|
@@ -3028,9 +3191,9 @@ var L = {
|
|
|
3028
3191
|
damping: g,
|
|
3029
3192
|
spread: _,
|
|
3030
3193
|
interactive: b
|
|
3031
|
-
});
|
|
3194
|
+
}));
|
|
3032
3195
|
n(() => {
|
|
3033
|
-
E.current = {
|
|
3196
|
+
E.current = qt({
|
|
3034
3197
|
fromColor: i,
|
|
3035
3198
|
toColor: a,
|
|
3036
3199
|
color: s,
|
|
@@ -3043,7 +3206,7 @@ var L = {
|
|
|
3043
3206
|
damping: g,
|
|
3044
3207
|
spread: _,
|
|
3045
3208
|
interactive: b
|
|
3046
|
-
};
|
|
3209
|
+
});
|
|
3047
3210
|
}, [
|
|
3048
3211
|
i,
|
|
3049
3212
|
a,
|
|
@@ -3072,13 +3235,10 @@ var L = {
|
|
|
3072
3235
|
return n(() => {
|
|
3073
3236
|
let e = C.current;
|
|
3074
3237
|
if (!e) return;
|
|
3075
|
-
let t = (e) =>
|
|
3076
|
-
|
|
3077
|
-
t && D(t.clientX, t.clientY);
|
|
3078
|
-
};
|
|
3079
|
-
return e.addEventListener("click", t), e.addEventListener("touchstart", n, { passive: !0 }), () => {
|
|
3080
|
-
e.removeEventListener("click", t), e.removeEventListener("touchstart", n);
|
|
3238
|
+
let t = (e) => {
|
|
3239
|
+
e.pointerType === "mouse" && e.button !== 0 || D(e.clientX, e.clientY);
|
|
3081
3240
|
};
|
|
3241
|
+
return e.addEventListener("pointerdown", t), () => e.removeEventListener("pointerdown", t);
|
|
3082
3242
|
}, [D]), n(() => {
|
|
3083
3243
|
let t = C.current;
|
|
3084
3244
|
if (!t) return;
|
|
@@ -3092,7 +3252,7 @@ var L = {
|
|
|
3092
3252
|
premultipliedAlpha: !1
|
|
3093
3253
|
});
|
|
3094
3254
|
if (!i) return;
|
|
3095
|
-
let a =
|
|
3255
|
+
let a = Kt(i, Ht, Ut);
|
|
3096
3256
|
if (!a) return;
|
|
3097
3257
|
let o = i.createBuffer();
|
|
3098
3258
|
i.bindBuffer(i.ARRAY_BUFFER, o), i.bufferData(i.ARRAY_BUFFER, new Float32Array([
|
|
@@ -3134,52 +3294,58 @@ var L = {
|
|
|
3134
3294
|
let e = S;
|
|
3135
3295
|
S = D, D = O, O = e, O.fill(0);
|
|
3136
3296
|
}
|
|
3137
|
-
},
|
|
3138
|
-
P = e;
|
|
3139
|
-
}), te = performance.now();
|
|
3140
|
-
j();
|
|
3141
|
-
let F = (e) => {
|
|
3142
|
-
if (w.current = requestAnimationFrame(F), P) return;
|
|
3297
|
+
}, ee = (e) => {
|
|
3143
3298
|
let n = E.current;
|
|
3299
|
+
i.viewport(0, 0, t.width, t.height), i.useProgram(a), i.bindBuffer(i.ARRAY_BUFFER, o), i.enableVertexAttribArray(s), i.vertexAttribPointer(s, 2, i.FLOAT, !1, 0, 0), i.activeTexture(i.TEXTURE0), i.bindTexture(i.TEXTURE_2D, k), i.uniform1i(p, 0), i.uniform1f(c, e), i.uniform2f(l, t.width, t.height), i.uniform3f(u, n.tint[0], n.tint[1], n.tint[2]), i.uniform3f(d, n.from[0], n.from[1], n.from[2]), i.uniform3f(f, n.to[0], n.to[1], n.to[2]), i.uniform2f(m, Y, Y), i.uniform1f(h, y(n.waveAmplitude, 0, 2)), i.uniform1f(g, y(n.waveSpeed, 0, 3)), i.uniform1f(_, y(n.shimmer, 0, 2)), i.uniform1f(b, y(n.reflection, 0, 1)), i.drawArrays(i.TRIANGLE_STRIP, 0, 4);
|
|
3300
|
+
};
|
|
3301
|
+
if (j(), typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return ee(0), () => {
|
|
3302
|
+
i.deleteTexture(k), i.deleteBuffer(o), i.deleteProgram(a);
|
|
3303
|
+
};
|
|
3304
|
+
let P = document.hidden, te = v((e) => {
|
|
3305
|
+
P = e;
|
|
3306
|
+
}), F = performance.now(), ne = (e) => {
|
|
3307
|
+
if (w.current = requestAnimationFrame(ne), P) return;
|
|
3308
|
+
let t = E.current;
|
|
3144
3309
|
if (T.current) {
|
|
3145
|
-
let e = T.current,
|
|
3146
|
-
M(e.x, e.y,
|
|
3310
|
+
let e = T.current, n = y(e.strength, 0, 3), r = t.rippleRadius;
|
|
3311
|
+
M(e.x, e.y, n, r), M(e.x + .004, e.y - .003, n * .35, r), T.current = null;
|
|
3147
3312
|
}
|
|
3148
|
-
N(
|
|
3149
|
-
let r = kt(n.color), v = kt(n.fromColor), x = kt(n.toColor);
|
|
3150
|
-
i.viewport(0, 0, t.width, t.height), i.useProgram(a), i.bindBuffer(i.ARRAY_BUFFER, o), i.enableVertexAttribArray(s), i.vertexAttribPointer(s, 2, i.FLOAT, !1, 0, 0), i.activeTexture(i.TEXTURE0), i.bindTexture(i.TEXTURE_2D, k), i.uniform1i(p, 0), i.uniform1f(c, (e - te) / 1e3), i.uniform2f(l, t.width, t.height), i.uniform3f(u, r[0], r[1], r[2]), i.uniform3f(d, v[0], v[1], v[2]), i.uniform3f(f, x[0], x[1], x[2]), i.uniform2f(m, Y, Y), i.uniform1f(h, y(n.waveAmplitude, 0, 2)), i.uniform1f(g, y(n.waveSpeed, 0, 3)), i.uniform1f(_, y(n.shimmer, 0, 2)), i.uniform1f(b, y(n.reflection, 0, 1)), i.drawArrays(i.TRIANGLE_STRIP, 0, 4);
|
|
3313
|
+
N(t.damping, t.spread), j(), ee((e - F) / 1e3);
|
|
3151
3314
|
};
|
|
3152
|
-
return w.current = requestAnimationFrame(
|
|
3153
|
-
cancelAnimationFrame(w.current),
|
|
3315
|
+
return w.current = requestAnimationFrame(ne), () => {
|
|
3316
|
+
cancelAnimationFrame(w.current), te(), i.deleteTexture(k), i.deleteBuffer(o), i.deleteProgram(a);
|
|
3154
3317
|
};
|
|
3155
3318
|
}, [r, e]), /* @__PURE__ */ u("div", {
|
|
3156
|
-
className:
|
|
3319
|
+
className: Vt.rippleWater,
|
|
3157
3320
|
style: {
|
|
3158
3321
|
width: e,
|
|
3159
3322
|
height: r
|
|
3160
3323
|
},
|
|
3161
3324
|
children: [/* @__PURE__ */ l("canvas", {
|
|
3162
3325
|
ref: C,
|
|
3163
|
-
className:
|
|
3326
|
+
className: Vt.canvas,
|
|
3164
3327
|
style: {
|
|
3165
3328
|
width: e,
|
|
3166
3329
|
height: r,
|
|
3167
3330
|
cursor: b ? "pointer" : "default"
|
|
3168
|
-
}
|
|
3331
|
+
},
|
|
3332
|
+
role: "img",
|
|
3333
|
+
"aria-label": S || "涟漪水面"
|
|
3169
3334
|
}), x ? /* @__PURE__ */ l("span", {
|
|
3170
|
-
className:
|
|
3335
|
+
className: Vt.hint,
|
|
3336
|
+
"aria-hidden": !0,
|
|
3171
3337
|
children: S
|
|
3172
3338
|
}) : null]
|
|
3173
3339
|
});
|
|
3174
|
-
},
|
|
3340
|
+
}, Yt = {
|
|
3175
3341
|
scrambleText: "cos-scrambleText-hN4Wm",
|
|
3176
3342
|
text: "cos-text-frsHs",
|
|
3177
3343
|
cursor: "cos-cursor-3zQOy",
|
|
3178
3344
|
blink: "cos-blink-OcKXu"
|
|
3179
|
-
},
|
|
3345
|
+
}, Xt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*", Zt = ({ text: e = "DECRYPTED", duration: t = 2e3, charset: r = Xt }) => {
|
|
3180
3346
|
let [i, a] = s(""), c = o(0), d = o(0);
|
|
3181
3347
|
return n(() => {
|
|
3182
|
-
let n = r.length > 0 ? r :
|
|
3348
|
+
let n = r.length > 0 ? r : Xt, i = e;
|
|
3183
3349
|
d.current = performance.now();
|
|
3184
3350
|
let o = (e) => {
|
|
3185
3351
|
let r = e - d.current, s = Math.min(r / t, 1), l = Math.floor(s * i.length);
|
|
@@ -3191,18 +3357,18 @@ var L = {
|
|
|
3191
3357
|
t,
|
|
3192
3358
|
r
|
|
3193
3359
|
]), /* @__PURE__ */ l("div", {
|
|
3194
|
-
className:
|
|
3360
|
+
className: Yt.scrambleText,
|
|
3195
3361
|
children: /* @__PURE__ */ u("p", {
|
|
3196
|
-
className:
|
|
3197
|
-
children: [i, /* @__PURE__ */ l("span", { className:
|
|
3362
|
+
className: Yt.text,
|
|
3363
|
+
children: [i, /* @__PURE__ */ l("span", { className: Yt.cursor })]
|
|
3198
3364
|
})
|
|
3199
3365
|
});
|
|
3200
|
-
},
|
|
3366
|
+
}, Qt = {
|
|
3201
3367
|
scratchCard: "cos-scratchCard-McIEK",
|
|
3202
3368
|
prize: "cos-prize-X0z5V",
|
|
3203
3369
|
canvas: "cos-canvas-JqIlr",
|
|
3204
3370
|
hidden: "cos-hidden-Lsfbt"
|
|
3205
|
-
},
|
|
3371
|
+
}, $t = ({ coverColor: e = "#94a3b8", prize: r = "🎉 恭喜中奖!", onReveal: i, width: a = 300, height: c = 180 }) => {
|
|
3206
3372
|
let d = o(null), f = o(!1), p = o(!1), m = o(i), [h, g] = s(!1);
|
|
3207
3373
|
n(() => {
|
|
3208
3374
|
m.current = i;
|
|
@@ -3265,17 +3431,17 @@ var L = {
|
|
|
3265
3431
|
f.current = !1;
|
|
3266
3432
|
};
|
|
3267
3433
|
return /* @__PURE__ */ u("div", {
|
|
3268
|
-
className:
|
|
3434
|
+
className: Qt.scratchCard,
|
|
3269
3435
|
style: {
|
|
3270
3436
|
width: a,
|
|
3271
3437
|
height: c
|
|
3272
3438
|
},
|
|
3273
3439
|
children: [/* @__PURE__ */ l("div", {
|
|
3274
|
-
className:
|
|
3440
|
+
className: Qt.prize,
|
|
3275
3441
|
children: r
|
|
3276
3442
|
}), /* @__PURE__ */ l("canvas", {
|
|
3277
3443
|
ref: d,
|
|
3278
|
-
className: `${
|
|
3444
|
+
className: `${Qt.canvas} ${h ? Qt.hidden : ""}`,
|
|
3279
3445
|
style: {
|
|
3280
3446
|
width: a,
|
|
3281
3447
|
height: c
|
|
@@ -3298,14 +3464,14 @@ var L = {
|
|
|
3298
3464
|
mask: "cos-mask-jdrj3",
|
|
3299
3465
|
spinBtn: "cos-spinBtn-DvDE7",
|
|
3300
3466
|
result: "cos-result-dLN5b"
|
|
3301
|
-
},
|
|
3467
|
+
}, en = [
|
|
3302
3468
|
"🍒",
|
|
3303
3469
|
"🍋",
|
|
3304
3470
|
"🍊",
|
|
3305
3471
|
"🍇",
|
|
3306
3472
|
"⭐",
|
|
3307
3473
|
"7️⃣"
|
|
3308
|
-
],
|
|
3474
|
+
], tn = (e) => 1 - (1 - e) ** 3, nn = ({ symbols: e = en, onSpinEnd: r }) => {
|
|
3309
3475
|
let [i, a] = s(!1), [c, d] = s([
|
|
3310
3476
|
0,
|
|
3311
3477
|
0,
|
|
@@ -3365,7 +3531,7 @@ var L = {
|
|
|
3365
3531
|
if (d(r.map((e, t) => {
|
|
3366
3532
|
let r = i - l - s[t];
|
|
3367
3533
|
if (r < 0) return e;
|
|
3368
|
-
let a =
|
|
3534
|
+
let a = tn(Math.min(r / o, 1));
|
|
3369
3535
|
return e + (n[t] - e) * a;
|
|
3370
3536
|
})), !s.every((e) => i - l - e >= o)) m.current = requestAnimationFrame(f);
|
|
3371
3537
|
else if (!u.cancelled) {
|
|
@@ -3385,7 +3551,7 @@ var L = {
|
|
|
3385
3551
|
})
|
|
3386
3552
|
]
|
|
3387
3553
|
});
|
|
3388
|
-
},
|
|
3554
|
+
}, rn = {
|
|
3389
3555
|
splitReveal: "cos-splitReveal-6W8-6",
|
|
3390
3556
|
text: "cos-text-miTsj",
|
|
3391
3557
|
char: "cos-char-0gPJV",
|
|
@@ -3394,27 +3560,27 @@ var L = {
|
|
|
3394
3560
|
fromBottom: "cos-fromBottom-24D6g",
|
|
3395
3561
|
fromLeft: "cos-fromLeft-OMiPY",
|
|
3396
3562
|
fromRight: "cos-fromRight-EcMOR"
|
|
3397
|
-
},
|
|
3563
|
+
}, an = [
|
|
3398
3564
|
"fromTop",
|
|
3399
3565
|
"fromBottom",
|
|
3400
3566
|
"fromLeft",
|
|
3401
3567
|
"fromRight"
|
|
3402
|
-
],
|
|
3403
|
-
className:
|
|
3568
|
+
], on = ({ text: e = "REVEAL", delay: t = 80, color: n = "#f8fafc" }) => /* @__PURE__ */ l("div", {
|
|
3569
|
+
className: rn.splitReveal,
|
|
3404
3570
|
children: /* @__PURE__ */ l("h1", {
|
|
3405
|
-
className:
|
|
3571
|
+
className: rn.text,
|
|
3406
3572
|
style: { "--reveal-color": n },
|
|
3407
3573
|
children: e.split("").map((e, n) => /* @__PURE__ */ l("span", {
|
|
3408
|
-
className: `${
|
|
3574
|
+
className: `${rn.char} ${rn[an[n % an.length]]}`,
|
|
3409
3575
|
style: { animationDelay: `${n * t}ms` },
|
|
3410
3576
|
children: e === " " ? "\xA0" : e
|
|
3411
3577
|
}, `${e}-${n}`))
|
|
3412
3578
|
})
|
|
3413
|
-
}),
|
|
3579
|
+
}), sn = {
|
|
3414
3580
|
spotlight: "cos-spotlight-OddY1",
|
|
3415
3581
|
content: "cos-content-5I1Wy",
|
|
3416
3582
|
overlay: "cos-overlay-F6CJ5"
|
|
3417
|
-
},
|
|
3583
|
+
}, cn = ({ children: e, radius: n = 120, dimColor: r = "rgba(0, 0, 0, 0.85)" }) => {
|
|
3418
3584
|
let i = o(null), a = t((e) => {
|
|
3419
3585
|
let t = i.current;
|
|
3420
3586
|
if (!t) return;
|
|
@@ -3423,16 +3589,16 @@ var L = {
|
|
|
3423
3589
|
}, []);
|
|
3424
3590
|
return /* @__PURE__ */ u("div", {
|
|
3425
3591
|
ref: i,
|
|
3426
|
-
className:
|
|
3592
|
+
className: sn.spotlight,
|
|
3427
3593
|
style: {
|
|
3428
3594
|
"--spot-radius": `${n}px`,
|
|
3429
3595
|
"--dim-color": r
|
|
3430
3596
|
},
|
|
3431
3597
|
onMouseMove: a,
|
|
3432
3598
|
children: [/* @__PURE__ */ l("div", {
|
|
3433
|
-
className:
|
|
3599
|
+
className: sn.content,
|
|
3434
3600
|
children: e
|
|
3435
|
-
}), /* @__PURE__ */ l("div", { className:
|
|
3601
|
+
}), /* @__PURE__ */ l("div", { className: sn.overlay })]
|
|
3436
3602
|
});
|
|
3437
3603
|
}, Z = {
|
|
3438
3604
|
turntable: "cos-turntable-dkc32",
|
|
@@ -3442,7 +3608,7 @@ var L = {
|
|
|
3442
3608
|
spinBtn: "cos-spinBtn-l9JIC",
|
|
3443
3609
|
result: "cos-result-H8q2c",
|
|
3444
3610
|
"fade-in": "cos-fade-in-U9bUC"
|
|
3445
|
-
},
|
|
3611
|
+
}, ln = [
|
|
3446
3612
|
"#FF6B6B",
|
|
3447
3613
|
"#4ECDC4",
|
|
3448
3614
|
"#FFE66D",
|
|
@@ -3451,19 +3617,19 @@ var L = {
|
|
|
3451
3617
|
"#F472B6",
|
|
3452
3618
|
"#34D399",
|
|
3453
3619
|
"#FB923C"
|
|
3454
|
-
],
|
|
3620
|
+
], un = [
|
|
3455
3621
|
{ label: "一等奖" },
|
|
3456
3622
|
{ label: "二等奖" },
|
|
3457
3623
|
{ label: "三等奖" },
|
|
3458
3624
|
{ label: "谢谢参与" },
|
|
3459
3625
|
{ label: "优惠券" },
|
|
3460
3626
|
{ label: "再来一次" }
|
|
3461
|
-
],
|
|
3627
|
+
], dn = (e) => 1 - (1 - e) ** 3, fn = ({ prizes: e = un, size: r = 360, spinDuration: i = 4e3, spinRounds: a = 5, buttonText: c = "开始抽奖", onSpinEnd: d }) => {
|
|
3462
3628
|
let f = o(null), p = o(0), m = o(0), h = o(1), [g, _] = s(!1), [v, y] = s(null), b = o(d), x = o(null);
|
|
3463
3629
|
n(() => {
|
|
3464
3630
|
b.current = d;
|
|
3465
3631
|
}, [d]);
|
|
3466
|
-
let S = r + 48, C = (e, t) => t.color ??
|
|
3632
|
+
let S = r + 48, C = (e, t) => t.color ?? ln[e % ln.length], w = t((t) => {
|
|
3467
3633
|
let n = f.current;
|
|
3468
3634
|
if (!n) return;
|
|
3469
3635
|
let i = n.getContext("2d");
|
|
@@ -3529,7 +3695,7 @@ var L = {
|
|
|
3529
3695
|
x.current = l;
|
|
3530
3696
|
let u = (t) => {
|
|
3531
3697
|
if (l.cancelled) return;
|
|
3532
|
-
let n = t - c, r = Math.min(n / i, 1), a =
|
|
3698
|
+
let n = t - c, r = Math.min(n / i, 1), a = dn(r), d = s + (o - s) * a;
|
|
3533
3699
|
if (p.current = d, w(d), r < 1) m.current = requestAnimationFrame(u);
|
|
3534
3700
|
else if (!l.cancelled) {
|
|
3535
3701
|
let t = T(d), n = e[t];
|
|
@@ -3555,11 +3721,11 @@ var L = {
|
|
|
3555
3721
|
prompt: "cos-prompt-Y4hVD",
|
|
3556
3722
|
cursor: "cos-cursor-m8hGi",
|
|
3557
3723
|
blink: "cos-blink-XykM7"
|
|
3558
|
-
},
|
|
3724
|
+
}, pn = [
|
|
3559
3725
|
"Hello, cos-design!",
|
|
3560
3726
|
"欢迎来到组件库 ✨",
|
|
3561
3727
|
"Build something fun 🚀"
|
|
3562
|
-
],
|
|
3728
|
+
], mn = ({ texts: e, speed: t, deleteSpeed: r, pause: i }) => {
|
|
3563
3729
|
let [a, o] = s(""), [c, d] = s(0), [f, p] = s(!1);
|
|
3564
3730
|
return n(() => {
|
|
3565
3731
|
let n = e[c % e.length], s;
|
|
@@ -3607,9 +3773,9 @@ var L = {
|
|
|
3607
3773
|
})]
|
|
3608
3774
|
})
|
|
3609
3775
|
});
|
|
3610
|
-
},
|
|
3611
|
-
let i = e.length > 0 ? e :
|
|
3612
|
-
return /* @__PURE__ */ l(
|
|
3776
|
+
}, hn = ({ texts: e = pn, speed: t = 100, deleteSpeed: n = 50, pause: r = 2e3 }) => {
|
|
3777
|
+
let i = e.length > 0 ? e : pn;
|
|
3778
|
+
return /* @__PURE__ */ l(mn, {
|
|
3613
3779
|
texts: i,
|
|
3614
3780
|
speed: t,
|
|
3615
3781
|
deleteSpeed: n,
|
|
@@ -3621,7 +3787,7 @@ var L = {
|
|
|
3621
3787
|
label: "cos-label-9BHOU",
|
|
3622
3788
|
wave: "cos-wave-GycLU",
|
|
3623
3789
|
ripple: "cos-ripple-5ZFpr"
|
|
3624
|
-
},
|
|
3790
|
+
}, gn = ({ text: e = "点我试试", color: t = "#38bdf8", className: n, style: r, ...i }) => /* @__PURE__ */ l("div", {
|
|
3625
3791
|
className: $.waveButton,
|
|
3626
3792
|
children: /* @__PURE__ */ u("button", {
|
|
3627
3793
|
type: "button",
|
|
@@ -3640,7 +3806,7 @@ var L = {
|
|
|
3640
3806
|
})
|
|
3641
3807
|
]
|
|
3642
3808
|
})
|
|
3643
|
-
}),
|
|
3809
|
+
}), _n = 39, vn = {
|
|
3644
3810
|
0: "sunny",
|
|
3645
3811
|
1: "sunny",
|
|
3646
3812
|
2: "partlyCloudy",
|
|
@@ -3669,26 +3835,26 @@ var L = {
|
|
|
3669
3835
|
95: "thunderstorm",
|
|
3670
3836
|
96: "hail",
|
|
3671
3837
|
99: "hail"
|
|
3672
|
-
},
|
|
3673
|
-
let n =
|
|
3674
|
-
return (n === "sunny" || n === "partlyCloudy" || n === "overcast") && t >=
|
|
3675
|
-
},
|
|
3838
|
+
}, yn = (e, t = 0) => {
|
|
3839
|
+
let n = vn[e] ?? "overcast";
|
|
3840
|
+
return (n === "sunny" || n === "partlyCloudy" || n === "overcast") && t >= _n ? "gale" : n;
|
|
3841
|
+
}, bn = {
|
|
3676
3842
|
weather: null,
|
|
3677
3843
|
status: "idle",
|
|
3678
3844
|
error: null,
|
|
3679
3845
|
current: null
|
|
3680
|
-
},
|
|
3846
|
+
}, xn = {
|
|
3681
3847
|
weather: null,
|
|
3682
3848
|
status: "locating",
|
|
3683
3849
|
error: null,
|
|
3684
3850
|
current: null
|
|
3685
|
-
},
|
|
3851
|
+
}, Sn = {
|
|
3686
3852
|
weather: null,
|
|
3687
3853
|
status: "fetching",
|
|
3688
3854
|
error: null,
|
|
3689
3855
|
current: null
|
|
3690
|
-
},
|
|
3691
|
-
let r =
|
|
3856
|
+
}, Cn = (e) => e != null && Number.isFinite(e.latitude) && Number.isFinite(e.longitude), wn = (e = !0, t) => {
|
|
3857
|
+
let r = Cn(t), i = r ? t.latitude : null, a = r ? t.longitude : null, o = e ? r ? Sn : xn : bn, c = `${e}:${i},${a}`, [l, u] = s(o), [d, f] = s(c);
|
|
3692
3858
|
return d !== c && (f(c), u((t) => e && t.weather ? {
|
|
3693
3859
|
...o,
|
|
3694
3860
|
weather: t.weather,
|
|
@@ -3708,7 +3874,7 @@ var L = {
|
|
|
3708
3874
|
let c = Number(o?.current?.wind_speed_10m ?? 0);
|
|
3709
3875
|
if (t) return;
|
|
3710
3876
|
u({
|
|
3711
|
-
weather:
|
|
3877
|
+
weather: yn(s, c),
|
|
3712
3878
|
status: "success",
|
|
3713
3879
|
error: null,
|
|
3714
3880
|
current: {
|
|
@@ -3766,31 +3932,31 @@ var L = {
|
|
|
3766
3932
|
};
|
|
3767
3933
|
//#endregion
|
|
3768
3934
|
//#region src/components/weatherBackground/scene/draw-atmosphere.ts
|
|
3769
|
-
function
|
|
3935
|
+
function Tn(e) {
|
|
3770
3936
|
let t = e.activeWeather === "gale" ? 7 : 1;
|
|
3771
3937
|
for (let n of e.state.clouds) n.x += n.speed * t, n.x - 140 * n.scale > e.width && (n.x = -160 * n.scale), e.ctx.drawImage(n.sprite, n.x + n.ox, n.y + n.oy);
|
|
3772
3938
|
}
|
|
3773
|
-
function
|
|
3939
|
+
function En(e) {
|
|
3774
3940
|
let t = e.fogSprite;
|
|
3775
3941
|
if (!t || e.state.fogBanks.length === 0) return;
|
|
3776
3942
|
let { canvas: n, baseR: r } = t;
|
|
3777
3943
|
for (let t of e.state.fogBanks) t.x += t.speed, t.speed > 0 && t.x - t.rw > e.width && (t.x = -t.rw), t.speed < 0 && t.x + t.rw < 0 && (t.x = e.width + t.rw), e.ctx.save(), e.ctx.translate(t.x, t.y), e.ctx.scale(t.rw / r, t.rh / r), e.ctx.globalAlpha = t.alpha, e.ctx.drawImage(n, -r, -r), e.ctx.restore();
|
|
3778
3944
|
}
|
|
3779
|
-
function
|
|
3945
|
+
function Dn(e) {
|
|
3780
3946
|
if (e.cfg.haze <= 0) return;
|
|
3781
3947
|
let t = e.activeWeather === "smog" ? "177, 164, 135" : "220, 226, 232";
|
|
3782
3948
|
e.activeNight && (t = e.activeWeather === "smog" ? "82, 74, 54" : "116, 128, 145"), e.ctx.fillStyle = `rgba(${t}, ${e.cfg.haze})`, e.ctx.fillRect(0, 0, e.width, e.height);
|
|
3783
3949
|
}
|
|
3784
3950
|
//#endregion
|
|
3785
3951
|
//#region src/components/weatherBackground/lightning.ts
|
|
3786
|
-
function
|
|
3952
|
+
function On(e, t, n, r, i, a) {
|
|
3787
3953
|
if (a <= 0) return [[e, t], [n, r]];
|
|
3788
|
-
let o = (e + n) / 2 + (Math.random() - .5) * i, s = (t + r) / 2, c =
|
|
3954
|
+
let o = (e + n) / 2 + (Math.random() - .5) * i, s = (t + r) / 2, c = On(e, t, o, s, i * .55, a - 1), l = On(o, s, n, r, i * .55, a - 1);
|
|
3789
3955
|
return [...c.slice(0, -1), ...l];
|
|
3790
3956
|
}
|
|
3791
3957
|
//#endregion
|
|
3792
3958
|
//#region src/components/weatherBackground/scene/draw-effects.ts
|
|
3793
|
-
function
|
|
3959
|
+
function kn(e) {
|
|
3794
3960
|
if (e.state.windStreaks.length !== 0) for (let t of e.state.windStreaks) {
|
|
3795
3961
|
t.x += t.speed, t.wave += .04, t.x - t.length > e.width && (t.x = -t.length - Math.random() * e.width * .3, t.y = Math.random() * e.height);
|
|
3796
3962
|
let n = Math.sin(t.wave) * 8, r = t.x + t.length;
|
|
@@ -3800,12 +3966,12 @@ function pn(e) {
|
|
|
3800
3966
|
}
|
|
3801
3967
|
}
|
|
3802
3968
|
}
|
|
3803
|
-
function
|
|
3969
|
+
function An(e) {
|
|
3804
3970
|
if (e.cfg.lightning) {
|
|
3805
3971
|
if (e.state.t >= e.state.nextStrike) {
|
|
3806
3972
|
e.state.nextStrike = e.state.t + 150 + Math.random() * 300, e.state.flashAlpha = .5, e.state.boltLife = 9;
|
|
3807
3973
|
let t = e.width * (.15 + Math.random() * .7);
|
|
3808
|
-
e.state.boltPoints =
|
|
3974
|
+
e.state.boltPoints = On(t, e.height * .12, t + (Math.random() - .5) * e.width * .2, e.height * .92, 60, 6);
|
|
3809
3975
|
}
|
|
3810
3976
|
if (e.state.boltLife > 0) {
|
|
3811
3977
|
--e.state.boltLife;
|
|
@@ -3817,7 +3983,7 @@ function mn(e) {
|
|
|
3817
3983
|
}
|
|
3818
3984
|
//#endregion
|
|
3819
3985
|
//#region src/components/weatherBackground/sprites/hail.ts
|
|
3820
|
-
var
|
|
3986
|
+
var jn = 3.2, Mn = (e) => {
|
|
3821
3987
|
let t = Math.ceil(e * 2.8 + 4), n = document.createElement("canvas");
|
|
3822
3988
|
n.width = t, n.height = t;
|
|
3823
3989
|
let r = n.getContext("2d"), i = t / 2, a = t / 2, o = 9 + Math.floor(Math.random() * 5), s = Array.from({ length: o }, (t, n) => {
|
|
@@ -3850,9 +4016,9 @@ var hn = 3.2, gn = (e) => {
|
|
|
3850
4016
|
r.beginPath(), r.arc(n, o, e * (.1 + Math.random() * .08), 0, Math.PI * 2), r.fillStyle = "rgba(255, 255, 255, 0.55)", r.fill();
|
|
3851
4017
|
}
|
|
3852
4018
|
return r.beginPath(), r.ellipse(i - e * .34, a - e * .36, e * .24, e * .17, -.35, 0, Math.PI * 2), r.fillStyle = "rgba(255, 255, 255, 0.78)", r.fill(), n;
|
|
3853
|
-
},
|
|
3854
|
-
e.r = 1.4 + Math.random() ** 1.35 * 3.4, e.x = Math.random() * (t + 260) - 130 + (Math.random() - .5) * 40, e.y = i ? -e.r - Math.random() * n * .55 : Math.random() * n, e.vx = -1.2 - Math.random() * 4.8 + (Math.random() - .5) * 1.2, e.vy = 5.5 + Math.random() * 11, e.bounces = 0, e.opacity = .45 + Math.random() * .55, e.delay = Math.floor(Math.random() * (i ? 110 : 45)), e.gravity = .11 + Math.random() * .14, e.phase = Math.random() * Math.PI * 2, e.gust = (Math.random() - .5) * 1.4, e.maxBounces = +(Math.random() < .62), e.sprite =
|
|
3855
|
-
},
|
|
4019
|
+
}, Nn = (e = 16) => Array.from({ length: e }, () => Mn(jn)), Pn = (e) => e[Math.floor(Math.random() * e.length)], Fn = (e, t, n, r, i = !0) => {
|
|
4020
|
+
e.r = 1.4 + Math.random() ** 1.35 * 3.4, e.x = Math.random() * (t + 260) - 130 + (Math.random() - .5) * 40, e.y = i ? -e.r - Math.random() * n * .55 : Math.random() * n, e.vx = -1.2 - Math.random() * 4.8 + (Math.random() - .5) * 1.2, e.vy = 5.5 + Math.random() * 11, e.bounces = 0, e.opacity = .45 + Math.random() * .55, e.delay = Math.floor(Math.random() * (i ? 110 : 45)), e.gravity = .11 + Math.random() * .14, e.phase = Math.random() * Math.PI * 2, e.gust = (Math.random() - .5) * 1.4, e.maxBounces = +(Math.random() < .62), e.sprite = Pn(r), e.drawSize = e.r * 2.8 + 4, e.rotation = Math.random() * Math.PI * 2, e.rotationSpeed = (Math.random() - .5) * .06;
|
|
4021
|
+
}, In = (e, t, n) => {
|
|
3856
4022
|
let r = {
|
|
3857
4023
|
x: 0,
|
|
3858
4024
|
y: 0,
|
|
@@ -3871,11 +4037,11 @@ var hn = 3.2, gn = (e) => {
|
|
|
3871
4037
|
rotation: 0,
|
|
3872
4038
|
rotationSpeed: 0
|
|
3873
4039
|
};
|
|
3874
|
-
return
|
|
4040
|
+
return Fn(r, e, t, n, Math.random() < .72), r;
|
|
3875
4041
|
};
|
|
3876
4042
|
//#endregion
|
|
3877
4043
|
//#region src/components/weatherBackground/scene/draw-precipitation.ts
|
|
3878
|
-
function
|
|
4044
|
+
function Ln(e) {
|
|
3879
4045
|
if (!e.cfg.rain) return;
|
|
3880
4046
|
let { wind: t, alpha: n, splash: r } = e.cfg.rain;
|
|
3881
4047
|
e.ctx.strokeStyle = `rgba(214, 228, 240, ${n})`, e.ctx.lineWidth = 1.2, e.ctx.beginPath();
|
|
@@ -3897,14 +4063,14 @@ function xn(e) {
|
|
|
3897
4063
|
e.ctx.beginPath(), e.ctx.ellipse(n.x, e.height - 3, n.r, n.r * .35, 0, Math.PI, Math.PI * 2), e.ctx.strokeStyle = `rgba(214, 228, 240, ${n.alpha})`, e.ctx.lineWidth = 1, e.ctx.stroke();
|
|
3898
4064
|
}
|
|
3899
4065
|
}
|
|
3900
|
-
function
|
|
4066
|
+
function Rn(e) {
|
|
3901
4067
|
for (let t of e.state.flakes) {
|
|
3902
4068
|
t.y += t.speed, t.x += Math.sin(e.state.t * .02 + t.phase) * (.3 + t.size * .08) + t.drift, t.rotation += t.rotationSpeed, t.y - t.drawSize > e.height && (t.y = -t.drawSize, t.x = Math.random() * e.width, t.phase = Math.random() * Math.PI * 2, t.drift = (Math.random() - .5) * .4, t.opacity = .55 + Math.random() * .45), t.x > e.width + 20 && (t.x = -20), t.x < -20 && (t.x = e.width + 20);
|
|
3903
4069
|
let n = t.drawSize / 2;
|
|
3904
4070
|
e.ctx.save(), e.ctx.globalAlpha = t.opacity, e.ctx.translate(t.x, t.y), e.ctx.rotate(t.rotation), e.ctx.drawImage(t.sprite, -n, -n, t.drawSize, t.drawSize), e.ctx.restore();
|
|
3905
4071
|
}
|
|
3906
4072
|
}
|
|
3907
|
-
function
|
|
4073
|
+
function zn(e) {
|
|
3908
4074
|
if (e.state.hailstones.length === 0) return;
|
|
3909
4075
|
let t = e.state.hailPool;
|
|
3910
4076
|
for (let n of e.state.hailstones) {
|
|
@@ -3915,7 +4081,7 @@ function Cn(e) {
|
|
|
3915
4081
|
let r = n.x, i = n.y;
|
|
3916
4082
|
if (n.vy += n.gravity, n.vx += n.gust * .004 + (Math.random() - .5) * .06, n.x += n.vx + Math.sin(e.state.t * .028 + n.phase) * .35, n.y += n.vy, e.ctx.beginPath(), e.ctx.moveTo(r, i), e.ctx.lineTo(n.x, n.y), e.ctx.strokeStyle = `rgba(225, 239, 250, ${n.opacity * .18})`, e.ctx.lineWidth = n.r * .35, e.ctx.stroke(), n.y + n.r >= e.height) if (n.bounces < n.maxBounces) n.y = e.height - n.r, n.vy *= -(.22 + Math.random() * .28), n.vx = n.vx * (.55 + Math.random() * .25) + (Math.random() - .5) * 1.6, n.bounces += 1;
|
|
3917
4083
|
else {
|
|
3918
|
-
|
|
4084
|
+
Fn(n, e.width, e.height, t, !0);
|
|
3919
4085
|
continue;
|
|
3920
4086
|
}
|
|
3921
4087
|
let a = n.drawSize / 2;
|
|
@@ -3924,31 +4090,31 @@ function Cn(e) {
|
|
|
3924
4090
|
}
|
|
3925
4091
|
//#endregion
|
|
3926
4092
|
//#region src/components/weatherBackground/scene/draw-sky.ts
|
|
3927
|
-
function
|
|
4093
|
+
function Bn(e) {
|
|
3928
4094
|
e.ctx.fillStyle = e.skyGradient, e.ctx.fillRect(0, 0, e.width, e.height);
|
|
3929
4095
|
}
|
|
3930
|
-
function
|
|
4096
|
+
function Vn(e) {
|
|
3931
4097
|
if (e.state.stars.length !== 0) for (let t of e.state.stars) {
|
|
3932
4098
|
let n = .35 + (Math.sin(e.state.t * t.speed + t.phase) + 1) * .325;
|
|
3933
4099
|
e.ctx.beginPath(), e.ctx.arc(t.x, t.y, t.r, 0, Math.PI * 2), e.ctx.fillStyle = `rgba(226, 235, 255, ${n})`, e.ctx.fill();
|
|
3934
4100
|
}
|
|
3935
4101
|
}
|
|
3936
|
-
function
|
|
4102
|
+
function Hn(e) {
|
|
3937
4103
|
let t = e.celestial;
|
|
3938
4104
|
if (!t) return;
|
|
3939
4105
|
let { ctx: n, sunX: r, sunY: i, state: a } = e, o = 1 + Math.sin(a.t * t.breathSpeed) * t.breathAmp, s = t.half * o, c = s * 2;
|
|
3940
4106
|
n.drawImage(t.canvas, r - s, i - s, c, c);
|
|
3941
4107
|
}
|
|
3942
|
-
function
|
|
4108
|
+
function Un(e) {
|
|
3943
4109
|
if (e.activeNight) {
|
|
3944
|
-
|
|
4110
|
+
Vn(e), Hn(e);
|
|
3945
4111
|
return;
|
|
3946
4112
|
}
|
|
3947
|
-
|
|
4113
|
+
Hn(e);
|
|
3948
4114
|
}
|
|
3949
4115
|
//#endregion
|
|
3950
4116
|
//#region src/components/weatherBackground/configs.ts
|
|
3951
|
-
var
|
|
4117
|
+
var Wn = {
|
|
3952
4118
|
sunny: {
|
|
3953
4119
|
sky: ["#4a9fe0", "#c8e8fb"],
|
|
3954
4120
|
sun: "full",
|
|
@@ -4258,8 +4424,8 @@ var On = {
|
|
|
4258
4424
|
lightning: !1
|
|
4259
4425
|
}
|
|
4260
4426
|
};
|
|
4261
|
-
|
|
4262
|
-
var
|
|
4427
|
+
Wn.snow = Wn.moderateSnow;
|
|
4428
|
+
var Gn = {
|
|
4263
4429
|
sunny: {
|
|
4264
4430
|
sky: ["#0b1a33", "#27476e"],
|
|
4265
4431
|
stars: 110
|
|
@@ -4325,15 +4491,15 @@ var kn = {
|
|
|
4325
4491
|
stars: 8
|
|
4326
4492
|
}
|
|
4327
4493
|
};
|
|
4328
|
-
|
|
4329
|
-
var
|
|
4494
|
+
Gn.snow = Gn.moderateSnow;
|
|
4495
|
+
var Kn = ([e, t, n]) => [
|
|
4330
4496
|
Math.round(e * .3 + 18),
|
|
4331
4497
|
Math.round(t * .3 + 24),
|
|
4332
4498
|
Math.round(n * .3 + 42)
|
|
4333
4499
|
];
|
|
4334
4500
|
//#endregion
|
|
4335
4501
|
//#region src/components/weatherBackground/sprites/cloud.ts
|
|
4336
|
-
function
|
|
4502
|
+
function qn(e, t, n, r) {
|
|
4337
4503
|
let [i, a, o] = n, s = Infinity, c = Infinity, l = -Infinity, u = -Infinity;
|
|
4338
4504
|
for (let n of t) {
|
|
4339
4505
|
let t = n.dx * e, r = n.dy * e, i = n.r * e;
|
|
@@ -4352,12 +4518,12 @@ function jn(e, t, n, r) {
|
|
|
4352
4518
|
oy: f
|
|
4353
4519
|
};
|
|
4354
4520
|
}
|
|
4355
|
-
function
|
|
4521
|
+
function Jn(e, t, n, r, i) {
|
|
4356
4522
|
let a = .7 + Math.random() * .9, o = 4 + Math.floor(Math.random() * 3), s = Array.from({ length: o }, (e, t) => ({
|
|
4357
4523
|
dx: (t - o / 2) * 26 + (Math.random() - .5) * 14,
|
|
4358
4524
|
dy: (Math.random() - .5) * 14,
|
|
4359
4525
|
r: 22 + Math.random() * 20
|
|
4360
|
-
})), { sprite: c, ox: l, oy: u } =
|
|
4526
|
+
})), { sprite: c, ox: l, oy: u } = qn(a, s, r, i);
|
|
4361
4527
|
return {
|
|
4362
4528
|
x: Math.random() * (e + 240) - 120,
|
|
4363
4529
|
y: t * .06 + Math.random() * t * n,
|
|
@@ -4369,7 +4535,7 @@ function Mn(e, t, n, r, i) {
|
|
|
4369
4535
|
oy: u
|
|
4370
4536
|
};
|
|
4371
4537
|
}
|
|
4372
|
-
function
|
|
4538
|
+
function Yn(e, t = 120) {
|
|
4373
4539
|
let n = t * 2, r = document.createElement("canvas");
|
|
4374
4540
|
r.width = n, r.height = n;
|
|
4375
4541
|
let i = r.getContext("2d"), a = i.createRadialGradient(t, t, 0, t, t, t);
|
|
@@ -4380,7 +4546,7 @@ function Nn(e, t = 120) {
|
|
|
4380
4546
|
}
|
|
4381
4547
|
//#endregion
|
|
4382
4548
|
//#region src/components/weatherBackground/sprites/celestial.ts
|
|
4383
|
-
function
|
|
4549
|
+
function Xn(e, t) {
|
|
4384
4550
|
let n = e.sun;
|
|
4385
4551
|
if (n === "none") return null;
|
|
4386
4552
|
let r = n === "full" ? 1 : n === "soft" ? .62 : .32, i = t * (n === "full" ? .72 : n === "soft" ? .62 : .5), a = t * (n === "full" ? 7.2 : n === "soft" ? 5.2 : 3.6), o = a;
|
|
@@ -4408,7 +4574,7 @@ function Pn(e, t) {
|
|
|
4408
4574
|
breathAmp: .018
|
|
4409
4575
|
};
|
|
4410
4576
|
}
|
|
4411
|
-
function
|
|
4577
|
+
function Zn(e, t, n) {
|
|
4412
4578
|
if (e.sun === "none") return null;
|
|
4413
4579
|
let r = t * .82, i = e.sun === "dim", a = i ? .45 : 1, o = r * (i ? 4.2 : 6.2), s = Math.ceil(Math.max(o, r * 2.6, r * 1.35) + 2), c = s * 2, l = document.createElement("canvas");
|
|
4414
4580
|
l.width = c, l.height = c;
|
|
@@ -4462,12 +4628,12 @@ function Fn(e, t, n) {
|
|
|
4462
4628
|
}
|
|
4463
4629
|
//#endregion
|
|
4464
4630
|
//#region src/components/weatherBackground/sprites/snow.ts
|
|
4465
|
-
var
|
|
4631
|
+
var Qn = (e) => {
|
|
4466
4632
|
let t = Math.ceil(e * 2 + 4), n = document.createElement("canvas");
|
|
4467
4633
|
n.width = t, n.height = t;
|
|
4468
4634
|
let r = n.getContext("2d"), i = r.createRadialGradient(t / 2, t / 2, 0, t / 2, t / 2, e + 1);
|
|
4469
4635
|
return i.addColorStop(0, "rgba(255, 255, 255, 1)"), i.addColorStop(.6, "rgba(255, 255, 255, 0.85)"), i.addColorStop(1, "rgba(255, 255, 255, 0)"), r.fillStyle = i, r.fillRect(0, 0, t, t), n;
|
|
4470
|
-
},
|
|
4636
|
+
}, $n = (e) => {
|
|
4471
4637
|
let t = Math.ceil(e * 2 + 6), n = document.createElement("canvas");
|
|
4472
4638
|
n.width = t, n.height = t;
|
|
4473
4639
|
let r = n.getContext("2d");
|
|
@@ -4494,22 +4660,22 @@ var In = (e) => {
|
|
|
4494
4660
|
r.closePath(), r.stroke();
|
|
4495
4661
|
}
|
|
4496
4662
|
return n;
|
|
4497
|
-
},
|
|
4663
|
+
}, er = () => ({
|
|
4498
4664
|
dots: [
|
|
4499
4665
|
1.2,
|
|
4500
4666
|
1.6,
|
|
4501
4667
|
2,
|
|
4502
4668
|
2.3
|
|
4503
|
-
].map((e) =>
|
|
4669
|
+
].map((e) => Qn(e)),
|
|
4504
4670
|
crystals: [
|
|
4505
4671
|
2.6,
|
|
4506
4672
|
3.2,
|
|
4507
4673
|
3.8,
|
|
4508
4674
|
4.4,
|
|
4509
4675
|
5
|
|
4510
|
-
].map((e) =>
|
|
4511
|
-
}),
|
|
4512
|
-
let i = 1 + Math.random() ** 1.6 * 4.2, a = i >= 2.4, o =
|
|
4676
|
+
].map((e) => $n(e * 2.4))
|
|
4677
|
+
}), tr = (e) => e[Math.floor(Math.random() * e.length)], nr = (e, t, n, r) => {
|
|
4678
|
+
let i = 1 + Math.random() ** 1.6 * 4.2, a = i >= 2.4, o = tr(a ? n.crystals : n.dots), s = a ? i * 4.8 + 6 : i * 2 + 4;
|
|
4513
4679
|
return {
|
|
4514
4680
|
x: Math.random() * e,
|
|
4515
4681
|
y: r ?? Math.random() * t,
|
|
@@ -4523,9 +4689,9 @@ var In = (e) => {
|
|
|
4523
4689
|
sprite: o,
|
|
4524
4690
|
drawSize: s
|
|
4525
4691
|
};
|
|
4526
|
-
},
|
|
4527
|
-
function
|
|
4528
|
-
let { ctx: t, width: n, height: r, activeWeather: i, activeNight: a } = e, o =
|
|
4692
|
+
}, rr = (e, t) => t ? e === "smog" ? "96, 88, 66" : "138, 150, 168" : e === "smog" ? "168, 155, 126" : "226, 232, 238";
|
|
4693
|
+
function ir(e) {
|
|
4694
|
+
let { ctx: t, width: n, height: r, activeWeather: i, activeNight: a } = e, o = Wn[i], s = Gn[i], c = a ? s.sky : o.sky, l = a ? Kn(o.cloudColor) : o.cloudColor, u = n * .72, d = r * .26, f = Math.min(n, r) * .09, p = t.createLinearGradient(0, 0, 0, r);
|
|
4529
4695
|
p.addColorStop(0, c[0]), p.addColorStop(1, c[1]);
|
|
4530
4696
|
let m = a ? Array.from({ length: s.stars }, () => ({
|
|
4531
4697
|
x: Math.random() * n,
|
|
@@ -4554,7 +4720,7 @@ function Hn(e) {
|
|
|
4554
4720
|
dy: .24,
|
|
4555
4721
|
r: .07
|
|
4556
4722
|
}
|
|
4557
|
-
], g = a ?
|
|
4723
|
+
], g = a ? Zn(o, f, h) : Xn(o, f), _ = Array.from({ length: o.cloudCount }, () => Jn(n, r, o.cloudSpread, l, o.cloudAlpha)), v = o.rain ? Array.from({ length: o.rain.count }, () => ({
|
|
4558
4724
|
x: Math.random() * (n + 160) - 80,
|
|
4559
4725
|
y: Math.random() * r,
|
|
4560
4726
|
len: 8 + Math.random() * 10,
|
|
@@ -4566,7 +4732,7 @@ function Hn(e) {
|
|
|
4566
4732
|
rh: r * (.08 + Math.random() * .08),
|
|
4567
4733
|
speed: (.1 + Math.random() * .25) * (t % 2 == 0 ? 1 : -1),
|
|
4568
4734
|
alpha: .16 + Math.random() * .14
|
|
4569
|
-
})), x = o.fogBanks > 0 ?
|
|
4735
|
+
})), x = o.fogBanks > 0 ? Yn(rr(i, a)) : null, S = o.snowCount > 0 ? er() : null, C = S == null ? [] : Array.from({ length: o.snowCount }, () => nr(n, r, S)), w = i === "hail" ? Nn() : null, T = w == null ? [] : Array.from({ length: 145 }, () => In(n, r, w)), E = i === "gale" ? Array.from({ length: 46 }, () => ({
|
|
4570
4736
|
x: Math.random() * n,
|
|
4571
4737
|
y: Math.random() * r,
|
|
4572
4738
|
length: 45 + Math.random() * 130,
|
|
@@ -4606,36 +4772,36 @@ function Hn(e) {
|
|
|
4606
4772
|
}
|
|
4607
4773
|
//#endregion
|
|
4608
4774
|
//#region src/components/weatherBackground/scene/create-weather-scene.ts
|
|
4609
|
-
function
|
|
4610
|
-
t && (e.state.t += 1),
|
|
4775
|
+
function ar(e, t) {
|
|
4776
|
+
t && (e.state.t += 1), Bn(e), Un(e), Tn(e), En(e), Dn(e), Ln(e), Rn(e), zn(e), kn(e), An(e);
|
|
4611
4777
|
}
|
|
4612
|
-
function
|
|
4778
|
+
function or(e) {
|
|
4613
4779
|
let { ctx: t, width: n, height: r, activeWeather: i, activeNight: a } = e, o = {
|
|
4614
4780
|
ctx: t,
|
|
4615
4781
|
width: n,
|
|
4616
4782
|
height: r,
|
|
4617
4783
|
activeWeather: i,
|
|
4618
4784
|
activeNight: a,
|
|
4619
|
-
...
|
|
4785
|
+
...ir(e)
|
|
4620
4786
|
};
|
|
4621
|
-
if (typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return
|
|
4787
|
+
if (typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return ar(o, !1), () => void 0;
|
|
4622
4788
|
let s = 0, c = document.hidden, l = v((e) => {
|
|
4623
4789
|
c = e;
|
|
4624
4790
|
}), u = () => {
|
|
4625
|
-
s = requestAnimationFrame(u), !c &&
|
|
4791
|
+
s = requestAnimationFrame(u), !c && ar(o, !0);
|
|
4626
4792
|
};
|
|
4627
4793
|
return u(), () => {
|
|
4628
4794
|
cancelAnimationFrame(s), l();
|
|
4629
4795
|
};
|
|
4630
4796
|
}
|
|
4631
|
-
var
|
|
4797
|
+
var sr = {
|
|
4632
4798
|
weatherBackground: "cos-weatherBackground-Mnm22",
|
|
4633
4799
|
canvas: "cos-canvas-nvqMt",
|
|
4634
4800
|
loadingOverlay: "cos-loadingOverlay-O58B7",
|
|
4635
4801
|
loadingSpinner: "cos-loadingSpinner-NQ9yG",
|
|
4636
4802
|
"weather-loading-spin": "cos-weather-loading-spin-IPFWZ"
|
|
4637
|
-
},
|
|
4638
|
-
let p = o(null), m =
|
|
4803
|
+
}, cr = ({ width: e = 800, height: t = 450, weather: r = "sunny", night: i = !1, live: a = !1, latitude: s, longitude: c, onLiveWeather: d, loading: f = !1 }) => {
|
|
4804
|
+
let p = o(null), m = wn(a, s != null && c != null ? {
|
|
4639
4805
|
latitude: s,
|
|
4640
4806
|
longitude: c
|
|
4641
4807
|
} : void 0), h = a && m.weather ? m.weather : r, g = a && m.current ? !m.current.isDay : i, _ = f || a && (m.status === "locating" || m.status === "fetching"), v = o(d);
|
|
@@ -4649,7 +4815,7 @@ var Gn = {
|
|
|
4649
4815
|
let r = window.devicePixelRatio || 1;
|
|
4650
4816
|
n.width = e * r, n.height = t * r;
|
|
4651
4817
|
let i = n.getContext("2d");
|
|
4652
|
-
if (i) return i.setTransform(r, 0, 0, r, 0, 0),
|
|
4818
|
+
if (i) return i.setTransform(r, 0, 0, r, 0, 0), or({
|
|
4653
4819
|
ctx: i,
|
|
4654
4820
|
width: e,
|
|
4655
4821
|
height: t,
|
|
@@ -4662,14 +4828,14 @@ var Gn = {
|
|
|
4662
4828
|
t,
|
|
4663
4829
|
e
|
|
4664
4830
|
]), /* @__PURE__ */ u("div", {
|
|
4665
|
-
className:
|
|
4831
|
+
className: sr.weatherBackground,
|
|
4666
4832
|
style: {
|
|
4667
4833
|
width: e,
|
|
4668
4834
|
height: t
|
|
4669
4835
|
},
|
|
4670
4836
|
children: [/* @__PURE__ */ l("canvas", {
|
|
4671
4837
|
ref: p,
|
|
4672
|
-
className:
|
|
4838
|
+
className: sr.canvas,
|
|
4673
4839
|
style: {
|
|
4674
4840
|
width: e,
|
|
4675
4841
|
height: t
|
|
@@ -4677,35 +4843,35 @@ var Gn = {
|
|
|
4677
4843
|
role: "img",
|
|
4678
4844
|
"aria-label": `天气背景:${h}${g ? "(夜间)" : ""}`
|
|
4679
4845
|
}), _ && /* @__PURE__ */ u("div", {
|
|
4680
|
-
className:
|
|
4846
|
+
className: sr.loadingOverlay,
|
|
4681
4847
|
role: "status",
|
|
4682
4848
|
"aria-live": "polite",
|
|
4683
4849
|
children: [/* @__PURE__ */ l("div", {
|
|
4684
|
-
className:
|
|
4850
|
+
className: sr.loadingSpinner,
|
|
4685
4851
|
"aria-hidden": !0
|
|
4686
4852
|
}), /* @__PURE__ */ l("span", { children: "天气加载中…" })]
|
|
4687
4853
|
})]
|
|
4688
4854
|
});
|
|
4689
|
-
},
|
|
4855
|
+
}, lr = {
|
|
4690
4856
|
waveText: "cos-waveText-Zy2Tp",
|
|
4691
4857
|
text: "cos-text-el-KR",
|
|
4692
4858
|
char: "cos-char-Y9-mV",
|
|
4693
4859
|
wave: "cos-wave-jVRCz"
|
|
4694
|
-
},
|
|
4695
|
-
className:
|
|
4860
|
+
}, ur = ({ text: e = "WAVE", amplitude: t = 12, color: n = "#38bdf8", fontSize: r = 56 }) => /* @__PURE__ */ l("div", {
|
|
4861
|
+
className: lr.waveText,
|
|
4696
4862
|
children: /* @__PURE__ */ l("h1", {
|
|
4697
|
-
className:
|
|
4863
|
+
className: lr.text,
|
|
4698
4864
|
style: {
|
|
4699
4865
|
fontSize: r,
|
|
4700
4866
|
"--wave-color": n,
|
|
4701
4867
|
"--wave-amp": `${t}px`
|
|
4702
4868
|
},
|
|
4703
4869
|
children: e.split("").map((e, t) => /* @__PURE__ */ l("span", {
|
|
4704
|
-
className:
|
|
4870
|
+
className: lr.char,
|
|
4705
4871
|
style: { animationDelay: `${t * .1}s` },
|
|
4706
4872
|
children: e === " " ? "\xA0" : e
|
|
4707
4873
|
}, `${e}-${t}`))
|
|
4708
4874
|
})
|
|
4709
4875
|
});
|
|
4710
4876
|
//#endregion
|
|
4711
|
-
export { x as AudioVisualizer, _ as Aurora, f as BarcodeScan, m as BurnAway, C as CanvasClock, D as Charge, k as ClickSpark,
|
|
4877
|
+
export { x as AudioVisualizer, _ as Aurora, f as BarcodeScan, m as BurnAway, C as CanvasClock, D as Charge, k as ClickSpark, ee as Confetti, ae as Countdown, fe as CursorTrail, te as CyberGrid, me as DiceRoll, se as DnaHelix, ge as DoublePendulum, ue as ElectricArc, Ce as Fireworks, Ee as FlipCounter, je as GlitchText, ke as GradientFlow, Pe as GravityBalls, Fe as HolographicCard, Be as LiquidGlass, Ie as LiquidProgress, Re as LorenzAttractor, He as MagneticButton, We as MatrixRain, Je as MazeGenerator, Ke as MetaballPool, Xe as MeteorRain, Qe as NeonText, et as NewtonCradle, rt as OrbitalChart, at as ParticleNetwork, st as PlasmaBall, jt as ProgressChest, Nt as RadarScan, Pt as RedPacketRain, It as ReturnCity, Jt as RippleWater, Rt as RopeChain, Zt as ScrambleText, $t as ScratchCard, nn as SlotMachine, Ct as SmokeFog, Ot as Snowfall, Et as SolarSystem, zt as Speedometer, on as SplitReveal, cn as Spotlight, At as Starfield, Bt as TimelinePulse, fn as Turntable, hn as Typewriter, gn as WaveButton, ur as WaveText, cr as WeatherBackground, yn as mapWmoCodeToWeatherType, wn as useLiveWeather };
|