cos-design 3.5.1 → 3.5.3
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 +18 -0
- package/README.md +5 -3
- package/dist/index.cjs +93 -1
- package/dist/index.css +1 -1
- package/dist/index.js +845 -415
- package/dist/src/components/rippleWater/index.d.ts +27 -1
- package/dist/src/components/smokeFog/index.d.ts +1 -1
- package/dist/src/components/weatherBackground/configs.d.ts +9 -0
- package/dist/src/components/weatherBackground/index.d.ts +2 -21
- package/dist/src/components/weatherBackground/lightning.d.ts +1 -0
- package/dist/src/components/weatherBackground/live-weather.d.ts +2 -2
- package/dist/src/components/weatherBackground/scene/create-weather-scene.d.ts +2 -0
- package/dist/src/components/weatherBackground/scene/draw-atmosphere.d.ts +4 -0
- package/dist/src/components/weatherBackground/scene/draw-effects.d.ts +3 -0
- package/dist/src/components/weatherBackground/scene/draw-precipitation.d.ts +4 -0
- package/dist/src/components/weatherBackground/scene/draw-sky.d.ts +4 -0
- package/dist/src/components/weatherBackground/scene/init-state.d.ts +15 -0
- package/dist/src/components/weatherBackground/scene/runtime.d.ts +21 -0
- package/dist/src/components/weatherBackground/sprites/celestial.d.ts +11 -0
- package/dist/src/components/weatherBackground/sprites/cloud.d.ts +20 -0
- package/dist/src/components/weatherBackground/sprites/hail.d.ts +5 -0
- package/dist/src/components/weatherBackground/sprites/snow.d.ts +8 -0
- package/dist/src/components/weatherBackground/types.d.ts +170 -0
- 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
|
+
}, P = 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,11 +486,11 @@ import './index.css';var d = {
|
|
|
486
486
|
})]
|
|
487
487
|
});
|
|
488
488
|
});
|
|
489
|
-
|
|
490
|
-
var
|
|
489
|
+
P.displayName = "Confetti";
|
|
490
|
+
var ee = {
|
|
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 }) => {
|
|
494
494
|
let a = o(null), s = o(0), c = o(0);
|
|
495
495
|
return n(() => {
|
|
496
496
|
let n = a.current;
|
|
@@ -532,21 +532,21 @@ var te = {
|
|
|
532
532
|
i,
|
|
533
533
|
e
|
|
534
534
|
]), /* @__PURE__ */ l("div", {
|
|
535
|
-
className:
|
|
535
|
+
className: ee.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: ee.canvas,
|
|
543
543
|
style: {
|
|
544
544
|
width: e,
|
|
545
545
|
height: t
|
|
546
546
|
}
|
|
547
547
|
})
|
|
548
548
|
});
|
|
549
|
-
},
|
|
549
|
+
}, F = {
|
|
550
550
|
countdown: "cos-countdown-5ZKKP",
|
|
551
551
|
unit: "cos-unit-dth8N",
|
|
552
552
|
value: "cos-value-yVzcP",
|
|
@@ -554,7 +554,7 @@ var te = {
|
|
|
554
554
|
ended: "cos-ended-c0dsD",
|
|
555
555
|
pulse: "cos-pulse-krQd-",
|
|
556
556
|
invalid: "cos-invalid-d6t-L"
|
|
557
|
-
},
|
|
557
|
+
}, ne = (e) => e instanceof Date ? e.getTime() : typeof e == "number" ? e : new Date(e).getTime(), re = (e) => {
|
|
558
558
|
let t = Math.max(0, e - Date.now()), n = Math.floor(t / 1e3);
|
|
559
559
|
return {
|
|
560
560
|
total: t,
|
|
@@ -563,7 +563,7 @@ var te = {
|
|
|
563
563
|
minutes: Math.floor(n % 3600 / 60),
|
|
564
564
|
seconds: n % 60
|
|
565
565
|
};
|
|
566
|
-
},
|
|
566
|
+
}, ie = [
|
|
567
567
|
{
|
|
568
568
|
key: "days",
|
|
569
569
|
label: "天"
|
|
@@ -580,8 +580,8 @@ var te = {
|
|
|
580
580
|
key: "seconds",
|
|
581
581
|
label: "秒"
|
|
582
582
|
}
|
|
583
|
-
],
|
|
584
|
-
let c = a(() =>
|
|
583
|
+
], ae = ({ targetDate: e, onEnd: t, showLabels: r = !0, color: i = "#f472b6" }) => {
|
|
584
|
+
let c = a(() => ne(e), [e]), d = !Number.isNaN(c), [, f] = s(0), p = o(!1), m = o(t), h = d ? re(c) : {
|
|
585
585
|
days: 0,
|
|
586
586
|
hours: 0,
|
|
587
587
|
minutes: 0,
|
|
@@ -601,32 +601,32 @@ var te = {
|
|
|
601
601
|
}, 1e3);
|
|
602
602
|
return () => clearInterval(e);
|
|
603
603
|
}, [d, c]), d ? /* @__PURE__ */ u("div", {
|
|
604
|
-
className:
|
|
604
|
+
className: F.countdown,
|
|
605
605
|
style: { "--countdown-color": i },
|
|
606
|
-
children: [
|
|
607
|
-
className:
|
|
606
|
+
children: [ie.map(({ key: e, label: t }) => /* @__PURE__ */ u("div", {
|
|
607
|
+
className: F.unit,
|
|
608
608
|
children: [/* @__PURE__ */ l("div", {
|
|
609
|
-
className:
|
|
609
|
+
className: F.value,
|
|
610
610
|
children: String(h[e]).padStart(2, "0")
|
|
611
611
|
}), r && /* @__PURE__ */ l("span", {
|
|
612
|
-
className:
|
|
612
|
+
className: F.label,
|
|
613
613
|
children: t
|
|
614
614
|
})]
|
|
615
615
|
}, e)), h.total <= 0 && /* @__PURE__ */ l("p", {
|
|
616
|
-
className:
|
|
616
|
+
className: F.ended,
|
|
617
617
|
children: "时间到!"
|
|
618
618
|
})]
|
|
619
619
|
}) : /* @__PURE__ */ l("div", {
|
|
620
|
-
className:
|
|
620
|
+
className: F.countdown,
|
|
621
621
|
children: /* @__PURE__ */ l("p", {
|
|
622
|
-
className:
|
|
622
|
+
className: F.invalid,
|
|
623
623
|
children: "无效的目标时间"
|
|
624
624
|
})
|
|
625
625
|
});
|
|
626
|
-
},
|
|
626
|
+
}, oe = {
|
|
627
627
|
dnaHelix: "cos-dnaHelix-nEQLW",
|
|
628
628
|
canvas: "cos-canvas-uEV8B"
|
|
629
|
-
},
|
|
629
|
+
}, se = ({ width: e = 200, height: t = 360, speed: r = 1, color: i = "#38bdf8" }) => {
|
|
630
630
|
let a = o(null);
|
|
631
631
|
return n(() => {
|
|
632
632
|
let n = a.current;
|
|
@@ -656,26 +656,26 @@ var te = {
|
|
|
656
656
|
r,
|
|
657
657
|
e
|
|
658
658
|
]), /* @__PURE__ */ l("div", {
|
|
659
|
-
className:
|
|
659
|
+
className: oe.dnaHelix,
|
|
660
660
|
style: {
|
|
661
661
|
width: e,
|
|
662
662
|
height: t
|
|
663
663
|
},
|
|
664
664
|
children: /* @__PURE__ */ l("canvas", {
|
|
665
665
|
ref: a,
|
|
666
|
-
className:
|
|
666
|
+
className: oe.canvas,
|
|
667
667
|
style: {
|
|
668
668
|
width: e,
|
|
669
669
|
height: t
|
|
670
670
|
}
|
|
671
671
|
})
|
|
672
672
|
});
|
|
673
|
-
},
|
|
673
|
+
}, ce = {
|
|
674
674
|
electricArc: "cos-electricArc-BFlY3",
|
|
675
675
|
canvas: "cos-canvas-iowDx"
|
|
676
|
-
},
|
|
676
|
+
}, le = (e, t, n, r, i, a) => {
|
|
677
677
|
if (a <= 0) return [[e, t], [n, r]];
|
|
678
|
-
let o = (e + n) / 2, s = (t + r) / 2, c = n - e, l = r - t, u = Math.hypot(c, l) || 1, d = (Math.random() - .5) * i, f = -l / u * d, p = c / u * d, m =
|
|
678
|
+
let o = (e + n) / 2, s = (t + r) / 2, c = n - e, l = r - t, u = Math.hypot(c, l) || 1, d = (Math.random() - .5) * i, f = -l / u * d, p = c / u * d, m = le(e, t, o + f, s + p, i * .6, a - 1), h = le(o + f, s + p, n, r, i * .6, a - 1);
|
|
679
679
|
return [...m.slice(0, -1), ...h];
|
|
680
680
|
}, ue = ({ width: e = 320, height: t = 160, color: r = "#67e8f9" }) => {
|
|
681
681
|
let i = o(null);
|
|
@@ -692,7 +692,7 @@ var te = {
|
|
|
692
692
|
}), p = () => {
|
|
693
693
|
if (u = requestAnimationFrame(p), d) return;
|
|
694
694
|
o.fillStyle = "#0f172a", o.fillRect(0, 0, e, t);
|
|
695
|
-
let n =
|
|
695
|
+
let n = le(40, s, c, l, 40, 5);
|
|
696
696
|
o.beginPath(), n.forEach(([e, t], n) => n === 0 ? o.moveTo(e, t) : o.lineTo(e, t)), o.strokeStyle = r, o.lineWidth = 2, o.shadowColor = r, o.shadowBlur = 12, o.stroke(), o.shadowBlur = 0, o.beginPath(), n.forEach(([e, t], n) => n === 0 ? o.moveTo(e, t) : o.lineTo(e, t)), o.strokeStyle = "#fff", o.lineWidth = .8, o.globalAlpha = .6, o.stroke(), o.globalAlpha = 1, [[40, s], [c, l]].forEach(([e, t]) => {
|
|
697
697
|
o.beginPath(), o.arc(e, t, 6, 0, Math.PI * 2), o.fillStyle = r, o.fill();
|
|
698
698
|
});
|
|
@@ -705,14 +705,14 @@ var te = {
|
|
|
705
705
|
t,
|
|
706
706
|
e
|
|
707
707
|
]), /* @__PURE__ */ l("div", {
|
|
708
|
-
className:
|
|
708
|
+
className: ce.electricArc,
|
|
709
709
|
style: {
|
|
710
710
|
width: e,
|
|
711
711
|
height: t
|
|
712
712
|
},
|
|
713
713
|
children: /* @__PURE__ */ l("canvas", {
|
|
714
714
|
ref: i,
|
|
715
|
-
className:
|
|
715
|
+
className: ce.canvas,
|
|
716
716
|
style: {
|
|
717
717
|
width: e,
|
|
718
718
|
height: t
|
|
@@ -2160,64 +2160,118 @@ var L = {
|
|
|
2160
2160
|
}, ot = {
|
|
2161
2161
|
smokeFog: "cos-smokeFog-SYlts",
|
|
2162
2162
|
canvas: "cos-canvas-iOJV7"
|
|
2163
|
-
}, st = (
|
|
2164
|
-
let
|
|
2165
|
-
return
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2163
|
+
}, st = (e, t) => {
|
|
2164
|
+
let n = Math.random() * 80 + 40, r = (Math.random() - .5) * .4, i = (Math.random() - .5) * .3 - .1, a = Math.random() * .15 + .05;
|
|
2165
|
+
return {
|
|
2166
|
+
x: Math.random() * e,
|
|
2167
|
+
y: Math.random() * t,
|
|
2168
|
+
radius: n,
|
|
2169
|
+
baseRadius: n,
|
|
2170
|
+
vx: r,
|
|
2171
|
+
vy: i,
|
|
2172
|
+
baseVx: r,
|
|
2173
|
+
baseVy: i,
|
|
2174
|
+
alpha: a,
|
|
2175
|
+
baseAlpha: a,
|
|
2176
|
+
mass: .55 + (n - 40) / 80 * .9,
|
|
2177
|
+
receptivity: .45 + Math.random() * .9,
|
|
2178
|
+
phase: Math.random() * Math.PI * 2
|
|
2179
|
+
};
|
|
2180
|
+
}, ct = (e, t, n, r) => {
|
|
2181
|
+
let i = Math.cos(-n), a = Math.sin(-n), o = e * i - t * a, s = e * a + t * i;
|
|
2182
|
+
return Math.hypot(o / r, s * r);
|
|
2183
|
+
}, lt = ({ width: e = 800, height: r = 500, density: i = .5 }) => {
|
|
2184
|
+
let a = o(null), s = o([]), c = o([]), u = o(0);
|
|
2185
|
+
n(() => {
|
|
2186
|
+
let t = Math.floor(20 + i * 40);
|
|
2187
|
+
s.current = Array.from({ length: t }, () => st(e, r));
|
|
2175
2188
|
}, [
|
|
2189
|
+
i,
|
|
2176
2190
|
r,
|
|
2177
|
-
t,
|
|
2178
2191
|
e
|
|
2179
|
-
])
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2192
|
+
]);
|
|
2193
|
+
let d = t((t, n) => {
|
|
2194
|
+
let i = a.current;
|
|
2195
|
+
if (!i) return;
|
|
2196
|
+
let o = i.getBoundingClientRect(), s = (t - o.left) / o.width * e, l = (n - o.top) / o.height * r;
|
|
2197
|
+
c.current.push({
|
|
2198
|
+
x: s,
|
|
2199
|
+
y: l,
|
|
2200
|
+
life: 1,
|
|
2201
|
+
windAngle: Math.random() * Math.PI * 2,
|
|
2202
|
+
swirl: Math.random() < .5 ? -1 : 1,
|
|
2203
|
+
stretch: 1.15 + Math.random() * .55,
|
|
2204
|
+
radius: Math.min(e, r) * (.28 + Math.random() * .12)
|
|
2205
|
+
});
|
|
2206
|
+
}, [r, e]);
|
|
2207
|
+
return n(() => {
|
|
2208
|
+
let e = a.current;
|
|
2209
|
+
if (!e) return;
|
|
2210
|
+
let t = (e) => d(e.clientX, e.clientY), n = (e) => {
|
|
2211
|
+
let t = e.touches[0];
|
|
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);
|
|
2216
|
+
};
|
|
2217
|
+
}, [d]), n(() => {
|
|
2218
|
+
let t = a.current;
|
|
2219
|
+
if (!t) return;
|
|
2220
|
+
let n = window.devicePixelRatio || 1;
|
|
2221
|
+
t.width = e * n, t.height = r * n;
|
|
2222
|
+
let i = t.getContext("2d");
|
|
2223
|
+
if (!i) return;
|
|
2224
|
+
i.setTransform(n, 0, 0, n, 0, 0);
|
|
2225
|
+
let o = 0, l = document.hidden, d = v((e) => {
|
|
2188
2226
|
l = e;
|
|
2189
|
-
}),
|
|
2190
|
-
if (
|
|
2191
|
-
|
|
2192
|
-
let
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2227
|
+
}), f = () => {
|
|
2228
|
+
if (u.current = requestAnimationFrame(f), l) return;
|
|
2229
|
+
o += .008, i.fillStyle = "#1a1a2e", i.fillRect(0, 0, e, r);
|
|
2230
|
+
let t = i.createRadialGradient(e * .5, r * .3, 0, e * .5, r * .5, e * .7);
|
|
2231
|
+
t.addColorStop(0, "#2d2d44"), t.addColorStop(1, "#1a1a2e"), i.fillStyle = t, i.fillRect(0, 0, e, r);
|
|
2232
|
+
let n = s.current, a = c.current;
|
|
2233
|
+
for (let e = a.length - 1; e >= 0; e--) {
|
|
2234
|
+
let t = a[e], r = t.life * t.life, i = t.life > .92 ? 1 : .22;
|
|
2235
|
+
for (let e of n) {
|
|
2236
|
+
let n = e.x - t.x, a = e.y - t.y, s = ct(n, a, t.windAngle, t.stretch);
|
|
2237
|
+
if (s > t.radius) continue;
|
|
2238
|
+
let c = (1 - s / t.radius) ** 1.6, l = .55 + .7 * Math.sin(e.phase * 3.1 + s * .05 + o * 1.7), u = c * e.receptivity * l * i;
|
|
2239
|
+
if (u < .06) continue;
|
|
2240
|
+
let d = Math.hypot(n, a) || 1, f = n / d, p = a / d, m = -p * t.swirl, h = f * t.swirl, g = Math.cos(t.windAngle), _ = Math.sin(t.windAngle), v = 1 / e.mass, y = Math.sin(e.phase * 5.3 + o * 3.2 + s * .03), b = Math.cos(e.phase * 2.7 - o * 2.1 + s * .02), x = u * r * (2.4 + y * .8) * v, S = u * r * (1.6 + b * 1.1) * v, C = u * r * (1.2 + y * .6) * v, w = y * u * r * 1.2 * v, T = b * u * r * 1.2 * v;
|
|
2241
|
+
e.vx += f * x + m * S + g * C + w, e.vy += p * x + h * S + _ * C + T, e.alpha *= 1 - u * r * (.28 + Math.abs(y) * .18), e.radius += e.baseRadius * u * r * (.1 + Math.abs(b) * .16);
|
|
2242
|
+
}
|
|
2243
|
+
t.life *= .88, t.radius *= 1.01, t.life < .05 && a.splice(e, 1);
|
|
2244
|
+
}
|
|
2245
|
+
n.forEach((t, n) => {
|
|
2246
|
+
t.x += t.vx + Math.sin(o + n + t.phase) * .15, t.y += t.vy + Math.cos(o * .7 + n * .5 + t.phase) * .1;
|
|
2247
|
+
let a = .014 + t.mass * .01;
|
|
2248
|
+
t.vx += (t.baseVx - t.vx) * a, t.vy += (t.baseVy - t.vy) * a, t.alpha += (t.baseAlpha - t.alpha) * .01, t.radius += (t.baseRadius - t.radius) * .012, t.x < -t.radius && (t.x = e + t.radius), t.x > e + t.radius && (t.x = -t.radius), t.y < -t.radius && (t.y = r + t.radius), t.y > r + t.radius && (t.y = -t.radius);
|
|
2249
|
+
let s = i.createRadialGradient(t.x, t.y, 0, t.x, t.y, t.radius);
|
|
2250
|
+
s.addColorStop(0, `rgb(200 200 210 / ${t.alpha})`), s.addColorStop(.5, `rgb(160 160 175 / ${t.alpha * .5})`), s.addColorStop(1, "rgb(160 160 175 / 0)"), i.fillStyle = s, i.beginPath(), i.arc(t.x, t.y, t.radius, 0, Math.PI * 2), i.fill();
|
|
2197
2251
|
});
|
|
2198
2252
|
};
|
|
2199
|
-
return
|
|
2200
|
-
cancelAnimationFrame(
|
|
2253
|
+
return f(), () => {
|
|
2254
|
+
cancelAnimationFrame(u.current), d();
|
|
2201
2255
|
};
|
|
2202
|
-
}, [
|
|
2256
|
+
}, [r, e]), /* @__PURE__ */ l("div", {
|
|
2203
2257
|
className: ot.smokeFog,
|
|
2204
2258
|
style: {
|
|
2205
2259
|
width: e,
|
|
2206
|
-
height:
|
|
2260
|
+
height: r
|
|
2207
2261
|
},
|
|
2208
2262
|
children: /* @__PURE__ */ l("canvas", {
|
|
2209
|
-
ref:
|
|
2263
|
+
ref: a,
|
|
2210
2264
|
className: ot.canvas,
|
|
2211
2265
|
style: {
|
|
2212
2266
|
width: e,
|
|
2213
|
-
height:
|
|
2267
|
+
height: r
|
|
2214
2268
|
}
|
|
2215
2269
|
})
|
|
2216
2270
|
});
|
|
2217
|
-
},
|
|
2271
|
+
}, ut = {
|
|
2218
2272
|
solarSystem: "cos-solarSystem-27h8F",
|
|
2219
2273
|
canvas: "cos-canvas-C0nRa"
|
|
2220
|
-
},
|
|
2274
|
+
}, dt = [
|
|
2221
2275
|
{
|
|
2222
2276
|
name: "Mercury",
|
|
2223
2277
|
radius: 0,
|
|
@@ -2275,10 +2329,10 @@ var L = {
|
|
|
2275
2329
|
size: 2,
|
|
2276
2330
|
parent: 2
|
|
2277
2331
|
}
|
|
2278
|
-
],
|
|
2332
|
+
], ft = ({ width: e = 400, height: t = 400, speed: r = 1, showOrbits: i = !0 }) => {
|
|
2279
2333
|
let a = o(null), s = o([]), c = o([]);
|
|
2280
2334
|
return n(() => {
|
|
2281
|
-
s.current =
|
|
2335
|
+
s.current = dt.map((e) => ({
|
|
2282
2336
|
...e,
|
|
2283
2337
|
angle: Math.random() * Math.PI * 2
|
|
2284
2338
|
})), c.current = Array.from({ length: 80 }, () => ({
|
|
@@ -2327,24 +2381,24 @@ var L = {
|
|
|
2327
2381
|
r,
|
|
2328
2382
|
e
|
|
2329
2383
|
]), /* @__PURE__ */ l("div", {
|
|
2330
|
-
className:
|
|
2384
|
+
className: ut.solarSystem,
|
|
2331
2385
|
style: {
|
|
2332
2386
|
width: e,
|
|
2333
2387
|
height: t
|
|
2334
2388
|
},
|
|
2335
2389
|
children: /* @__PURE__ */ l("canvas", {
|
|
2336
2390
|
ref: a,
|
|
2337
|
-
className:
|
|
2391
|
+
className: ut.canvas,
|
|
2338
2392
|
style: {
|
|
2339
2393
|
width: e,
|
|
2340
2394
|
height: t
|
|
2341
2395
|
}
|
|
2342
2396
|
})
|
|
2343
2397
|
});
|
|
2344
|
-
},
|
|
2398
|
+
}, pt = {
|
|
2345
2399
|
snowfall: "cos-snowfall-Q-Dhg",
|
|
2346
2400
|
canvas: "cos-canvas-bJVF8"
|
|
2347
|
-
},
|
|
2401
|
+
}, mt = ({ width: e = 800, height: r = 500, mode: i = "snow", count: a = 120 }) => {
|
|
2348
2402
|
let s = o(null), c = o([]), u = o(0), d = t((t) => ({
|
|
2349
2403
|
x: Math.random() * e,
|
|
2350
2404
|
y: t ?? Math.random() * r,
|
|
@@ -2391,24 +2445,24 @@ var L = {
|
|
|
2391
2445
|
i,
|
|
2392
2446
|
e
|
|
2393
2447
|
]), /* @__PURE__ */ l("div", {
|
|
2394
|
-
className:
|
|
2448
|
+
className: pt.snowfall,
|
|
2395
2449
|
style: {
|
|
2396
2450
|
width: e,
|
|
2397
2451
|
height: r
|
|
2398
2452
|
},
|
|
2399
2453
|
children: /* @__PURE__ */ l("canvas", {
|
|
2400
2454
|
ref: s,
|
|
2401
|
-
className:
|
|
2455
|
+
className: pt.canvas,
|
|
2402
2456
|
style: {
|
|
2403
2457
|
width: e,
|
|
2404
2458
|
height: r
|
|
2405
2459
|
}
|
|
2406
2460
|
})
|
|
2407
2461
|
});
|
|
2408
|
-
},
|
|
2462
|
+
}, ht = {
|
|
2409
2463
|
starfield: "cos-starfield-QTwia",
|
|
2410
2464
|
canvas: "cos-canvas-C2t3g"
|
|
2411
|
-
},
|
|
2465
|
+
}, gt = ({ width: e = 800, height: t = 500, starCount: r = 400, speed: i = 1 }) => {
|
|
2412
2466
|
let a = o(null), s = o([]), c = o(0);
|
|
2413
2467
|
return n(() => {
|
|
2414
2468
|
s.current = Array.from({ length: r }, () => ({
|
|
@@ -2451,14 +2505,14 @@ var L = {
|
|
|
2451
2505
|
r,
|
|
2452
2506
|
e
|
|
2453
2507
|
]), /* @__PURE__ */ l("div", {
|
|
2454
|
-
className:
|
|
2508
|
+
className: ht.starfield,
|
|
2455
2509
|
style: {
|
|
2456
2510
|
width: e,
|
|
2457
2511
|
height: t
|
|
2458
2512
|
},
|
|
2459
2513
|
children: /* @__PURE__ */ l("canvas", {
|
|
2460
2514
|
ref: a,
|
|
2461
|
-
className:
|
|
2515
|
+
className: ht.canvas,
|
|
2462
2516
|
style: {
|
|
2463
2517
|
width: e,
|
|
2464
2518
|
height: t
|
|
@@ -2480,7 +2534,7 @@ var L = {
|
|
|
2480
2534
|
treasure: "cos-treasure-nx-6S",
|
|
2481
2535
|
pop: "cos-pop-uRZvT",
|
|
2482
2536
|
label: "cos-label-61hRe"
|
|
2483
|
-
},
|
|
2537
|
+
}, _t = ({ progress: e = 0, onOpen: t, label: r = "开启宝箱" }) => {
|
|
2484
2538
|
let i = o(!1), a = o(t), s = y(e, 0, 100), c = s >= 100;
|
|
2485
2539
|
return n(() => {
|
|
2486
2540
|
a.current = t;
|
|
@@ -2525,10 +2579,10 @@ var L = {
|
|
|
2525
2579
|
})
|
|
2526
2580
|
]
|
|
2527
2581
|
});
|
|
2528
|
-
},
|
|
2582
|
+
}, vt = {
|
|
2529
2583
|
radarScan: "cos-radarScan-PZaG8",
|
|
2530
2584
|
canvas: "cos-canvas-fUw5N"
|
|
2531
|
-
},
|
|
2585
|
+
}, yt = ({ size: e = 300, color: t = "#22d3ee", blipCount: r = 5 }) => {
|
|
2532
2586
|
let i = o(null), a = o(0), s = o([]), c = o(0);
|
|
2533
2587
|
return n(() => {
|
|
2534
2588
|
s.current = Array.from({ length: r }, () => ({
|
|
@@ -2565,14 +2619,14 @@ var L = {
|
|
|
2565
2619
|
t,
|
|
2566
2620
|
e
|
|
2567
2621
|
]), /* @__PURE__ */ l("div", {
|
|
2568
|
-
className:
|
|
2622
|
+
className: vt.radarScan,
|
|
2569
2623
|
style: {
|
|
2570
2624
|
width: e,
|
|
2571
2625
|
height: e
|
|
2572
2626
|
},
|
|
2573
2627
|
children: /* @__PURE__ */ l("canvas", {
|
|
2574
2628
|
ref: i,
|
|
2575
|
-
className:
|
|
2629
|
+
className: vt.canvas,
|
|
2576
2630
|
style: {
|
|
2577
2631
|
width: e,
|
|
2578
2632
|
height: e
|
|
@@ -2585,7 +2639,7 @@ var L = {
|
|
|
2585
2639
|
hud: "cos-hud-InqMq",
|
|
2586
2640
|
end: "cos-end-u0J7o",
|
|
2587
2641
|
hint: "cos-hint-sO6ld"
|
|
2588
|
-
},
|
|
2642
|
+
}, bt = ({ duration: e = 1e4, onGrab: r }) => {
|
|
2589
2643
|
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);
|
|
2590
2644
|
n(() => {
|
|
2591
2645
|
y.current = r;
|
|
@@ -2667,7 +2721,7 @@ var L = {
|
|
|
2667
2721
|
glassWrap: "cos-glassWrap-golMO",
|
|
2668
2722
|
rotate: "cos-rotate-7X9Jj",
|
|
2669
2723
|
glassItem: "cos-glassItem-OwlFI"
|
|
2670
|
-
},
|
|
2724
|
+
}, xt = ({ starCount: e, glassCount: t = 8, glassRadius: r = 150 }) => {
|
|
2671
2725
|
let i = o(null), a = o(null);
|
|
2672
2726
|
return n(() => {
|
|
2673
2727
|
let n = i.current, o = a.current;
|
|
@@ -2703,10 +2757,10 @@ var L = {
|
|
|
2703
2757
|
className: G.glassWrap
|
|
2704
2758
|
})
|
|
2705
2759
|
});
|
|
2706
|
-
},
|
|
2760
|
+
}, St = {
|
|
2707
2761
|
ropeChain: "cos-ropeChain-gYaSK",
|
|
2708
2762
|
canvas: "cos-canvas-5i95N"
|
|
2709
|
-
},
|
|
2763
|
+
}, Ct = ({ width: e = 400, height: t = 400, segments: r = 16, color: i = "#38bdf8", gravity: a = .4 }) => {
|
|
2710
2764
|
let s = o(null), c = o([]), u = o({
|
|
2711
2765
|
active: !1,
|
|
2712
2766
|
index: -1
|
|
@@ -2791,14 +2845,14 @@ var L = {
|
|
|
2791
2845
|
r,
|
|
2792
2846
|
e
|
|
2793
2847
|
]), /* @__PURE__ */ l("div", {
|
|
2794
|
-
className:
|
|
2848
|
+
className: St.ropeChain,
|
|
2795
2849
|
style: {
|
|
2796
2850
|
width: e,
|
|
2797
2851
|
height: t
|
|
2798
2852
|
},
|
|
2799
2853
|
children: /* @__PURE__ */ l("canvas", {
|
|
2800
2854
|
ref: s,
|
|
2801
|
-
className:
|
|
2855
|
+
className: St.canvas,
|
|
2802
2856
|
style: {
|
|
2803
2857
|
width: e,
|
|
2804
2858
|
height: t
|
|
@@ -2821,7 +2875,7 @@ var L = {
|
|
|
2821
2875
|
x: e + n * Math.cos(i),
|
|
2822
2876
|
y: t + n * Math.sin(i)
|
|
2823
2877
|
};
|
|
2824
|
-
},
|
|
2878
|
+
}, wt = ({ value: e = 0, max: t = 100, label: n = "SPEED", color: r = "#f97316" }) => {
|
|
2825
2879
|
let i = -120 + y(t > 0 ? e / t : 0, 0, 1) * 240, o = a(() => {
|
|
2826
2880
|
let e = q(100, 100, 72, -120), t = q(100, 100, 72, 120);
|
|
2827
2881
|
return `M ${e.x} ${e.y} A 72 72 0 1 1 ${t.x} ${t.y}`;
|
|
@@ -2901,7 +2955,7 @@ var L = {
|
|
|
2901
2955
|
dot: "cos-dot-HJEVy",
|
|
2902
2956
|
pulse: "cos-pulse-N6FD1",
|
|
2903
2957
|
name: "cos-name-7zefJ"
|
|
2904
|
-
},
|
|
2958
|
+
}, Tt = ({ steps: e = [
|
|
2905
2959
|
"Start",
|
|
2906
2960
|
"Process",
|
|
2907
2961
|
"Review",
|
|
@@ -2937,83 +2991,195 @@ var L = {
|
|
|
2937
2991
|
]
|
|
2938
2992
|
})
|
|
2939
2993
|
});
|
|
2940
|
-
},
|
|
2994
|
+
}, Et = {
|
|
2941
2995
|
rippleWater: "cos-rippleWater-wsinI",
|
|
2942
2996
|
canvas: "cos-canvas-XOdSF",
|
|
2943
2997
|
hint: "cos-hint-0JH5D"
|
|
2944
|
-
},
|
|
2945
|
-
let
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2998
|
+
}, Dt = "\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", Ot = "\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", kt = (e) => {
|
|
2999
|
+
let t = e.replace("#", ""), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t, r = Number.parseInt(n, 16);
|
|
3000
|
+
return Number.isNaN(r) ? [
|
|
3001
|
+
.22,
|
|
3002
|
+
.74,
|
|
3003
|
+
.97
|
|
3004
|
+
] : [
|
|
3005
|
+
(r >> 16 & 255) / 255,
|
|
3006
|
+
(r >> 8 & 255) / 255,
|
|
3007
|
+
(r & 255) / 255
|
|
3008
|
+
];
|
|
3009
|
+
}, At = (e, t, n) => {
|
|
3010
|
+
let r = e.createShader(t);
|
|
3011
|
+
return r ? (e.shaderSource(r, n), e.compileShader(r), e.getShaderParameter(r, e.COMPILE_STATUS) ? r : (e.deleteShader(r), null)) : null;
|
|
3012
|
+
}, jt = (e, t, n) => {
|
|
3013
|
+
let r = At(e, e.VERTEX_SHADER, t), i = At(e, e.FRAGMENT_SHADER, n);
|
|
3014
|
+
if (!r || !i) return null;
|
|
3015
|
+
let a = e.createProgram();
|
|
3016
|
+
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, Mt = ({ 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 = "点击水面产生涟漪" }) => {
|
|
3018
|
+
let C = o(null), w = o(0), T = o(null), E = o({
|
|
3019
|
+
fromColor: i,
|
|
3020
|
+
toColor: a,
|
|
3021
|
+
color: s,
|
|
3022
|
+
waveAmplitude: c,
|
|
3023
|
+
waveSpeed: d,
|
|
3024
|
+
shimmer: f,
|
|
3025
|
+
reflection: p,
|
|
3026
|
+
rippleStrength: m,
|
|
3027
|
+
rippleRadius: h,
|
|
3028
|
+
damping: g,
|
|
3029
|
+
spread: _,
|
|
3030
|
+
interactive: b
|
|
3031
|
+
});
|
|
3032
|
+
n(() => {
|
|
3033
|
+
E.current = {
|
|
3034
|
+
fromColor: i,
|
|
3035
|
+
toColor: a,
|
|
3036
|
+
color: s,
|
|
3037
|
+
waveAmplitude: c,
|
|
3038
|
+
waveSpeed: d,
|
|
3039
|
+
shimmer: f,
|
|
3040
|
+
reflection: p,
|
|
3041
|
+
rippleStrength: m,
|
|
3042
|
+
rippleRadius: h,
|
|
3043
|
+
damping: g,
|
|
3044
|
+
spread: _,
|
|
3045
|
+
interactive: b
|
|
3046
|
+
};
|
|
3047
|
+
}, [
|
|
3048
|
+
i,
|
|
3049
|
+
a,
|
|
3050
|
+
s,
|
|
3051
|
+
c,
|
|
3052
|
+
d,
|
|
3053
|
+
f,
|
|
3054
|
+
p,
|
|
3055
|
+
m,
|
|
3056
|
+
h,
|
|
3057
|
+
g,
|
|
3058
|
+
_,
|
|
3059
|
+
b
|
|
3060
|
+
]);
|
|
3061
|
+
let D = t((e, t) => {
|
|
3062
|
+
if (!E.current.interactive) return;
|
|
3063
|
+
let n = C.current;
|
|
3064
|
+
if (!n) return;
|
|
3065
|
+
let r = n.getBoundingClientRect();
|
|
3066
|
+
T.current = {
|
|
3067
|
+
x: (e - r.left) / r.width,
|
|
3068
|
+
y: 1 - (t - r.top) / r.height,
|
|
3069
|
+
strength: E.current.rippleStrength
|
|
3070
|
+
};
|
|
3071
|
+
}, []);
|
|
2957
3072
|
return n(() => {
|
|
2958
|
-
let e =
|
|
3073
|
+
let e = C.current;
|
|
2959
3074
|
if (!e) return;
|
|
2960
|
-
let t = (e) =>
|
|
3075
|
+
let t = (e) => D(e.clientX, e.clientY), n = (e) => {
|
|
2961
3076
|
let t = e.touches[0];
|
|
2962
|
-
t &&
|
|
3077
|
+
t && D(t.clientX, t.clientY);
|
|
2963
3078
|
};
|
|
2964
3079
|
return e.addEventListener("click", t), e.addEventListener("touchstart", n, { passive: !0 }), () => {
|
|
2965
3080
|
e.removeEventListener("click", t), e.removeEventListener("touchstart", n);
|
|
2966
3081
|
};
|
|
2967
|
-
}, [
|
|
2968
|
-
let t =
|
|
3082
|
+
}, [D]), n(() => {
|
|
3083
|
+
let t = C.current;
|
|
2969
3084
|
if (!t) return;
|
|
2970
|
-
let n = window.devicePixelRatio || 1;
|
|
2971
|
-
t.width = e * n, t.height = r * n;
|
|
2972
|
-
let
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
3085
|
+
let n = Math.min(window.devicePixelRatio || 1, 2);
|
|
3086
|
+
t.width = Math.floor(e * n), t.height = Math.floor(r * n);
|
|
3087
|
+
let i = t.getContext("webgl", {
|
|
3088
|
+
alpha: !1,
|
|
3089
|
+
antialias: !1,
|
|
3090
|
+
depth: !1,
|
|
3091
|
+
stencil: !1,
|
|
3092
|
+
premultipliedAlpha: !1
|
|
3093
|
+
});
|
|
3094
|
+
if (!i) return;
|
|
3095
|
+
let a = jt(i, Dt, Ot);
|
|
3096
|
+
if (!a) return;
|
|
3097
|
+
let o = i.createBuffer();
|
|
3098
|
+
i.bindBuffer(i.ARRAY_BUFFER, o), i.bufferData(i.ARRAY_BUFFER, new Float32Array([
|
|
3099
|
+
-1,
|
|
3100
|
+
-1,
|
|
3101
|
+
1,
|
|
3102
|
+
-1,
|
|
3103
|
+
-1,
|
|
3104
|
+
1,
|
|
3105
|
+
1,
|
|
3106
|
+
1
|
|
3107
|
+
]), i.STATIC_DRAW);
|
|
3108
|
+
let s = i.getAttribLocation(a, "a_pos"), c = i.getUniformLocation(a, "u_time"), l = i.getUniformLocation(a, "u_res"), u = i.getUniformLocation(a, "u_tint"), d = i.getUniformLocation(a, "u_from"), f = i.getUniformLocation(a, "u_to"), p = i.getUniformLocation(a, "u_height"), m = i.getUniformLocation(a, "u_sim"), h = i.getUniformLocation(a, "u_waveAmp"), g = i.getUniformLocation(a, "u_waveSpeed"), _ = i.getUniformLocation(a, "u_shimmer"), b = i.getUniformLocation(a, "u_reflection"), x = Y * Y, S = new Float32Array(x), D = new Float32Array(x), O = new Float32Array(x), k = i.createTexture();
|
|
3109
|
+
i.bindTexture(i.TEXTURE_2D, k), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_MIN_FILTER, i.LINEAR), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_MAG_FILTER, i.LINEAR), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_WRAP_S, i.CLAMP_TO_EDGE), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_WRAP_T, i.CLAMP_TO_EDGE);
|
|
3110
|
+
let A = new Uint8Array(x * 4), j = () => {
|
|
3111
|
+
for (let e = 0; e < x; e++) {
|
|
3112
|
+
let t = Math.max(0, Math.min(255, Math.floor((D[e] * .5 + .5) * 255))), n = e * 4;
|
|
3113
|
+
A[n] = t, A[n + 1] = t, A[n + 2] = t, A[n + 3] = 255;
|
|
3114
|
+
}
|
|
3115
|
+
i.bindTexture(i.TEXTURE_2D, k), i.texImage2D(i.TEXTURE_2D, 0, i.RGBA, Y, Y, 0, i.RGBA, i.UNSIGNED_BYTE, A);
|
|
3116
|
+
}, M = (e, t, n, r) => {
|
|
3117
|
+
let i = e * (Y - 1), a = t * (Y - 1), o = y(r, 2, 12);
|
|
3118
|
+
for (let e = -o - 1; e <= o + 1; e++) for (let t = -o - 1; t <= o + 1; t++) {
|
|
3119
|
+
let r = Math.round(i + t), s = Math.round(a + e);
|
|
3120
|
+
if (r <= 0 || r >= Y - 1 || s <= 0 || s >= Y - 1) continue;
|
|
3121
|
+
let c = Math.sqrt(t * t + e * e), l = Math.exp(-c * c * .55) * -.35, u = Math.exp(-((c - o * .55) ** 2) * .9);
|
|
3122
|
+
D[s * Y + r] += n * (l + u * 1.1);
|
|
3123
|
+
}
|
|
3124
|
+
}, N = (e, t) => {
|
|
3125
|
+
let n = y(e, .9, .999), r = y(t, .3, .7);
|
|
3126
|
+
for (let e = 0; e < 2; e++) {
|
|
3127
|
+
for (let e = 1; e < Y - 1; e++) {
|
|
3128
|
+
let t = e * Y;
|
|
3129
|
+
for (let e = 1; e < Y - 1; e++) {
|
|
3130
|
+
let i = t + e, a = D[i - 1] + D[i + 1] + D[i - Y] + D[i + Y];
|
|
3131
|
+
O[i] = (a * r - S[i]) * n, O[i] > 1.5 ? O[i] = 1.5 : O[i] < -1.5 && (O[i] = -1.5);
|
|
3132
|
+
}
|
|
3133
|
+
}
|
|
3134
|
+
let e = S;
|
|
3135
|
+
S = D, D = O, O = e, O.fill(0);
|
|
3136
|
+
}
|
|
3137
|
+
}, P = document.hidden, ee = v((e) => {
|
|
3138
|
+
P = e;
|
|
3139
|
+
}), te = performance.now();
|
|
3140
|
+
j();
|
|
3141
|
+
let F = (e) => {
|
|
3142
|
+
if (w.current = requestAnimationFrame(F), P) return;
|
|
3143
|
+
let n = E.current;
|
|
3144
|
+
if (T.current) {
|
|
3145
|
+
let e = T.current, t = y(e.strength, 0, 3), r = n.rippleRadius;
|
|
3146
|
+
M(e.x, e.y, t, r), M(e.x + .004, e.y - .003, t * .35, r), T.current = null;
|
|
3147
|
+
}
|
|
3148
|
+
N(n.damping, n.spread), j();
|
|
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);
|
|
2982
3151
|
};
|
|
2983
|
-
return
|
|
2984
|
-
cancelAnimationFrame(
|
|
3152
|
+
return w.current = requestAnimationFrame(F), () => {
|
|
3153
|
+
cancelAnimationFrame(w.current), ee(), i.deleteTexture(k), i.deleteBuffer(o), i.deleteProgram(a);
|
|
2985
3154
|
};
|
|
2986
|
-
}, [
|
|
2987
|
-
|
|
2988
|
-
r,
|
|
2989
|
-
e
|
|
2990
|
-
]), /* @__PURE__ */ u("div", {
|
|
2991
|
-
className: wt.rippleWater,
|
|
3155
|
+
}, [r, e]), /* @__PURE__ */ u("div", {
|
|
3156
|
+
className: Et.rippleWater,
|
|
2992
3157
|
style: {
|
|
2993
3158
|
width: e,
|
|
2994
3159
|
height: r
|
|
2995
3160
|
},
|
|
2996
3161
|
children: [/* @__PURE__ */ l("canvas", {
|
|
2997
|
-
ref:
|
|
2998
|
-
className:
|
|
3162
|
+
ref: C,
|
|
3163
|
+
className: Et.canvas,
|
|
2999
3164
|
style: {
|
|
3000
3165
|
width: e,
|
|
3001
|
-
height: r
|
|
3166
|
+
height: r,
|
|
3167
|
+
cursor: b ? "pointer" : "default"
|
|
3002
3168
|
}
|
|
3003
|
-
}), /* @__PURE__ */ l("span", {
|
|
3004
|
-
className:
|
|
3005
|
-
children:
|
|
3006
|
-
})]
|
|
3169
|
+
}), x ? /* @__PURE__ */ l("span", {
|
|
3170
|
+
className: Et.hint,
|
|
3171
|
+
children: S
|
|
3172
|
+
}) : null]
|
|
3007
3173
|
});
|
|
3008
|
-
},
|
|
3174
|
+
}, Nt = {
|
|
3009
3175
|
scrambleText: "cos-scrambleText-hN4Wm",
|
|
3010
3176
|
text: "cos-text-frsHs",
|
|
3011
3177
|
cursor: "cos-cursor-3zQOy",
|
|
3012
3178
|
blink: "cos-blink-OcKXu"
|
|
3013
|
-
},
|
|
3179
|
+
}, Pt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*", Ft = ({ text: e = "DECRYPTED", duration: t = 2e3, charset: r = Pt }) => {
|
|
3014
3180
|
let [i, a] = s(""), c = o(0), d = o(0);
|
|
3015
3181
|
return n(() => {
|
|
3016
|
-
let n = r.length > 0 ? r :
|
|
3182
|
+
let n = r.length > 0 ? r : Pt, i = e;
|
|
3017
3183
|
d.current = performance.now();
|
|
3018
3184
|
let o = (e) => {
|
|
3019
3185
|
let r = e - d.current, s = Math.min(r / t, 1), l = Math.floor(s * i.length);
|
|
@@ -3025,18 +3191,18 @@ var L = {
|
|
|
3025
3191
|
t,
|
|
3026
3192
|
r
|
|
3027
3193
|
]), /* @__PURE__ */ l("div", {
|
|
3028
|
-
className:
|
|
3194
|
+
className: Nt.scrambleText,
|
|
3029
3195
|
children: /* @__PURE__ */ u("p", {
|
|
3030
|
-
className:
|
|
3031
|
-
children: [i, /* @__PURE__ */ l("span", { className:
|
|
3196
|
+
className: Nt.text,
|
|
3197
|
+
children: [i, /* @__PURE__ */ l("span", { className: Nt.cursor })]
|
|
3032
3198
|
})
|
|
3033
3199
|
});
|
|
3034
|
-
},
|
|
3200
|
+
}, It = {
|
|
3035
3201
|
scratchCard: "cos-scratchCard-McIEK",
|
|
3036
3202
|
prize: "cos-prize-X0z5V",
|
|
3037
3203
|
canvas: "cos-canvas-JqIlr",
|
|
3038
3204
|
hidden: "cos-hidden-Lsfbt"
|
|
3039
|
-
},
|
|
3205
|
+
}, Lt = ({ coverColor: e = "#94a3b8", prize: r = "🎉 恭喜中奖!", onReveal: i, width: a = 300, height: c = 180 }) => {
|
|
3040
3206
|
let d = o(null), f = o(!1), p = o(!1), m = o(i), [h, g] = s(!1);
|
|
3041
3207
|
n(() => {
|
|
3042
3208
|
m.current = i;
|
|
@@ -3099,17 +3265,17 @@ var L = {
|
|
|
3099
3265
|
f.current = !1;
|
|
3100
3266
|
};
|
|
3101
3267
|
return /* @__PURE__ */ u("div", {
|
|
3102
|
-
className:
|
|
3268
|
+
className: It.scratchCard,
|
|
3103
3269
|
style: {
|
|
3104
3270
|
width: a,
|
|
3105
3271
|
height: c
|
|
3106
3272
|
},
|
|
3107
3273
|
children: [/* @__PURE__ */ l("div", {
|
|
3108
|
-
className:
|
|
3274
|
+
className: It.prize,
|
|
3109
3275
|
children: r
|
|
3110
3276
|
}), /* @__PURE__ */ l("canvas", {
|
|
3111
3277
|
ref: d,
|
|
3112
|
-
className: `${
|
|
3278
|
+
className: `${It.canvas} ${h ? It.hidden : ""}`,
|
|
3113
3279
|
style: {
|
|
3114
3280
|
width: a,
|
|
3115
3281
|
height: c
|
|
@@ -3132,14 +3298,14 @@ var L = {
|
|
|
3132
3298
|
mask: "cos-mask-jdrj3",
|
|
3133
3299
|
spinBtn: "cos-spinBtn-DvDE7",
|
|
3134
3300
|
result: "cos-result-dLN5b"
|
|
3135
|
-
},
|
|
3301
|
+
}, Rt = [
|
|
3136
3302
|
"🍒",
|
|
3137
3303
|
"🍋",
|
|
3138
3304
|
"🍊",
|
|
3139
3305
|
"🍇",
|
|
3140
3306
|
"⭐",
|
|
3141
3307
|
"7️⃣"
|
|
3142
|
-
],
|
|
3308
|
+
], zt = (e) => 1 - (1 - e) ** 3, Bt = ({ symbols: e = Rt, onSpinEnd: r }) => {
|
|
3143
3309
|
let [i, a] = s(!1), [c, d] = s([
|
|
3144
3310
|
0,
|
|
3145
3311
|
0,
|
|
@@ -3199,7 +3365,7 @@ var L = {
|
|
|
3199
3365
|
if (d(r.map((e, t) => {
|
|
3200
3366
|
let r = i - l - s[t];
|
|
3201
3367
|
if (r < 0) return e;
|
|
3202
|
-
let a =
|
|
3368
|
+
let a = zt(Math.min(r / o, 1));
|
|
3203
3369
|
return e + (n[t] - e) * a;
|
|
3204
3370
|
})), !s.every((e) => i - l - e >= o)) m.current = requestAnimationFrame(f);
|
|
3205
3371
|
else if (!u.cancelled) {
|
|
@@ -3219,7 +3385,7 @@ var L = {
|
|
|
3219
3385
|
})
|
|
3220
3386
|
]
|
|
3221
3387
|
});
|
|
3222
|
-
},
|
|
3388
|
+
}, Vt = {
|
|
3223
3389
|
splitReveal: "cos-splitReveal-6W8-6",
|
|
3224
3390
|
text: "cos-text-miTsj",
|
|
3225
3391
|
char: "cos-char-0gPJV",
|
|
@@ -3228,27 +3394,27 @@ var L = {
|
|
|
3228
3394
|
fromBottom: "cos-fromBottom-24D6g",
|
|
3229
3395
|
fromLeft: "cos-fromLeft-OMiPY",
|
|
3230
3396
|
fromRight: "cos-fromRight-EcMOR"
|
|
3231
|
-
},
|
|
3397
|
+
}, Ht = [
|
|
3232
3398
|
"fromTop",
|
|
3233
3399
|
"fromBottom",
|
|
3234
3400
|
"fromLeft",
|
|
3235
3401
|
"fromRight"
|
|
3236
|
-
],
|
|
3237
|
-
className:
|
|
3402
|
+
], Ut = ({ text: e = "REVEAL", delay: t = 80, color: n = "#f8fafc" }) => /* @__PURE__ */ l("div", {
|
|
3403
|
+
className: Vt.splitReveal,
|
|
3238
3404
|
children: /* @__PURE__ */ l("h1", {
|
|
3239
|
-
className:
|
|
3405
|
+
className: Vt.text,
|
|
3240
3406
|
style: { "--reveal-color": n },
|
|
3241
3407
|
children: e.split("").map((e, n) => /* @__PURE__ */ l("span", {
|
|
3242
|
-
className: `${
|
|
3408
|
+
className: `${Vt.char} ${Vt[Ht[n % Ht.length]]}`,
|
|
3243
3409
|
style: { animationDelay: `${n * t}ms` },
|
|
3244
3410
|
children: e === " " ? "\xA0" : e
|
|
3245
3411
|
}, `${e}-${n}`))
|
|
3246
3412
|
})
|
|
3247
|
-
}),
|
|
3413
|
+
}), Wt = {
|
|
3248
3414
|
spotlight: "cos-spotlight-OddY1",
|
|
3249
3415
|
content: "cos-content-5I1Wy",
|
|
3250
3416
|
overlay: "cos-overlay-F6CJ5"
|
|
3251
|
-
},
|
|
3417
|
+
}, Gt = ({ children: e, radius: n = 120, dimColor: r = "rgba(0, 0, 0, 0.85)" }) => {
|
|
3252
3418
|
let i = o(null), a = t((e) => {
|
|
3253
3419
|
let t = i.current;
|
|
3254
3420
|
if (!t) return;
|
|
@@ -3257,16 +3423,16 @@ var L = {
|
|
|
3257
3423
|
}, []);
|
|
3258
3424
|
return /* @__PURE__ */ u("div", {
|
|
3259
3425
|
ref: i,
|
|
3260
|
-
className:
|
|
3426
|
+
className: Wt.spotlight,
|
|
3261
3427
|
style: {
|
|
3262
3428
|
"--spot-radius": `${n}px`,
|
|
3263
3429
|
"--dim-color": r
|
|
3264
3430
|
},
|
|
3265
3431
|
onMouseMove: a,
|
|
3266
3432
|
children: [/* @__PURE__ */ l("div", {
|
|
3267
|
-
className:
|
|
3433
|
+
className: Wt.content,
|
|
3268
3434
|
children: e
|
|
3269
|
-
}), /* @__PURE__ */ l("div", { className:
|
|
3435
|
+
}), /* @__PURE__ */ l("div", { className: Wt.overlay })]
|
|
3270
3436
|
});
|
|
3271
3437
|
}, Z = {
|
|
3272
3438
|
turntable: "cos-turntable-dkc32",
|
|
@@ -3276,7 +3442,7 @@ var L = {
|
|
|
3276
3442
|
spinBtn: "cos-spinBtn-l9JIC",
|
|
3277
3443
|
result: "cos-result-H8q2c",
|
|
3278
3444
|
"fade-in": "cos-fade-in-U9bUC"
|
|
3279
|
-
},
|
|
3445
|
+
}, Kt = [
|
|
3280
3446
|
"#FF6B6B",
|
|
3281
3447
|
"#4ECDC4",
|
|
3282
3448
|
"#FFE66D",
|
|
@@ -3285,19 +3451,19 @@ var L = {
|
|
|
3285
3451
|
"#F472B6",
|
|
3286
3452
|
"#34D399",
|
|
3287
3453
|
"#FB923C"
|
|
3288
|
-
],
|
|
3454
|
+
], qt = [
|
|
3289
3455
|
{ label: "一等奖" },
|
|
3290
3456
|
{ label: "二等奖" },
|
|
3291
3457
|
{ label: "三等奖" },
|
|
3292
3458
|
{ label: "谢谢参与" },
|
|
3293
3459
|
{ label: "优惠券" },
|
|
3294
3460
|
{ label: "再来一次" }
|
|
3295
|
-
],
|
|
3461
|
+
], Jt = (e) => 1 - (1 - e) ** 3, Yt = ({ prizes: e = qt, size: r = 360, spinDuration: i = 4e3, spinRounds: a = 5, buttonText: c = "开始抽奖", onSpinEnd: d }) => {
|
|
3296
3462
|
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);
|
|
3297
3463
|
n(() => {
|
|
3298
3464
|
b.current = d;
|
|
3299
3465
|
}, [d]);
|
|
3300
|
-
let S = r + 48, C = (e, t) => t.color ??
|
|
3466
|
+
let S = r + 48, C = (e, t) => t.color ?? Kt[e % Kt.length], w = t((t) => {
|
|
3301
3467
|
let n = f.current;
|
|
3302
3468
|
if (!n) return;
|
|
3303
3469
|
let i = n.getContext("2d");
|
|
@@ -3363,7 +3529,7 @@ var L = {
|
|
|
3363
3529
|
x.current = l;
|
|
3364
3530
|
let u = (t) => {
|
|
3365
3531
|
if (l.cancelled) return;
|
|
3366
|
-
let n = t - c, r = Math.min(n / i, 1), a =
|
|
3532
|
+
let n = t - c, r = Math.min(n / i, 1), a = Jt(r), d = s + (o - s) * a;
|
|
3367
3533
|
if (p.current = d, w(d), r < 1) m.current = requestAnimationFrame(u);
|
|
3368
3534
|
else if (!l.cancelled) {
|
|
3369
3535
|
let t = T(d), n = e[t];
|
|
@@ -3389,11 +3555,11 @@ var L = {
|
|
|
3389
3555
|
prompt: "cos-prompt-Y4hVD",
|
|
3390
3556
|
cursor: "cos-cursor-m8hGi",
|
|
3391
3557
|
blink: "cos-blink-XykM7"
|
|
3392
|
-
},
|
|
3558
|
+
}, Xt = [
|
|
3393
3559
|
"Hello, cos-design!",
|
|
3394
3560
|
"欢迎来到组件库 ✨",
|
|
3395
3561
|
"Build something fun 🚀"
|
|
3396
|
-
],
|
|
3562
|
+
], Zt = ({ texts: e, speed: t, deleteSpeed: r, pause: i }) => {
|
|
3397
3563
|
let [a, o] = s(""), [c, d] = s(0), [f, p] = s(!1);
|
|
3398
3564
|
return n(() => {
|
|
3399
3565
|
let n = e[c % e.length], s;
|
|
@@ -3441,9 +3607,9 @@ var L = {
|
|
|
3441
3607
|
})]
|
|
3442
3608
|
})
|
|
3443
3609
|
});
|
|
3444
|
-
},
|
|
3445
|
-
let i = e.length > 0 ? e :
|
|
3446
|
-
return /* @__PURE__ */ l(
|
|
3610
|
+
}, Qt = ({ texts: e = Xt, speed: t = 100, deleteSpeed: n = 50, pause: r = 2e3 }) => {
|
|
3611
|
+
let i = e.length > 0 ? e : Xt;
|
|
3612
|
+
return /* @__PURE__ */ l(Zt, {
|
|
3447
3613
|
texts: i,
|
|
3448
3614
|
speed: t,
|
|
3449
3615
|
deleteSpeed: n,
|
|
@@ -3455,7 +3621,7 @@ var L = {
|
|
|
3455
3621
|
label: "cos-label-9BHOU",
|
|
3456
3622
|
wave: "cos-wave-GycLU",
|
|
3457
3623
|
ripple: "cos-ripple-5ZFpr"
|
|
3458
|
-
},
|
|
3624
|
+
}, $t = ({ text: e = "点我试试", color: t = "#38bdf8", className: n, style: r, ...i }) => /* @__PURE__ */ l("div", {
|
|
3459
3625
|
className: $.waveButton,
|
|
3460
3626
|
children: /* @__PURE__ */ u("button", {
|
|
3461
3627
|
type: "button",
|
|
@@ -3474,7 +3640,7 @@ var L = {
|
|
|
3474
3640
|
})
|
|
3475
3641
|
]
|
|
3476
3642
|
})
|
|
3477
|
-
}),
|
|
3643
|
+
}), en = 39, tn = {
|
|
3478
3644
|
0: "sunny",
|
|
3479
3645
|
1: "sunny",
|
|
3480
3646
|
2: "partlyCloudy",
|
|
@@ -3482,15 +3648,15 @@ var L = {
|
|
|
3482
3648
|
45: "fog",
|
|
3483
3649
|
48: "fog",
|
|
3484
3650
|
51: "lightRain",
|
|
3485
|
-
53: "
|
|
3651
|
+
53: "moderateRain",
|
|
3486
3652
|
55: "moderateRain",
|
|
3487
|
-
56: "
|
|
3488
|
-
57: "
|
|
3653
|
+
56: "lightRain",
|
|
3654
|
+
57: "moderateRain",
|
|
3489
3655
|
61: "lightRain",
|
|
3490
3656
|
63: "moderateRain",
|
|
3491
3657
|
65: "heavyRain",
|
|
3492
|
-
66: "
|
|
3493
|
-
67: "
|
|
3658
|
+
66: "lightRain",
|
|
3659
|
+
67: "heavyRain",
|
|
3494
3660
|
71: "lightSnow",
|
|
3495
3661
|
73: "moderateSnow",
|
|
3496
3662
|
75: "heavySnow",
|
|
@@ -3501,28 +3667,28 @@ var L = {
|
|
|
3501
3667
|
85: "lightSnow",
|
|
3502
3668
|
86: "heavySnow",
|
|
3503
3669
|
95: "thunderstorm",
|
|
3504
|
-
96: "
|
|
3505
|
-
99: "
|
|
3506
|
-
},
|
|
3507
|
-
let n =
|
|
3508
|
-
return (n === "sunny" || n === "partlyCloudy" || n === "overcast") && t >=
|
|
3509
|
-
},
|
|
3670
|
+
96: "hail",
|
|
3671
|
+
99: "hail"
|
|
3672
|
+
}, nn = (e, t = 0) => {
|
|
3673
|
+
let n = tn[e] ?? "overcast";
|
|
3674
|
+
return (n === "sunny" || n === "partlyCloudy" || n === "overcast") && t >= en ? "gale" : n;
|
|
3675
|
+
}, rn = {
|
|
3510
3676
|
weather: null,
|
|
3511
3677
|
status: "idle",
|
|
3512
3678
|
error: null,
|
|
3513
3679
|
current: null
|
|
3514
|
-
},
|
|
3680
|
+
}, an = {
|
|
3515
3681
|
weather: null,
|
|
3516
3682
|
status: "locating",
|
|
3517
3683
|
error: null,
|
|
3518
3684
|
current: null
|
|
3519
|
-
},
|
|
3685
|
+
}, on = {
|
|
3520
3686
|
weather: null,
|
|
3521
3687
|
status: "fetching",
|
|
3522
3688
|
error: null,
|
|
3523
3689
|
current: null
|
|
3524
|
-
},
|
|
3525
|
-
let r =
|
|
3690
|
+
}, sn = (e) => e != null && Number.isFinite(e.latitude) && Number.isFinite(e.longitude), cn = (e = !0, t) => {
|
|
3691
|
+
let r = sn(t), i = r ? t.latitude : null, a = r ? t.longitude : null, o = e ? r ? on : an : rn, c = `${e}:${i},${a}`, [l, u] = s(o), [d, f] = s(c);
|
|
3526
3692
|
return d !== c && (f(c), u((t) => e && t.weather ? {
|
|
3527
3693
|
...o,
|
|
3528
3694
|
weather: t.weather,
|
|
@@ -3542,7 +3708,7 @@ var L = {
|
|
|
3542
3708
|
let c = Number(o?.current?.wind_speed_10m ?? 0);
|
|
3543
3709
|
if (t) return;
|
|
3544
3710
|
u({
|
|
3545
|
-
weather:
|
|
3711
|
+
weather: nn(s, c),
|
|
3546
3712
|
status: "success",
|
|
3547
3713
|
error: null,
|
|
3548
3714
|
current: {
|
|
@@ -3597,13 +3763,192 @@ var L = {
|
|
|
3597
3763
|
i,
|
|
3598
3764
|
a
|
|
3599
3765
|
]), l;
|
|
3600
|
-
}
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
}
|
|
3766
|
+
};
|
|
3767
|
+
//#endregion
|
|
3768
|
+
//#region src/components/weatherBackground/scene/draw-atmosphere.ts
|
|
3769
|
+
function ln(e) {
|
|
3770
|
+
let t = e.activeWeather === "gale" ? 7 : 1;
|
|
3771
|
+
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
|
+
}
|
|
3773
|
+
function un(e) {
|
|
3774
|
+
let t = e.fogSprite;
|
|
3775
|
+
if (!t || e.state.fogBanks.length === 0) return;
|
|
3776
|
+
let { canvas: n, baseR: r } = t;
|
|
3777
|
+
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
|
+
}
|
|
3779
|
+
function dn(e) {
|
|
3780
|
+
if (e.cfg.haze <= 0) return;
|
|
3781
|
+
let t = e.activeWeather === "smog" ? "177, 164, 135" : "220, 226, 232";
|
|
3782
|
+
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
|
+
}
|
|
3784
|
+
//#endregion
|
|
3785
|
+
//#region src/components/weatherBackground/lightning.ts
|
|
3786
|
+
function fn(e, t, n, r, i, a) {
|
|
3787
|
+
if (a <= 0) return [[e, t], [n, r]];
|
|
3788
|
+
let o = (e + n) / 2 + (Math.random() - .5) * i, s = (t + r) / 2, c = fn(e, t, o, s, i * .55, a - 1), l = fn(o, s, n, r, i * .55, a - 1);
|
|
3789
|
+
return [...c.slice(0, -1), ...l];
|
|
3790
|
+
}
|
|
3791
|
+
//#endregion
|
|
3792
|
+
//#region src/components/weatherBackground/scene/draw-effects.ts
|
|
3793
|
+
function pn(e) {
|
|
3794
|
+
if (e.state.windStreaks.length !== 0) for (let t of e.state.windStreaks) {
|
|
3795
|
+
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
|
+
let n = Math.sin(t.wave) * 8, r = t.x + t.length;
|
|
3797
|
+
if (e.ctx.beginPath(), e.ctx.moveTo(t.x, t.y), e.ctx.bezierCurveTo(t.x + t.length * .3, t.y + n, t.x + t.length * .7, t.y - n, r, t.y), e.ctx.strokeStyle = `rgba(235, 244, 250, ${t.alpha})`, e.ctx.lineWidth = t.width, e.ctx.lineCap = "round", e.ctx.stroke(), t.length > 100) {
|
|
3798
|
+
let r = t.x + t.length * .58, i = t.y - n * .4;
|
|
3799
|
+
e.ctx.save(), e.ctx.translate(r, i), e.ctx.rotate(t.wave * 2), e.ctx.beginPath(), e.ctx.ellipse(0, 0, 4, 1.6, 0, 0, Math.PI * 2), e.ctx.fillStyle = `rgba(91, 76, 52, ${t.alpha * 1.6})`, e.ctx.fill(), e.ctx.restore();
|
|
3800
|
+
}
|
|
3801
|
+
}
|
|
3802
|
+
}
|
|
3803
|
+
function mn(e) {
|
|
3804
|
+
if (e.cfg.lightning) {
|
|
3805
|
+
if (e.state.t >= e.state.nextStrike) {
|
|
3806
|
+
e.state.nextStrike = e.state.t + 150 + Math.random() * 300, e.state.flashAlpha = .5, e.state.boltLife = 9;
|
|
3807
|
+
let t = e.width * (.15 + Math.random() * .7);
|
|
3808
|
+
e.state.boltPoints = fn(t, e.height * .12, t + (Math.random() - .5) * e.width * .2, e.height * .92, 60, 6);
|
|
3809
|
+
}
|
|
3810
|
+
if (e.state.boltLife > 0) {
|
|
3811
|
+
--e.state.boltLife;
|
|
3812
|
+
let t = e.state.boltLife / 9;
|
|
3813
|
+
e.ctx.beginPath(), e.state.boltPoints.forEach(([t, n], r) => r === 0 ? e.ctx.moveTo(t, n) : e.ctx.lineTo(t, n)), e.ctx.strokeStyle = `rgba(240, 246, 255, ${t})`, e.ctx.lineWidth = 2.4, e.ctx.shadowColor = "#bcd7ff", e.ctx.shadowBlur = 16, e.ctx.stroke(), e.ctx.shadowBlur = 0;
|
|
3814
|
+
}
|
|
3815
|
+
e.state.flashAlpha > .01 && (e.ctx.fillStyle = `rgba(226, 236, 255, ${e.state.flashAlpha})`, e.ctx.fillRect(0, 0, e.width, e.height), e.state.flashAlpha *= .82);
|
|
3816
|
+
}
|
|
3817
|
+
}
|
|
3818
|
+
//#endregion
|
|
3819
|
+
//#region src/components/weatherBackground/sprites/hail.ts
|
|
3820
|
+
var hn = 3.2, gn = (e) => {
|
|
3821
|
+
let t = Math.ceil(e * 2.8 + 4), n = document.createElement("canvas");
|
|
3822
|
+
n.width = t, n.height = t;
|
|
3823
|
+
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) => {
|
|
3824
|
+
let r = n / o * Math.PI * 2 + (Math.random() - .5) * .22, s = e * (.72 + Math.random() * .44);
|
|
3825
|
+
return {
|
|
3826
|
+
x: i + Math.cos(r) * s,
|
|
3827
|
+
y: a + Math.sin(r) * s
|
|
3828
|
+
};
|
|
3829
|
+
}), c = (e, t) => ({
|
|
3830
|
+
x: (e.x + t.x) / 2,
|
|
3831
|
+
y: (e.y + t.y) / 2
|
|
3832
|
+
});
|
|
3833
|
+
r.beginPath();
|
|
3834
|
+
let l = c(s[s.length - 1], s[0]);
|
|
3835
|
+
r.moveTo(l.x, l.y);
|
|
3836
|
+
for (let e = 0; e < s.length; e++) {
|
|
3837
|
+
let t = c(s[e], s[(e + 1) % s.length]);
|
|
3838
|
+
r.quadraticCurveTo(s[e].x, s[e].y, t.x, t.y);
|
|
3839
|
+
}
|
|
3840
|
+
r.closePath();
|
|
3841
|
+
let u = i - e * .3, d = a - e * .34, f = r.createRadialGradient(u, d, e * .06, i, a, e * 1.2);
|
|
3842
|
+
f.addColorStop(0, "rgba(255, 255, 255, 0.98)"), f.addColorStop(.42, "rgba(228, 241, 252, 0.96)"), f.addColorStop(.82, "rgba(176, 203, 224, 0.93)"), f.addColorStop(1, "rgba(130, 162, 188, 0.9)"), r.fillStyle = f, r.fill(), r.strokeStyle = "rgba(155, 190, 215, 0.62)", r.lineWidth = Math.max(.45, e * .11), r.stroke();
|
|
3843
|
+
let p = 1 + Math.floor(Math.random() * 2);
|
|
3844
|
+
for (let t = 0; t < p; t++) {
|
|
3845
|
+
let t = Math.random() * Math.PI * 2, n = i + Math.cos(t) * e * (.28 + Math.random() * .35), o = a + Math.sin(t) * e * (.28 + Math.random() * .35);
|
|
3846
|
+
r.beginPath(), r.ellipse(n, o, e * (.14 + Math.random() * .1), e * (.1 + Math.random() * .08), t, 0, Math.PI * 2), r.fillStyle = "rgba(105, 135, 165, 0.28)", r.fill();
|
|
3847
|
+
}
|
|
3848
|
+
if (Math.random() < .75) {
|
|
3849
|
+
let t = Math.random() * Math.PI * 2, n = i + Math.cos(t) * e * (.38 + Math.random() * .28), o = a + Math.sin(t) * e * (.38 + Math.random() * .28);
|
|
3850
|
+
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
|
+
}
|
|
3852
|
+
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
|
+
}, _n = (e = 16) => Array.from({ length: e }, () => gn(hn)), vn = (e) => e[Math.floor(Math.random() * e.length)], yn = (e, t, n, r, i = !0) => {
|
|
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 = vn(r), e.drawSize = e.r * 2.8 + 4, e.rotation = Math.random() * Math.PI * 2, e.rotationSpeed = (Math.random() - .5) * .06;
|
|
3855
|
+
}, bn = (e, t, n) => {
|
|
3856
|
+
let r = {
|
|
3857
|
+
x: 0,
|
|
3858
|
+
y: 0,
|
|
3859
|
+
r: 2,
|
|
3860
|
+
vx: 0,
|
|
3861
|
+
vy: 0,
|
|
3862
|
+
bounces: 0,
|
|
3863
|
+
opacity: 1,
|
|
3864
|
+
delay: 0,
|
|
3865
|
+
gravity: .16,
|
|
3866
|
+
phase: 0,
|
|
3867
|
+
gust: 0,
|
|
3868
|
+
maxBounces: 1,
|
|
3869
|
+
sprite: n[0],
|
|
3870
|
+
drawSize: 9.6,
|
|
3871
|
+
rotation: 0,
|
|
3872
|
+
rotationSpeed: 0
|
|
3873
|
+
};
|
|
3874
|
+
return yn(r, e, t, n, Math.random() < .72), r;
|
|
3875
|
+
};
|
|
3876
|
+
//#endregion
|
|
3877
|
+
//#region src/components/weatherBackground/scene/draw-precipitation.ts
|
|
3878
|
+
function xn(e) {
|
|
3879
|
+
if (!e.cfg.rain) return;
|
|
3880
|
+
let { wind: t, alpha: n, splash: r } = e.cfg.rain;
|
|
3881
|
+
e.ctx.strokeStyle = `rgba(214, 228, 240, ${n})`, e.ctx.lineWidth = 1.2, e.ctx.beginPath();
|
|
3882
|
+
for (let n of e.state.drops) {
|
|
3883
|
+
let i = Math.hypot(t, n.speed) || 1, a = t / i, o = n.speed / i;
|
|
3884
|
+
e.ctx.moveTo(n.x, n.y), e.ctx.lineTo(n.x + a * n.len, n.y + o * n.len), n.x += t, n.y += n.speed, n.y > e.height && (r && Math.random() < .3 && e.state.splashes.length < 60 && e.state.splashes.push({
|
|
3885
|
+
x: n.x,
|
|
3886
|
+
r: 1,
|
|
3887
|
+
alpha: .5
|
|
3888
|
+
}), n.y = -n.len, n.x = Math.random() * (e.width + 160) - 80);
|
|
3889
|
+
}
|
|
3890
|
+
e.ctx.stroke();
|
|
3891
|
+
for (let t = e.state.splashes.length - 1; t >= 0; t--) {
|
|
3892
|
+
let n = e.state.splashes[t];
|
|
3893
|
+
if (n.r += .8, n.alpha -= .035, n.alpha <= 0) {
|
|
3894
|
+
e.state.splashes.splice(t, 1);
|
|
3895
|
+
continue;
|
|
3896
|
+
}
|
|
3897
|
+
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
|
+
}
|
|
3899
|
+
}
|
|
3900
|
+
function Sn(e) {
|
|
3901
|
+
for (let t of e.state.flakes) {
|
|
3902
|
+
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
|
+
let n = t.drawSize / 2;
|
|
3904
|
+
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
|
+
}
|
|
3906
|
+
}
|
|
3907
|
+
function Cn(e) {
|
|
3908
|
+
if (e.state.hailstones.length === 0) return;
|
|
3909
|
+
let t = e.state.hailPool;
|
|
3910
|
+
for (let n of e.state.hailstones) {
|
|
3911
|
+
if (n.delay > 0) {
|
|
3912
|
+
--n.delay;
|
|
3913
|
+
continue;
|
|
3914
|
+
}
|
|
3915
|
+
let r = n.x, i = n.y;
|
|
3916
|
+
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
|
+
else {
|
|
3918
|
+
yn(n, e.width, e.height, t, !0);
|
|
3919
|
+
continue;
|
|
3920
|
+
}
|
|
3921
|
+
let a = n.drawSize / 2;
|
|
3922
|
+
n.rotation += n.rotationSpeed, e.ctx.save(), e.ctx.globalAlpha = n.opacity, e.ctx.translate(n.x, n.y), e.ctx.rotate(n.rotation), e.ctx.drawImage(n.sprite, -a, -a, n.drawSize, n.drawSize), e.ctx.restore();
|
|
3923
|
+
}
|
|
3924
|
+
}
|
|
3925
|
+
//#endregion
|
|
3926
|
+
//#region src/components/weatherBackground/scene/draw-sky.ts
|
|
3927
|
+
function wn(e) {
|
|
3928
|
+
e.ctx.fillStyle = e.skyGradient, e.ctx.fillRect(0, 0, e.width, e.height);
|
|
3929
|
+
}
|
|
3930
|
+
function Tn(e) {
|
|
3931
|
+
if (e.state.stars.length !== 0) for (let t of e.state.stars) {
|
|
3932
|
+
let n = .35 + (Math.sin(e.state.t * t.speed + t.phase) + 1) * .325;
|
|
3933
|
+
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
|
+
}
|
|
3935
|
+
}
|
|
3936
|
+
function En(e) {
|
|
3937
|
+
let t = e.celestial;
|
|
3938
|
+
if (!t) return;
|
|
3939
|
+
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
|
+
n.drawImage(t.canvas, r - s, i - s, c, c);
|
|
3941
|
+
}
|
|
3942
|
+
function Dn(e) {
|
|
3943
|
+
if (e.activeNight) {
|
|
3944
|
+
Tn(e), En(e);
|
|
3945
|
+
return;
|
|
3946
|
+
}
|
|
3947
|
+
En(e);
|
|
3948
|
+
}
|
|
3949
|
+
//#endregion
|
|
3950
|
+
//#region src/components/weatherBackground/configs.ts
|
|
3951
|
+
var On = {
|
|
3607
3952
|
sunny: {
|
|
3608
3953
|
sky: ["#4a9fe0", "#c8e8fb"],
|
|
3609
3954
|
sun: "full",
|
|
@@ -3912,7 +4257,9 @@ var L = {
|
|
|
3912
4257
|
snowCount: 160,
|
|
3913
4258
|
lightning: !1
|
|
3914
4259
|
}
|
|
3915
|
-
}
|
|
4260
|
+
};
|
|
4261
|
+
On.snow = On.moderateSnow;
|
|
4262
|
+
var kn = {
|
|
3916
4263
|
sunny: {
|
|
3917
4264
|
sky: ["#0b1a33", "#27476e"],
|
|
3918
4265
|
stars: 110
|
|
@@ -3977,16 +4324,150 @@ var L = {
|
|
|
3977
4324
|
sky: ["#131a26", "#333f4f"],
|
|
3978
4325
|
stars: 8
|
|
3979
4326
|
}
|
|
3980
|
-
}
|
|
4327
|
+
};
|
|
4328
|
+
kn.snow = kn.moderateSnow;
|
|
4329
|
+
var An = ([e, t, n]) => [
|
|
3981
4330
|
Math.round(e * .3 + 18),
|
|
3982
4331
|
Math.round(t * .3 + 24),
|
|
3983
4332
|
Math.round(n * .3 + 42)
|
|
3984
|
-
]
|
|
4333
|
+
];
|
|
4334
|
+
//#endregion
|
|
4335
|
+
//#region src/components/weatherBackground/sprites/cloud.ts
|
|
4336
|
+
function jn(e, t, n, r) {
|
|
4337
|
+
let [i, a, o] = n, s = Infinity, c = Infinity, l = -Infinity, u = -Infinity;
|
|
4338
|
+
for (let n of t) {
|
|
4339
|
+
let t = n.dx * e, r = n.dy * e, i = n.r * e;
|
|
4340
|
+
s = Math.min(s, t - i), c = Math.min(c, r - i), l = Math.max(l, t + i), u = Math.max(u, r + i);
|
|
4341
|
+
}
|
|
4342
|
+
let d = Math.floor(s - 2), f = Math.floor(c - 2), p = Math.ceil(l + 2) - d, m = Math.ceil(u + 2) - f, h = document.createElement("canvas");
|
|
4343
|
+
h.width = p, h.height = m;
|
|
4344
|
+
let g = h.getContext("2d");
|
|
4345
|
+
for (let n of t) {
|
|
4346
|
+
let t = n.dx * e - d, s = n.dy * e - f, c = n.r * e, l = g.createRadialGradient(t, s, 0, t, s, c);
|
|
4347
|
+
l.addColorStop(0, `rgba(${i}, ${a}, ${o}, ${r})`), l.addColorStop(1, `rgba(${i}, ${a}, ${o}, 0)`), g.beginPath(), g.arc(t, s, c, 0, Math.PI * 2), g.fillStyle = l, g.fill();
|
|
4348
|
+
}
|
|
4349
|
+
return {
|
|
4350
|
+
sprite: h,
|
|
4351
|
+
ox: d,
|
|
4352
|
+
oy: f
|
|
4353
|
+
};
|
|
4354
|
+
}
|
|
4355
|
+
function Mn(e, t, n, r, i) {
|
|
4356
|
+
let a = .7 + Math.random() * .9, o = 4 + Math.floor(Math.random() * 3), s = Array.from({ length: o }, (e, t) => ({
|
|
4357
|
+
dx: (t - o / 2) * 26 + (Math.random() - .5) * 14,
|
|
4358
|
+
dy: (Math.random() - .5) * 14,
|
|
4359
|
+
r: 22 + Math.random() * 20
|
|
4360
|
+
})), { sprite: c, ox: l, oy: u } = jn(a, s, r, i);
|
|
4361
|
+
return {
|
|
4362
|
+
x: Math.random() * (e + 240) - 120,
|
|
4363
|
+
y: t * .06 + Math.random() * t * n,
|
|
4364
|
+
scale: a,
|
|
4365
|
+
speed: .12 + Math.random() * .22,
|
|
4366
|
+
puffs: s,
|
|
4367
|
+
sprite: c,
|
|
4368
|
+
ox: l,
|
|
4369
|
+
oy: u
|
|
4370
|
+
};
|
|
4371
|
+
}
|
|
4372
|
+
function Nn(e, t = 120) {
|
|
4373
|
+
let n = t * 2, r = document.createElement("canvas");
|
|
4374
|
+
r.width = n, r.height = n;
|
|
4375
|
+
let i = r.getContext("2d"), a = i.createRadialGradient(t, t, 0, t, t, t);
|
|
4376
|
+
return a.addColorStop(0, `rgba(${e}, 1)`), a.addColorStop(1, `rgba(${e}, 0)`), i.fillStyle = a, i.beginPath(), i.arc(t, t, t, 0, Math.PI * 2), i.fill(), {
|
|
4377
|
+
canvas: r,
|
|
4378
|
+
baseR: t
|
|
4379
|
+
};
|
|
4380
|
+
}
|
|
4381
|
+
//#endregion
|
|
4382
|
+
//#region src/components/weatherBackground/sprites/celestial.ts
|
|
4383
|
+
function Pn(e, t) {
|
|
4384
|
+
let n = e.sun;
|
|
4385
|
+
if (n === "none") return null;
|
|
4386
|
+
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;
|
|
4387
|
+
n === "full" && (o = Math.max(o, 1.55 * t * 5.5)), o = Math.ceil(o + 2);
|
|
4388
|
+
let s = o * 2, c = document.createElement("canvas");
|
|
4389
|
+
c.width = s, c.height = s;
|
|
4390
|
+
let l = c.getContext("2d"), u = o, d = o;
|
|
4391
|
+
l.save(), l.globalCompositeOperation = "lighter";
|
|
4392
|
+
let f = l.createRadialGradient(u, d, 0, u, d, a);
|
|
4393
|
+
f.addColorStop(0, `rgba(255, 230, 170, ${.14 * r})`), f.addColorStop(.22, `rgba(255, 210, 140, ${.07 * r})`), f.addColorStop(.5, `rgba(255, 195, 120, ${.03 * r})`), f.addColorStop(1, "rgba(255, 200, 130, 0)"), l.fillStyle = f, l.fillRect(0, 0, s, s);
|
|
4394
|
+
let p = t * (n === "full" ? 3.4 : 2.6), m = l.createRadialGradient(u, d, i * .15, u, d, p);
|
|
4395
|
+
if (m.addColorStop(0, `rgba(255, 240, 200, ${.32 * r})`), m.addColorStop(.4, `rgba(255, 220, 150, ${.16 * r})`), m.addColorStop(.75, `rgba(255, 200, 120, ${.05 * r})`), m.addColorStop(1, "rgba(255, 190, 110, 0)"), l.fillStyle = m, l.beginPath(), l.arc(u, d, p, 0, Math.PI * 2), l.fill(), n === "full") {
|
|
4396
|
+
l.translate(u, d), l.scale(1.55, .55);
|
|
4397
|
+
let e = l.createRadialGradient(0, 0, 0, 0, 0, t * 5.5);
|
|
4398
|
+
e.addColorStop(0, "rgba(255, 225, 170, 0.08)"), e.addColorStop(.5, "rgba(255, 205, 140, 0.03)"), e.addColorStop(1, "rgba(255, 195, 130, 0)"), l.fillStyle = e, l.beginPath(), l.arc(0, 0, t * 5.5, 0, Math.PI * 2), l.fill();
|
|
4399
|
+
}
|
|
4400
|
+
l.restore();
|
|
4401
|
+
let h = i * 2.05, g = l.createRadialGradient(u, d, 0, u, d, h);
|
|
4402
|
+
g.addColorStop(0, `rgba(255, 245, 210, ${.7 * r})`), g.addColorStop(.4, `rgba(255, 230, 170, ${.35 * r})`), g.addColorStop(.75, `rgba(255, 210, 140, ${.1 * r})`), g.addColorStop(1, "rgba(255, 200, 130, 0)"), l.fillStyle = g, l.beginPath(), l.arc(u, d, h, 0, Math.PI * 2), l.fill();
|
|
4403
|
+
let _ = l.createRadialGradient(u, d, 0, u, d, i);
|
|
4404
|
+
return n === "dim" ? (_.addColorStop(0, `rgba(255, 240, 210, ${.5 * r})`), _.addColorStop(.55, `rgba(255, 220, 170, ${.3 * r})`), _.addColorStop(1, "rgba(255, 200, 140, 0)")) : (_.addColorStop(0, `rgba(255, 250, 230, ${.98 * r})`), _.addColorStop(.4, `rgba(255, 240, 195, ${.92 * r})`), _.addColorStop(.75, `rgba(255, 220, 150, ${.55 * r})`), _.addColorStop(1, "rgba(255, 205, 130, 0)")), l.fillStyle = _, l.beginPath(), l.arc(u, d, i, 0, Math.PI * 2), l.fill(), {
|
|
4405
|
+
canvas: c,
|
|
4406
|
+
half: o,
|
|
4407
|
+
breathSpeed: .018,
|
|
4408
|
+
breathAmp: .018
|
|
4409
|
+
};
|
|
4410
|
+
}
|
|
4411
|
+
function Fn(e, t, n) {
|
|
4412
|
+
if (e.sun === "none") return null;
|
|
4413
|
+
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
|
+
l.width = c, l.height = c;
|
|
4415
|
+
let u = l.getContext("2d"), d = s, f = s;
|
|
4416
|
+
u.save(), u.globalCompositeOperation = "lighter";
|
|
4417
|
+
let p = u.createRadialGradient(d, f, 0, d, f, o);
|
|
4418
|
+
p.addColorStop(0, `rgba(200, 215, 240, ${.16 * a})`), p.addColorStop(.25, `rgba(170, 190, 225, ${.07 * a})`), p.addColorStop(.55, `rgba(140, 165, 210, ${.025 * a})`), p.addColorStop(1, "rgba(130, 155, 200, 0)"), u.fillStyle = p, u.fillRect(0, 0, c, c);
|
|
4419
|
+
let m = r * 2.6, h = u.createRadialGradient(d, f, r * .2, d, f, m);
|
|
4420
|
+
h.addColorStop(0, `rgba(230, 236, 248, ${.28 * a})`), h.addColorStop(.45, `rgba(190, 205, 230, ${.12 * a})`), h.addColorStop(1, "rgba(160, 180, 220, 0)"), u.fillStyle = h, u.beginPath(), u.arc(d, f, m, 0, Math.PI * 2), u.fill(), u.restore();
|
|
4421
|
+
let g = u.createRadialGradient(d - r * .28, f - r * .3, 0, d, f, r);
|
|
4422
|
+
g.addColorStop(0, `rgba(236, 240, 246, ${.96 * a})`), g.addColorStop(.45, `rgba(214, 220, 230, ${.94 * a})`), g.addColorStop(.82, `rgba(186, 196, 212, ${.9 * a})`), g.addColorStop(1, `rgba(160, 172, 192, ${.75 * a})`), u.beginPath(), u.arc(d, f, r, 0, Math.PI * 2), u.fillStyle = g, u.fill(), u.save(), u.beginPath(), u.arc(d, f, r * .98, 0, Math.PI * 2), u.clip();
|
|
4423
|
+
for (let e of [
|
|
4424
|
+
{
|
|
4425
|
+
dx: -.18,
|
|
4426
|
+
dy: .12,
|
|
4427
|
+
rx: .38,
|
|
4428
|
+
ry: .28,
|
|
4429
|
+
a: .14
|
|
4430
|
+
},
|
|
4431
|
+
{
|
|
4432
|
+
dx: .22,
|
|
4433
|
+
dy: -.08,
|
|
4434
|
+
rx: .26,
|
|
4435
|
+
ry: .2,
|
|
4436
|
+
a: .11
|
|
4437
|
+
},
|
|
4438
|
+
{
|
|
4439
|
+
dx: .05,
|
|
4440
|
+
dy: .32,
|
|
4441
|
+
rx: .2,
|
|
4442
|
+
ry: .14,
|
|
4443
|
+
a: .09
|
|
4444
|
+
}
|
|
4445
|
+
]) {
|
|
4446
|
+
let t = d + e.dx * r, n = f + e.dy * r, i = u.createRadialGradient(t, n, 0, t, n, e.rx * r);
|
|
4447
|
+
i.addColorStop(0, `rgba(140, 152, 170, ${e.a * a})`), i.addColorStop(.65, `rgba(150, 162, 178, ${e.a * .45 * a})`), i.addColorStop(1, "rgba(160, 170, 185, 0)"), u.fillStyle = i, u.beginPath(), u.ellipse(t, n, e.rx * r, e.ry * r, .35, 0, Math.PI * 2), u.fill();
|
|
4448
|
+
}
|
|
4449
|
+
for (let e of n) {
|
|
4450
|
+
let t = d + e.dx * r, n = f + e.dy * r, i = e.r * r, o = u.createRadialGradient(t - i * .25, n - i * .3, 0, t, n, i);
|
|
4451
|
+
o.addColorStop(0, `rgba(155, 168, 186, ${.22 * a})`), o.addColorStop(.55, `rgba(145, 158, 176, ${.28 * a})`), o.addColorStop(.85, `rgba(200, 210, 224, ${.12 * a})`), o.addColorStop(1, "rgba(210, 218, 230, 0)"), u.fillStyle = o, u.beginPath(), u.arc(t, n, i, 0, Math.PI * 2), u.fill();
|
|
4452
|
+
}
|
|
4453
|
+
let _ = u.createRadialGradient(d - r * .35, f - r * .38, 0, d - r * .1, f - r * .1, r * .7);
|
|
4454
|
+
_.addColorStop(0, `rgba(255, 255, 255, ${.28 * a})`), _.addColorStop(.45, `rgba(245, 248, 252, ${.08 * a})`), _.addColorStop(1, "rgba(240, 244, 250, 0)"), u.fillStyle = _, u.beginPath(), u.arc(d, f, r, 0, Math.PI * 2), u.fill(), u.restore();
|
|
4455
|
+
let v = u.createRadialGradient(d, f, r * .72, d, f, r * 1.35);
|
|
4456
|
+
return v.addColorStop(0, "rgba(210, 220, 235, 0)"), v.addColorStop(.55, `rgba(200, 212, 232, ${.1 * a})`), v.addColorStop(1, "rgba(180, 195, 220, 0)"), u.fillStyle = v, u.beginPath(), u.arc(d, f, r * 1.35, 0, Math.PI * 2), u.fill(), {
|
|
4457
|
+
canvas: l,
|
|
4458
|
+
half: s,
|
|
4459
|
+
breathSpeed: .012,
|
|
4460
|
+
breathAmp: .012
|
|
4461
|
+
};
|
|
4462
|
+
}
|
|
4463
|
+
//#endregion
|
|
4464
|
+
//#region src/components/weatherBackground/sprites/snow.ts
|
|
4465
|
+
var In = (e) => {
|
|
3985
4466
|
let t = Math.ceil(e * 2 + 4), n = document.createElement("canvas");
|
|
3986
4467
|
n.width = t, n.height = t;
|
|
3987
4468
|
let r = n.getContext("2d"), i = r.createRadialGradient(t / 2, t / 2, 0, t / 2, t / 2, e + 1);
|
|
3988
4469
|
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;
|
|
3989
|
-
},
|
|
4470
|
+
}, Ln = (e) => {
|
|
3990
4471
|
let t = Math.ceil(e * 2 + 6), n = document.createElement("canvas");
|
|
3991
4472
|
n.width = t, n.height = t;
|
|
3992
4473
|
let r = n.getContext("2d");
|
|
@@ -4013,269 +4494,218 @@ var L = {
|
|
|
4013
4494
|
r.closePath(), r.stroke();
|
|
4014
4495
|
}
|
|
4015
4496
|
return n;
|
|
4016
|
-
},
|
|
4017
|
-
|
|
4497
|
+
}, Rn = () => ({
|
|
4498
|
+
dots: [
|
|
4499
|
+
1.2,
|
|
4500
|
+
1.6,
|
|
4501
|
+
2,
|
|
4502
|
+
2.3
|
|
4503
|
+
].map((e) => In(e)),
|
|
4504
|
+
crystals: [
|
|
4505
|
+
2.6,
|
|
4506
|
+
3.2,
|
|
4507
|
+
3.8,
|
|
4508
|
+
4.4,
|
|
4509
|
+
5
|
|
4510
|
+
].map((e) => Ln(e * 2.4))
|
|
4511
|
+
}), zn = (e) => e[Math.floor(Math.random() * e.length)], Bn = (e, t, n, r) => {
|
|
4512
|
+
let i = 1 + Math.random() ** 1.6 * 4.2, a = i >= 2.4, o = zn(a ? n.crystals : n.dots), s = a ? i * 4.8 + 6 : i * 2 + 4;
|
|
4018
4513
|
return {
|
|
4019
4514
|
x: Math.random() * e,
|
|
4020
|
-
y:
|
|
4021
|
-
size:
|
|
4022
|
-
speed: .4 +
|
|
4515
|
+
y: r ?? Math.random() * t,
|
|
4516
|
+
size: i,
|
|
4517
|
+
speed: .4 + i * .28 + Math.random() * .4,
|
|
4023
4518
|
phase: Math.random() * Math.PI * 2,
|
|
4024
4519
|
drift: (Math.random() - .5) * .4,
|
|
4025
4520
|
rotation: Math.random() * Math.PI * 2,
|
|
4026
4521
|
rotationSpeed: (Math.random() - .5) * .025,
|
|
4027
4522
|
opacity: .55 + Math.random() * .45,
|
|
4028
|
-
sprite:
|
|
4523
|
+
sprite: o,
|
|
4524
|
+
drawSize: s
|
|
4029
4525
|
};
|
|
4030
|
-
},
|
|
4031
|
-
|
|
4032
|
-
let
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4526
|
+
}, Vn = (e, t) => t ? e === "smog" ? "96, 88, 66" : "138, 150, 168" : e === "smog" ? "168, 155, 126" : "226, 232, 238";
|
|
4527
|
+
function Hn(e) {
|
|
4528
|
+
let { ctx: t, width: n, height: r, activeWeather: i, activeNight: a } = e, o = On[i], s = kn[i], c = a ? s.sky : o.sky, l = a ? An(o.cloudColor) : o.cloudColor, u = n * .72, d = r * .26, f = Math.min(n, r) * .09, p = t.createLinearGradient(0, 0, 0, r);
|
|
4529
|
+
p.addColorStop(0, c[0]), p.addColorStop(1, c[1]);
|
|
4530
|
+
let m = a ? Array.from({ length: s.stars }, () => ({
|
|
4531
|
+
x: Math.random() * n,
|
|
4532
|
+
y: Math.random() * r * .72,
|
|
4533
|
+
r: .4 + Math.random() * 1.1,
|
|
4534
|
+
phase: Math.random() * Math.PI * 2,
|
|
4535
|
+
speed: .015 + Math.random() * .035
|
|
4536
|
+
})) : [], h = [
|
|
4537
|
+
{
|
|
4538
|
+
dx: -.32,
|
|
4539
|
+
dy: .08,
|
|
4540
|
+
r: .17
|
|
4541
|
+
},
|
|
4542
|
+
{
|
|
4543
|
+
dx: .24,
|
|
4544
|
+
dy: -.22,
|
|
4545
|
+
r: .12
|
|
4546
|
+
},
|
|
4547
|
+
{
|
|
4548
|
+
dx: .04,
|
|
4549
|
+
dy: .34,
|
|
4550
|
+
r: .1
|
|
4551
|
+
},
|
|
4552
|
+
{
|
|
4553
|
+
dx: .36,
|
|
4554
|
+
dy: .24,
|
|
4555
|
+
r: .07
|
|
4556
|
+
}
|
|
4557
|
+
], g = a ? Fn(o, f, h) : Pn(o, f), _ = Array.from({ length: o.cloudCount }, () => Mn(n, r, o.cloudSpread, l, o.cloudAlpha)), v = o.rain ? Array.from({ length: o.rain.count }, () => ({
|
|
4558
|
+
x: Math.random() * (n + 160) - 80,
|
|
4559
|
+
y: Math.random() * r,
|
|
4560
|
+
len: 8 + Math.random() * 10,
|
|
4561
|
+
speed: o.rain.speed * (.75 + Math.random() * .5)
|
|
4562
|
+
})) : [], y = [], b = Array.from({ length: o.fogBanks }, (e, t) => ({
|
|
4563
|
+
x: Math.random() * n,
|
|
4564
|
+
y: t / Math.max(o.fogBanks - 1, 1) * r * .9 + r * .05,
|
|
4565
|
+
rw: n * (.25 + Math.random() * .3),
|
|
4566
|
+
rh: r * (.08 + Math.random() * .08),
|
|
4567
|
+
speed: (.1 + Math.random() * .25) * (t % 2 == 0 ? 1 : -1),
|
|
4568
|
+
alpha: .16 + Math.random() * .14
|
|
4569
|
+
})), x = o.fogBanks > 0 ? Nn(Vn(i, a)) : null, S = o.snowCount > 0 ? Rn() : null, C = S == null ? [] : Array.from({ length: o.snowCount }, () => Bn(n, r, S)), w = i === "hail" ? _n() : null, T = w == null ? [] : Array.from({ length: 145 }, () => bn(n, r, w)), E = i === "gale" ? Array.from({ length: 46 }, () => ({
|
|
4570
|
+
x: Math.random() * n,
|
|
4571
|
+
y: Math.random() * r,
|
|
4572
|
+
length: 45 + Math.random() * 130,
|
|
4573
|
+
speed: 8 + Math.random() * 10,
|
|
4574
|
+
wave: Math.random() * Math.PI * 2,
|
|
4575
|
+
alpha: .12 + Math.random() * .3,
|
|
4576
|
+
width: .6 + Math.random() * 1.2
|
|
4577
|
+
})) : [], D = [], O = 120 + Math.random() * 240;
|
|
4578
|
+
return {
|
|
4579
|
+
sky: c,
|
|
4580
|
+
cloudRgb: l,
|
|
4581
|
+
cfg: o,
|
|
4582
|
+
sunX: u,
|
|
4583
|
+
sunY: d,
|
|
4584
|
+
sunR: f,
|
|
4585
|
+
skyGradient: p,
|
|
4586
|
+
celestial: g,
|
|
4587
|
+
fogSprite: x,
|
|
4588
|
+
state: {
|
|
4589
|
+
stars: m,
|
|
4590
|
+
moonCraters: h,
|
|
4591
|
+
clouds: _,
|
|
4592
|
+
drops: v,
|
|
4593
|
+
splashes: y,
|
|
4594
|
+
fogBanks: b,
|
|
4595
|
+
flakes: C,
|
|
4596
|
+
hailstones: T,
|
|
4597
|
+
hailPool: w ?? [],
|
|
4598
|
+
windStreaks: E,
|
|
4599
|
+
t: 0,
|
|
4600
|
+
flashAlpha: 0,
|
|
4601
|
+
boltLife: 0,
|
|
4602
|
+
boltPoints: D,
|
|
4603
|
+
nextStrike: O
|
|
4604
|
+
}
|
|
4605
|
+
};
|
|
4606
|
+
}
|
|
4607
|
+
//#endregion
|
|
4608
|
+
//#region src/components/weatherBackground/scene/create-weather-scene.ts
|
|
4609
|
+
function Un(e, t) {
|
|
4610
|
+
t && (e.state.t += 1), wn(e), Dn(e), ln(e), un(e), dn(e), xn(e), Sn(e), Cn(e), pn(e), mn(e);
|
|
4611
|
+
}
|
|
4612
|
+
function Wn(e) {
|
|
4613
|
+
let { ctx: t, width: n, height: r, activeWeather: i, activeNight: a } = e, o = {
|
|
4614
|
+
ctx: t,
|
|
4615
|
+
width: n,
|
|
4616
|
+
height: r,
|
|
4617
|
+
activeWeather: i,
|
|
4618
|
+
activeNight: a,
|
|
4619
|
+
...Hn(e)
|
|
4620
|
+
};
|
|
4621
|
+
if (typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return Un(o, !1), () => void 0;
|
|
4622
|
+
let s = 0, c = document.hidden, l = v((e) => {
|
|
4623
|
+
c = e;
|
|
4624
|
+
}), u = () => {
|
|
4625
|
+
s = requestAnimationFrame(u), !c && Un(o, !0);
|
|
4626
|
+
};
|
|
4627
|
+
return u(), () => {
|
|
4628
|
+
cancelAnimationFrame(s), l();
|
|
4629
|
+
};
|
|
4630
|
+
}
|
|
4631
|
+
var Gn = {
|
|
4632
|
+
weatherBackground: "cos-weatherBackground-Mnm22",
|
|
4633
|
+
canvas: "cos-canvas-nvqMt",
|
|
4634
|
+
loadingOverlay: "cos-loadingOverlay-O58B7",
|
|
4635
|
+
loadingSpinner: "cos-loadingSpinner-NQ9yG",
|
|
4636
|
+
"weather-loading-spin": "cos-weather-loading-spin-IPFWZ"
|
|
4637
|
+
}, Kn = ({ width: e = 800, height: t = 450, weather: r = "sunny", night: i = !1, live: a = !1, latitude: s, longitude: c, onLiveWeather: d, loading: f = !1 }) => {
|
|
4638
|
+
let p = o(null), m = cn(a, s != null && c != null ? {
|
|
4036
4639
|
latitude: s,
|
|
4037
4640
|
longitude: c
|
|
4038
|
-
} : 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"),
|
|
4641
|
+
} : 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);
|
|
4039
4642
|
return n(() => {
|
|
4040
|
-
|
|
4643
|
+
v.current = d;
|
|
4041
4644
|
}), n(() => {
|
|
4042
|
-
m.weather &&
|
|
4645
|
+
m.weather && v.current?.(m.weather);
|
|
4043
4646
|
}, [m.weather]), n(() => {
|
|
4044
4647
|
let n = p.current;
|
|
4045
4648
|
if (!n) return;
|
|
4046
4649
|
let r = window.devicePixelRatio || 1;
|
|
4047
4650
|
n.width = e * r, n.height = t * r;
|
|
4048
4651
|
let i = n.getContext("2d");
|
|
4049
|
-
if (
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
speed: .015 + Math.random() * .035
|
|
4057
|
-
})) : [], m = [
|
|
4058
|
-
{
|
|
4059
|
-
dx: -.32,
|
|
4060
|
-
dy: .08,
|
|
4061
|
-
r: .17
|
|
4062
|
-
},
|
|
4063
|
-
{
|
|
4064
|
-
dx: .24,
|
|
4065
|
-
dy: -.22,
|
|
4066
|
-
r: .12
|
|
4067
|
-
},
|
|
4068
|
-
{
|
|
4069
|
-
dx: .04,
|
|
4070
|
-
dy: .34,
|
|
4071
|
-
r: .1
|
|
4072
|
-
},
|
|
4073
|
-
{
|
|
4074
|
-
dx: .36,
|
|
4075
|
-
dy: .24,
|
|
4076
|
-
r: .07
|
|
4077
|
-
}
|
|
4078
|
-
], _ = Array.from({ length: a.cloudCount }, () => {
|
|
4079
|
-
let n = .7 + Math.random() * .9, r = 4 + Math.floor(Math.random() * 3);
|
|
4080
|
-
return {
|
|
4081
|
-
x: Math.random() * (e + 240) - 120,
|
|
4082
|
-
y: t * .06 + Math.random() * t * a.cloudSpread,
|
|
4083
|
-
scale: n,
|
|
4084
|
-
speed: .12 + Math.random() * .22,
|
|
4085
|
-
puffs: Array.from({ length: r }, (e, t) => ({
|
|
4086
|
-
dx: (t - r / 2) * 26 + (Math.random() - .5) * 14,
|
|
4087
|
-
dy: (Math.random() - .5) * 14,
|
|
4088
|
-
r: 22 + Math.random() * 20
|
|
4089
|
-
}))
|
|
4090
|
-
};
|
|
4091
|
-
}), y = a.rain ? Array.from({ length: a.rain.count }, () => ({
|
|
4092
|
-
x: Math.random() * (e + 160) - 80,
|
|
4093
|
-
y: Math.random() * t,
|
|
4094
|
-
len: 8 + Math.random() * 10,
|
|
4095
|
-
speed: a.rain.speed * (.75 + Math.random() * .5)
|
|
4096
|
-
})) : [], b = [], x = Array.from({ length: a.fogBanks }, (n, r) => ({
|
|
4097
|
-
x: Math.random() * e,
|
|
4098
|
-
y: r / Math.max(a.fogBanks - 1, 1) * t * .9 + t * .05,
|
|
4099
|
-
rw: e * (.25 + Math.random() * .3),
|
|
4100
|
-
rh: t * (.08 + Math.random() * .08),
|
|
4101
|
-
speed: (.1 + Math.random() * .25) * (r % 2 == 0 ? 1 : -1),
|
|
4102
|
-
alpha: .16 + Math.random() * .14
|
|
4103
|
-
})), S = Array.from({ length: a.snowCount }, () => sn(e, t)), C = h === "hail" ? Array.from({ length: 130 }, () => ({
|
|
4104
|
-
x: Math.random() * (e + 180) - 90,
|
|
4105
|
-
y: Math.random() * t,
|
|
4106
|
-
r: 1.8 + Math.random() * 3,
|
|
4107
|
-
vx: -2.2 - Math.random() * 1.8,
|
|
4108
|
-
vy: 8 + Math.random() * 5,
|
|
4109
|
-
bounces: 0,
|
|
4110
|
-
opacity: .65 + Math.random() * .35
|
|
4111
|
-
})) : [], w = h === "gale" ? Array.from({ length: 46 }, () => ({
|
|
4112
|
-
x: Math.random() * e,
|
|
4113
|
-
y: Math.random() * t,
|
|
4114
|
-
length: 45 + Math.random() * 130,
|
|
4115
|
-
speed: 8 + Math.random() * 10,
|
|
4116
|
-
wave: Math.random() * Math.PI * 2,
|
|
4117
|
-
alpha: .12 + Math.random() * .3,
|
|
4118
|
-
width: .6 + Math.random() * 1.2
|
|
4119
|
-
})) : [], T = 0, E = 0, D = 0, O = [], k = 120 + Math.random() * 240, A = 0, j = document.hidden, M = v((e) => {
|
|
4120
|
-
j = e;
|
|
4121
|
-
}), N = () => {
|
|
4122
|
-
let n = i.createLinearGradient(0, 0, 0, t);
|
|
4123
|
-
n.addColorStop(0, s[0]), n.addColorStop(1, s[1]), i.fillStyle = n, i.fillRect(0, 0, e, t);
|
|
4124
|
-
}, ee = () => {
|
|
4125
|
-
for (let e of f) {
|
|
4126
|
-
let t = .35 + (Math.sin(T * e.speed + e.phase) + 1) * .325;
|
|
4127
|
-
i.beginPath(), i.arc(e.x, e.y, e.r, 0, Math.PI * 2), i.fillStyle = `rgba(226, 235, 255, ${t})`, i.fill();
|
|
4128
|
-
}
|
|
4129
|
-
}, te = () => {
|
|
4130
|
-
if (a.sun === "none") return;
|
|
4131
|
-
let n = d * .88, r = a.sun === "dim", o = i.createRadialGradient(l, u, 0, l, u, n * (r ? 1.8 : 2.8));
|
|
4132
|
-
o.addColorStop(0, `rgba(214, 226, 245, ${r ? .18 : .35})`), o.addColorStop(1, "rgba(214, 226, 245, 0)"), i.fillStyle = o, i.fillRect(0, 0, e, t);
|
|
4133
|
-
let s = r ? .5 : 1, c = i.createRadialGradient(l - n * .25, u - n * .25, 0, l, u, n);
|
|
4134
|
-
c.addColorStop(0, `rgba(245, 248, 252, ${s})`), c.addColorStop(1, `rgba(196, 208, 226, ${s})`), i.beginPath(), i.arc(l, u, n, 0, Math.PI * 2), i.fillStyle = c, i.fill();
|
|
4135
|
-
for (let e of m) i.beginPath(), i.arc(l + e.dx * n, u + e.dy * n, e.r * n, 0, Math.PI * 2), i.fillStyle = `rgba(170, 184, 206, ${s * .55})`, i.fill();
|
|
4136
|
-
}, ne = () => {
|
|
4137
|
-
if (g) {
|
|
4138
|
-
ee(), te();
|
|
4139
|
-
return;
|
|
4140
|
-
}
|
|
4141
|
-
if (a.sun === "none") return;
|
|
4142
|
-
if (a.sun === "full") {
|
|
4143
|
-
let n = 1 + Math.sin(T * .02) * .04, r = i.createRadialGradient(l, u, 0, l, u, d * 3.4 * n);
|
|
4144
|
-
r.addColorStop(0, "rgba(255, 236, 168, 0.9)"), r.addColorStop(.35, "rgba(255, 214, 112, 0.32)"), r.addColorStop(1, "rgba(255, 214, 112, 0)"), i.fillStyle = r, i.fillRect(0, 0, e, t), i.save(), i.translate(l, u), i.rotate(T * .003);
|
|
4145
|
-
for (let e = 0; e < 12; e++) {
|
|
4146
|
-
i.rotate(Math.PI / 6);
|
|
4147
|
-
let e = i.createLinearGradient(d * 1.2, 0, d * 2.4, 0);
|
|
4148
|
-
e.addColorStop(0, "rgba(255, 230, 150, 0.5)"), e.addColorStop(1, "rgba(255, 230, 150, 0)"), i.strokeStyle = e, i.lineWidth = 3, i.beginPath(), i.moveTo(d * 1.2, 0), i.lineTo(d * 2.4, 0), i.stroke();
|
|
4149
|
-
}
|
|
4150
|
-
i.restore();
|
|
4151
|
-
}
|
|
4152
|
-
if (a.sun === "soft") {
|
|
4153
|
-
let n = i.createRadialGradient(l, u, 0, l, u, d * 2.4);
|
|
4154
|
-
n.addColorStop(0, "rgba(255, 240, 190, 0.7)"), n.addColorStop(1, "rgba(255, 240, 190, 0)"), i.fillStyle = n, i.fillRect(0, 0, e, t);
|
|
4155
|
-
}
|
|
4156
|
-
let n = a.sun === "dim" ? .35 : 1, r = i.createRadialGradient(l - d * .2, u - d * .2, 0, l, u, d);
|
|
4157
|
-
r.addColorStop(0, `rgba(255, 250, 224, ${n})`), r.addColorStop(1, `rgba(255, 214, 102, ${n})`), i.beginPath(), i.arc(l, u, d, 0, Math.PI * 2), i.fillStyle = r, i.fill();
|
|
4158
|
-
}, P = () => {
|
|
4159
|
-
let [t, n, r] = c;
|
|
4160
|
-
for (let o of _) {
|
|
4161
|
-
o.x += o.speed * (h === "gale" ? 7 : 1), o.x - 140 * o.scale > e && (o.x = -160 * o.scale);
|
|
4162
|
-
for (let e of o.puffs) {
|
|
4163
|
-
let s = o.x + e.dx * o.scale, c = o.y + e.dy * o.scale, l = e.r * o.scale, u = i.createRadialGradient(s, c, 0, s, c, l);
|
|
4164
|
-
u.addColorStop(0, `rgba(${t}, ${n}, ${r}, ${a.cloudAlpha})`), u.addColorStop(1, `rgba(${t}, ${n}, ${r}, 0)`), i.beginPath(), i.arc(s, c, l, 0, Math.PI * 2), i.fillStyle = u, i.fill();
|
|
4165
|
-
}
|
|
4166
|
-
}
|
|
4167
|
-
}, re = () => {
|
|
4168
|
-
if (!a.rain) return;
|
|
4169
|
-
let { wind: n, alpha: r, splash: o } = a.rain;
|
|
4170
|
-
i.strokeStyle = `rgba(214, 228, 240, ${r})`, i.lineWidth = 1.2, i.beginPath();
|
|
4171
|
-
for (let r of y) {
|
|
4172
|
-
let a = Math.hypot(n, r.speed) || 1, s = n / a, c = r.speed / a;
|
|
4173
|
-
i.moveTo(r.x, r.y), i.lineTo(r.x + s * r.len, r.y + c * r.len), r.x += n, r.y += r.speed, r.y > t && (o && Math.random() < .3 && b.length < 60 && b.push({
|
|
4174
|
-
x: r.x,
|
|
4175
|
-
r: 1,
|
|
4176
|
-
alpha: .5
|
|
4177
|
-
}), r.y = -r.len, r.x = Math.random() * (e + 160) - 80);
|
|
4178
|
-
}
|
|
4179
|
-
i.stroke();
|
|
4180
|
-
for (let e = b.length - 1; e >= 0; e--) {
|
|
4181
|
-
let n = b[e];
|
|
4182
|
-
if (n.r += .8, n.alpha -= .035, n.alpha <= 0) {
|
|
4183
|
-
b.splice(e, 1);
|
|
4184
|
-
continue;
|
|
4185
|
-
}
|
|
4186
|
-
i.beginPath(), i.ellipse(n.x, t - 3, n.r, n.r * .35, 0, Math.PI, Math.PI * 2), i.strokeStyle = `rgba(214, 228, 240, ${n.alpha})`, i.lineWidth = 1, i.stroke();
|
|
4187
|
-
}
|
|
4188
|
-
}, ie = () => {
|
|
4189
|
-
let t = h === "smog" ? "168, 155, 126" : "226, 232, 238";
|
|
4190
|
-
g && (t = h === "smog" ? "96, 88, 66" : "138, 150, 168");
|
|
4191
|
-
for (let n of x) {
|
|
4192
|
-
n.x += n.speed, n.speed > 0 && n.x - n.rw > e && (n.x = -n.rw), n.speed < 0 && n.x + n.rw < 0 && (n.x = e + n.rw);
|
|
4193
|
-
let r = i.createRadialGradient(n.x, n.y, 0, n.x, n.y, n.rw);
|
|
4194
|
-
r.addColorStop(0, `rgba(${t}, ${n.alpha})`), r.addColorStop(1, `rgba(${t}, 0)`), i.save(), i.translate(n.x, n.y), i.scale(1, n.rh / n.rw), i.translate(-n.x, -n.y), i.beginPath(), i.arc(n.x, n.y, n.rw, 0, Math.PI * 2), i.fillStyle = r, i.fill(), i.restore();
|
|
4195
|
-
}
|
|
4196
|
-
}, ae = () => {
|
|
4197
|
-
for (let n of S) n.y += n.speed, n.x += Math.sin(T * .02 + n.phase) * (.3 + n.size * .08) + n.drift, n.rotation += n.rotationSpeed, n.y - n.sprite.height > t && (n.y = -n.sprite.height, n.x = Math.random() * e, n.phase = Math.random() * Math.PI * 2, n.drift = (Math.random() - .5) * .4, n.opacity = .55 + Math.random() * .45), n.x > e + 20 && (n.x = -20), n.x < -20 && (n.x = e + 20), i.save(), i.globalAlpha = n.opacity, i.translate(n.x, n.y), i.rotate(n.rotation), i.drawImage(n.sprite, -n.sprite.width / 2, -n.sprite.height / 2), i.restore();
|
|
4198
|
-
}, oe = () => {
|
|
4199
|
-
if (C.length !== 0) for (let n of C) {
|
|
4200
|
-
let r = n.x, a = n.y;
|
|
4201
|
-
n.vy += .16, n.x += n.vx, n.y += n.vy, i.beginPath(), i.moveTo(r, a), i.lineTo(n.x, n.y), i.strokeStyle = `rgba(225, 239, 250, ${n.opacity * .25})`, i.lineWidth = n.r * .65, i.stroke(), n.y + n.r >= t && (n.bounces === 0 ? (n.y = t - n.r, n.vy *= -.36, n.vx *= .72, n.bounces = 1) : (n.x = Math.random() * (e + 180) - 90, n.y = -10 - Math.random() * t * .25, n.vx = -2.2 - Math.random() * 1.8, n.vy = 8 + Math.random() * 5, n.bounces = 0)), i.beginPath(), i.arc(n.x, n.y, n.r, 0, Math.PI * 2), i.fillStyle = `rgba(241, 248, 255, ${n.opacity})`, i.fill(), i.strokeStyle = `rgba(174, 207, 229, ${n.opacity * .75})`, i.lineWidth = .7, i.stroke(), i.beginPath(), i.arc(n.x - n.r * .3, n.y - n.r * .3, Math.max(.6, n.r * .24), 0, Math.PI * 2), i.fillStyle = `rgba(255, 255, 255, ${n.opacity})`, i.fill();
|
|
4202
|
-
}
|
|
4203
|
-
}, se = () => {
|
|
4204
|
-
if (w.length !== 0) for (let n of w) {
|
|
4205
|
-
n.x += n.speed, n.wave += .04, n.x - n.length > e && (n.x = -n.length - Math.random() * e * .3, n.y = Math.random() * t);
|
|
4206
|
-
let r = Math.sin(n.wave) * 8, a = n.x + n.length;
|
|
4207
|
-
if (i.beginPath(), i.moveTo(n.x, n.y), i.bezierCurveTo(n.x + n.length * .3, n.y + r, n.x + n.length * .7, n.y - r, a, n.y), i.strokeStyle = `rgba(235, 244, 250, ${n.alpha})`, i.lineWidth = n.width, i.lineCap = "round", i.stroke(), n.length > 100) {
|
|
4208
|
-
let e = n.x + n.length * .58, t = n.y - r * .4;
|
|
4209
|
-
i.save(), i.translate(e, t), i.rotate(n.wave * 2), i.beginPath(), i.ellipse(0, 0, 4, 1.6, 0, 0, Math.PI * 2), i.fillStyle = `rgba(91, 76, 52, ${n.alpha * 1.6})`, i.fill(), i.restore();
|
|
4210
|
-
}
|
|
4211
|
-
}
|
|
4212
|
-
}, ce = () => {
|
|
4213
|
-
if (a.lightning) {
|
|
4214
|
-
if (T >= k) {
|
|
4215
|
-
k = T + 150 + Math.random() * 300, E = .5, D = 9;
|
|
4216
|
-
let n = e * (.15 + Math.random() * .7);
|
|
4217
|
-
O = cn(n, t * .12, n + (Math.random() - .5) * e * .2, t * .92, 60, 6);
|
|
4218
|
-
}
|
|
4219
|
-
if (D > 0) {
|
|
4220
|
-
--D;
|
|
4221
|
-
let e = D / 9;
|
|
4222
|
-
i.beginPath(), O.forEach(([e, t], n) => n === 0 ? i.moveTo(e, t) : i.lineTo(e, t)), i.strokeStyle = `rgba(240, 246, 255, ${e})`, i.lineWidth = 2.4, i.shadowColor = "#bcd7ff", i.shadowBlur = 16, i.stroke(), i.shadowBlur = 0;
|
|
4223
|
-
}
|
|
4224
|
-
E > .01 && (i.fillStyle = `rgba(226, 236, 255, ${E})`, i.fillRect(0, 0, e, t), E *= .82);
|
|
4225
|
-
}
|
|
4226
|
-
}, le = () => {
|
|
4227
|
-
if (a.haze <= 0) return;
|
|
4228
|
-
let n = h === "smog" ? "177, 164, 135" : "220, 226, 232";
|
|
4229
|
-
g && (n = h === "smog" ? "82, 74, 54" : "116, 128, 145"), i.fillStyle = `rgba(${n}, ${a.haze})`, i.fillRect(0, 0, e, t);
|
|
4230
|
-
}, F = () => {
|
|
4231
|
-
A = requestAnimationFrame(F), !j && (T += 1, N(), ne(), P(), ie(), le(), re(), ae(), oe(), se(), ce());
|
|
4232
|
-
};
|
|
4233
|
-
return F(), () => {
|
|
4234
|
-
cancelAnimationFrame(A), M();
|
|
4235
|
-
};
|
|
4652
|
+
if (i) return i.setTransform(r, 0, 0, r, 0, 0), Wn({
|
|
4653
|
+
ctx: i,
|
|
4654
|
+
width: e,
|
|
4655
|
+
height: t,
|
|
4656
|
+
activeWeather: h,
|
|
4657
|
+
activeNight: g
|
|
4658
|
+
});
|
|
4236
4659
|
}, [
|
|
4237
4660
|
g,
|
|
4238
4661
|
h,
|
|
4239
4662
|
t,
|
|
4240
4663
|
e
|
|
4241
4664
|
]), /* @__PURE__ */ u("div", {
|
|
4242
|
-
className:
|
|
4665
|
+
className: Gn.weatherBackground,
|
|
4243
4666
|
style: {
|
|
4244
4667
|
width: e,
|
|
4245
4668
|
height: t
|
|
4246
4669
|
},
|
|
4247
4670
|
children: [/* @__PURE__ */ l("canvas", {
|
|
4248
4671
|
ref: p,
|
|
4249
|
-
className:
|
|
4672
|
+
className: Gn.canvas,
|
|
4250
4673
|
style: {
|
|
4251
4674
|
width: e,
|
|
4252
4675
|
height: t
|
|
4253
|
-
}
|
|
4676
|
+
},
|
|
4677
|
+
role: "img",
|
|
4678
|
+
"aria-label": `天气背景:${h}${g ? "(夜间)" : ""}`
|
|
4254
4679
|
}), _ && /* @__PURE__ */ u("div", {
|
|
4255
|
-
className:
|
|
4256
|
-
|
|
4680
|
+
className: Gn.loadingOverlay,
|
|
4681
|
+
role: "status",
|
|
4682
|
+
"aria-live": "polite",
|
|
4683
|
+
children: [/* @__PURE__ */ l("div", {
|
|
4684
|
+
className: Gn.loadingSpinner,
|
|
4685
|
+
"aria-hidden": !0
|
|
4686
|
+
}), /* @__PURE__ */ l("span", { children: "天气加载中…" })]
|
|
4257
4687
|
})]
|
|
4258
4688
|
});
|
|
4259
|
-
},
|
|
4689
|
+
}, qn = {
|
|
4260
4690
|
waveText: "cos-waveText-Zy2Tp",
|
|
4261
4691
|
text: "cos-text-el-KR",
|
|
4262
4692
|
char: "cos-char-Y9-mV",
|
|
4263
4693
|
wave: "cos-wave-jVRCz"
|
|
4264
|
-
},
|
|
4265
|
-
className:
|
|
4694
|
+
}, Jn = ({ text: e = "WAVE", amplitude: t = 12, color: n = "#38bdf8", fontSize: r = 56 }) => /* @__PURE__ */ l("div", {
|
|
4695
|
+
className: qn.waveText,
|
|
4266
4696
|
children: /* @__PURE__ */ l("h1", {
|
|
4267
|
-
className:
|
|
4697
|
+
className: qn.text,
|
|
4268
4698
|
style: {
|
|
4269
4699
|
fontSize: r,
|
|
4270
4700
|
"--wave-color": n,
|
|
4271
4701
|
"--wave-amp": `${t}px`
|
|
4272
4702
|
},
|
|
4273
4703
|
children: e.split("").map((e, t) => /* @__PURE__ */ l("span", {
|
|
4274
|
-
className:
|
|
4704
|
+
className: qn.char,
|
|
4275
4705
|
style: { animationDelay: `${t * .1}s` },
|
|
4276
4706
|
children: e === " " ? "\xA0" : e
|
|
4277
4707
|
}, `${e}-${t}`))
|
|
4278
4708
|
})
|
|
4279
4709
|
});
|
|
4280
4710
|
//#endregion
|
|
4281
|
-
export { x as AudioVisualizer, _ as Aurora, f as BarcodeScan, m as BurnAway, C as CanvasClock, D as Charge, k as ClickSpark,
|
|
4711
|
+
export { x as AudioVisualizer, _ as Aurora, f as BarcodeScan, m as BurnAway, C as CanvasClock, D as Charge, k as ClickSpark, P 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, Ze as NeonText, $e as NewtonCradle, tt as OrbitalChart, rt as ParticleNetwork, at as PlasmaBall, _t as ProgressChest, yt as RadarScan, bt as RedPacketRain, xt as ReturnCity, Mt as RippleWater, Ct as RopeChain, Ft as ScrambleText, Lt as ScratchCard, Bt as SlotMachine, lt as SmokeFog, mt as Snowfall, ft as SolarSystem, wt as Speedometer, Ut as SplitReveal, Gt as Spotlight, gt as Starfield, Tt as TimelinePulse, Yt as Turntable, Qt as Typewriter, $t as WaveButton, Jn as WaveText, Kn as WeatherBackground, nn as mapWmoCodeToWeatherType, cn as useLiveWeather };
|