cos-design 3.5.1 → 3.5.2
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 +11 -0
- package/README.md +5 -3
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +931 -613
- 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
|
@@ -289,7 +289,7 @@ import './index.css';var d = {
|
|
|
289
289
|
circle: "cos-circle-m4vwX",
|
|
290
290
|
circleRotate: "cos-circleRotate-bgFw5",
|
|
291
291
|
button: "cos-button-myCst"
|
|
292
|
-
}, T = 15,
|
|
292
|
+
}, T = 15, ee = 258, te = (e) => {
|
|
293
293
|
let { initQuantity: t = 0, value: r, onChange: i, autoCharge: a = !0, interval: c = 500, step: d = .01 } = e, f = o(null), p = r !== void 0, [m, h] = s(() => y(t, 0, 100)), g = y(p ? r : m, 0, 100), _ = o(g), v = o(i);
|
|
294
294
|
n(() => {
|
|
295
295
|
v.current = i;
|
|
@@ -299,7 +299,7 @@ import './index.css';var d = {
|
|
|
299
299
|
let e = f.current;
|
|
300
300
|
if (!e) return;
|
|
301
301
|
let t = () => {
|
|
302
|
-
let t = Math.max(0, e.clientHeight -
|
|
302
|
+
let t = Math.max(0, e.clientHeight - ee);
|
|
303
303
|
e.style.setProperty("--charge-rise-max", `${t}px`);
|
|
304
304
|
};
|
|
305
305
|
t();
|
|
@@ -340,12 +340,12 @@ import './index.css';var d = {
|
|
|
340
340
|
children: [b, "%"]
|
|
341
341
|
})]
|
|
342
342
|
});
|
|
343
|
-
},
|
|
343
|
+
}, E = {
|
|
344
344
|
clickSpark: "cos-clickSpark-db9Om",
|
|
345
345
|
canvas: "cos-canvas-p9fnQ",
|
|
346
346
|
content: "cos-content-7uE4T",
|
|
347
347
|
hint: "cos-hint-UqpWX"
|
|
348
|
-
},
|
|
348
|
+
}, D = ({ children: e, color: r = "#fbbf24", count: i = 16 }) => {
|
|
349
349
|
let a = o(null), s = o(null), c = o([]), d = o(0), f = t((e, t) => {
|
|
350
350
|
for (let n = 0; n < i; n++) {
|
|
351
351
|
let r = Math.PI * 2 * n / i + Math.random() * .3, a = Math.random() * 4 + 2;
|
|
@@ -383,7 +383,7 @@ import './index.css';var d = {
|
|
|
383
383
|
};
|
|
384
384
|
}, [r]), /* @__PURE__ */ u("div", {
|
|
385
385
|
ref: a,
|
|
386
|
-
className:
|
|
386
|
+
className: E.clickSpark,
|
|
387
387
|
onClick: (e) => {
|
|
388
388
|
let t = a.current?.getBoundingClientRect();
|
|
389
389
|
t && f(e.clientX - t.left, e.clientY - t.top);
|
|
@@ -391,23 +391,23 @@ import './index.css';var d = {
|
|
|
391
391
|
children: [
|
|
392
392
|
/* @__PURE__ */ l("canvas", {
|
|
393
393
|
ref: s,
|
|
394
|
-
className:
|
|
394
|
+
className: E.canvas
|
|
395
395
|
}),
|
|
396
396
|
e && /* @__PURE__ */ l("div", {
|
|
397
|
-
className:
|
|
397
|
+
className: E.content,
|
|
398
398
|
children: e
|
|
399
399
|
}),
|
|
400
400
|
!e && /* @__PURE__ */ l("p", {
|
|
401
|
-
className:
|
|
401
|
+
className: E.hint,
|
|
402
402
|
children: "点击任意位置产生火花"
|
|
403
403
|
})
|
|
404
404
|
]
|
|
405
405
|
});
|
|
406
|
-
},
|
|
406
|
+
}, O = {
|
|
407
407
|
confetti: "cos-confetti-MeNtU",
|
|
408
408
|
canvas: "cos-canvas-0T3Vs",
|
|
409
409
|
hint: "cos-hint-sGHEi"
|
|
410
|
-
},
|
|
410
|
+
}, k = [
|
|
411
411
|
"#ff6b6b",
|
|
412
412
|
"#ffd93d",
|
|
413
413
|
"#6bcb77",
|
|
@@ -415,7 +415,7 @@ import './index.css';var d = {
|
|
|
415
415
|
"#a66cff",
|
|
416
416
|
"#ff85c0",
|
|
417
417
|
"#38bdf8"
|
|
418
|
-
],
|
|
418
|
+
], A = () => k[Math.floor(Math.random() * k.length)], j = (e, t, n) => {
|
|
419
419
|
let r = e / 2, i = t * .6;
|
|
420
420
|
return Array.from({ length: n }, () => {
|
|
421
421
|
let e = (Math.random() - .5) * Math.PI, t = Math.random() * 12 + 6;
|
|
@@ -426,14 +426,14 @@ import './index.css';var d = {
|
|
|
426
426
|
vy: Math.sin(e) * t - Math.random() * 8,
|
|
427
427
|
rotation: Math.random() * 360,
|
|
428
428
|
rotationSpeed: (Math.random() - .5) * 12,
|
|
429
|
-
color:
|
|
429
|
+
color: A(),
|
|
430
430
|
width: Math.random() * 8 + 4,
|
|
431
431
|
height: Math.random() * 6 + 3,
|
|
432
432
|
alpha: 1,
|
|
433
433
|
gravity: Math.random() * .15 + .12
|
|
434
434
|
};
|
|
435
435
|
});
|
|
436
|
-
},
|
|
436
|
+
}, ne = 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,
|
|
@@ -446,7 +446,7 @@ import './index.css';var d = {
|
|
|
446
446
|
};
|
|
447
447
|
let h = t(() => {
|
|
448
448
|
let { width: e, height: t, particleCount: n } = m.current;
|
|
449
|
-
f.current.push(...
|
|
449
|
+
f.current.push(...j(e, t, n));
|
|
450
450
|
}, []);
|
|
451
451
|
return i(c, () => ({ burst: h }), [h]), n(() => {
|
|
452
452
|
a && h();
|
|
@@ -467,30 +467,30 @@ import './index.css';var d = {
|
|
|
467
467
|
cancelAnimationFrame(p.current), o();
|
|
468
468
|
};
|
|
469
469
|
}, [r, e]), /* @__PURE__ */ u("div", {
|
|
470
|
-
className:
|
|
470
|
+
className: O.confetti,
|
|
471
471
|
style: {
|
|
472
472
|
width: e,
|
|
473
473
|
height: r
|
|
474
474
|
},
|
|
475
475
|
children: [/* @__PURE__ */ l("canvas", {
|
|
476
476
|
ref: d,
|
|
477
|
-
className:
|
|
477
|
+
className: O.canvas,
|
|
478
478
|
style: {
|
|
479
479
|
width: e,
|
|
480
480
|
height: r
|
|
481
481
|
},
|
|
482
482
|
onClick: h
|
|
483
483
|
}), /* @__PURE__ */ l("p", {
|
|
484
|
-
className:
|
|
484
|
+
className: O.hint,
|
|
485
485
|
children: "点击画布再次喷射"
|
|
486
486
|
})]
|
|
487
487
|
});
|
|
488
488
|
});
|
|
489
|
-
|
|
490
|
-
var
|
|
489
|
+
ne.displayName = "Confetti";
|
|
490
|
+
var re = {
|
|
491
491
|
cyberGrid: "cos-cyberGrid-VgJwl",
|
|
492
492
|
canvas: "cos-canvas--Mq-O"
|
|
493
|
-
},
|
|
493
|
+
}, ie = ({ 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: re.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: re.canvas,
|
|
543
543
|
style: {
|
|
544
544
|
width: e,
|
|
545
545
|
height: t
|
|
546
546
|
}
|
|
547
547
|
})
|
|
548
548
|
});
|
|
549
|
-
},
|
|
549
|
+
}, M = {
|
|
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
|
+
}, ae = (e) => e instanceof Date ? e.getTime() : typeof e == "number" ? e : new Date(e).getTime(), oe = (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
|
+
}, se = [
|
|
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
|
+
], ce = ({ targetDate: e, onEnd: t, showLabels: r = !0, color: i = "#f472b6" }) => {
|
|
584
|
+
let c = a(() => ae(e), [e]), d = !Number.isNaN(c), [, f] = s(0), p = o(!1), m = o(t), h = d ? oe(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: M.countdown,
|
|
605
605
|
style: { "--countdown-color": i },
|
|
606
|
-
children: [
|
|
607
|
-
className:
|
|
606
|
+
children: [se.map(({ key: e, label: t }) => /* @__PURE__ */ u("div", {
|
|
607
|
+
className: M.unit,
|
|
608
608
|
children: [/* @__PURE__ */ l("div", {
|
|
609
|
-
className:
|
|
609
|
+
className: M.value,
|
|
610
610
|
children: String(h[e]).padStart(2, "0")
|
|
611
611
|
}), r && /* @__PURE__ */ l("span", {
|
|
612
|
-
className:
|
|
612
|
+
className: M.label,
|
|
613
613
|
children: t
|
|
614
614
|
})]
|
|
615
615
|
}, e)), h.total <= 0 && /* @__PURE__ */ l("p", {
|
|
616
|
-
className:
|
|
616
|
+
className: M.ended,
|
|
617
617
|
children: "时间到!"
|
|
618
618
|
})]
|
|
619
619
|
}) : /* @__PURE__ */ l("div", {
|
|
620
|
-
className:
|
|
620
|
+
className: M.countdown,
|
|
621
621
|
children: /* @__PURE__ */ l("p", {
|
|
622
|
-
className:
|
|
622
|
+
className: M.invalid,
|
|
623
623
|
children: "无效的目标时间"
|
|
624
624
|
})
|
|
625
625
|
});
|
|
626
|
-
},
|
|
626
|
+
}, le = {
|
|
627
627
|
dnaHelix: "cos-dnaHelix-nEQLW",
|
|
628
628
|
canvas: "cos-canvas-uEV8B"
|
|
629
|
-
},
|
|
629
|
+
}, ue = ({ 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,28 +656,28 @@ var te = {
|
|
|
656
656
|
r,
|
|
657
657
|
e
|
|
658
658
|
]), /* @__PURE__ */ l("div", {
|
|
659
|
-
className:
|
|
659
|
+
className: le.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: le.canvas,
|
|
667
667
|
style: {
|
|
668
668
|
width: e,
|
|
669
669
|
height: t
|
|
670
670
|
}
|
|
671
671
|
})
|
|
672
672
|
});
|
|
673
|
-
},
|
|
673
|
+
}, de = {
|
|
674
674
|
electricArc: "cos-electricArc-BFlY3",
|
|
675
675
|
canvas: "cos-canvas-iowDx"
|
|
676
|
-
},
|
|
676
|
+
}, fe = (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 = fe(e, t, o + f, s + p, i * .6, a - 1), h = fe(o + f, s + p, n, r, i * .6, a - 1);
|
|
679
679
|
return [...m.slice(0, -1), ...h];
|
|
680
|
-
},
|
|
680
|
+
}, pe = ({ width: e = 320, height: t = 160, color: r = "#67e8f9" }) => {
|
|
681
681
|
let i = o(null);
|
|
682
682
|
return n(() => {
|
|
683
683
|
let n = i.current;
|
|
@@ -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 = fe(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,25 +705,25 @@ var te = {
|
|
|
705
705
|
t,
|
|
706
706
|
e
|
|
707
707
|
]), /* @__PURE__ */ l("div", {
|
|
708
|
-
className:
|
|
708
|
+
className: de.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: de.canvas,
|
|
716
716
|
style: {
|
|
717
717
|
width: e,
|
|
718
718
|
height: t
|
|
719
719
|
}
|
|
720
720
|
})
|
|
721
721
|
});
|
|
722
|
-
},
|
|
722
|
+
}, me = {
|
|
723
723
|
cursorTrail: "cos-cursorTrail-fpz5p",
|
|
724
724
|
canvas: "cos-canvas-Iuyp3",
|
|
725
725
|
hint: "cos-hint-9GLHx"
|
|
726
|
-
},
|
|
726
|
+
}, he = ({ color: e = "#38bdf8", length: t = 20, width: r = 800, height: i = 400 }) => {
|
|
727
727
|
let a = o(null), s = o([]), c = o({
|
|
728
728
|
x: r / 2,
|
|
729
729
|
y: i / 2
|
|
@@ -762,14 +762,14 @@ var te = {
|
|
|
762
762
|
t,
|
|
763
763
|
r
|
|
764
764
|
]), /* @__PURE__ */ u("div", {
|
|
765
|
-
className:
|
|
765
|
+
className: me.cursorTrail,
|
|
766
766
|
style: {
|
|
767
767
|
width: r,
|
|
768
768
|
height: i
|
|
769
769
|
},
|
|
770
770
|
children: [/* @__PURE__ */ l("canvas", {
|
|
771
771
|
ref: a,
|
|
772
|
-
className:
|
|
772
|
+
className: me.canvas,
|
|
773
773
|
style: {
|
|
774
774
|
width: r,
|
|
775
775
|
height: i
|
|
@@ -782,11 +782,11 @@ var te = {
|
|
|
782
782
|
};
|
|
783
783
|
}
|
|
784
784
|
}), /* @__PURE__ */ l("p", {
|
|
785
|
-
className:
|
|
785
|
+
className: me.hint,
|
|
786
786
|
children: "移动鼠标查看粒子轨迹"
|
|
787
787
|
})]
|
|
788
788
|
});
|
|
789
|
-
},
|
|
789
|
+
}, N = {
|
|
790
790
|
diceRoll: "cos-diceRoll-GDwjV",
|
|
791
791
|
scene: "cos-scene-tmnKM",
|
|
792
792
|
cube: "cos-cube-RklEa",
|
|
@@ -801,7 +801,7 @@ var te = {
|
|
|
801
801
|
face6: "cos-face6-Yp-MX",
|
|
802
802
|
rollBtn: "cos-rollBtn-nXMWJ",
|
|
803
803
|
result: "cos-result-kXzu9"
|
|
804
|
-
},
|
|
804
|
+
}, ge = {
|
|
805
805
|
1: {
|
|
806
806
|
x: 0,
|
|
807
807
|
y: 0
|
|
@@ -826,7 +826,7 @@ var te = {
|
|
|
826
826
|
x: 90,
|
|
827
827
|
y: 0
|
|
828
828
|
}
|
|
829
|
-
},
|
|
829
|
+
}, _e = ({ onRoll: e, sides: t = 6 }) => {
|
|
830
830
|
let [r, i] = s(!1), [a, c] = s(1), [d, f] = s({
|
|
831
831
|
x: 0,
|
|
832
832
|
y: 0,
|
|
@@ -838,7 +838,7 @@ var te = {
|
|
|
838
838
|
let h = () => {
|
|
839
839
|
if (r) return;
|
|
840
840
|
i(!0);
|
|
841
|
-
let e = Math.floor(Math.random() * t) + 1, n =
|
|
841
|
+
let e = Math.floor(Math.random() * t) + 1, n = ge[e] ?? ge[1], a = 360 * (3 + Math.floor(Math.random() * 3)), o = 360 * (3 + Math.floor(Math.random() * 3));
|
|
842
842
|
f({
|
|
843
843
|
x: n.x + a,
|
|
844
844
|
y: n.y + o,
|
|
@@ -876,19 +876,19 @@ var te = {
|
|
|
876
876
|
[75, 75]
|
|
877
877
|
]
|
|
878
878
|
}[e] ?? []).map(([e, t], n) => /* @__PURE__ */ l("span", {
|
|
879
|
-
className:
|
|
879
|
+
className: N.dot,
|
|
880
880
|
style: {
|
|
881
881
|
left: `${e}%`,
|
|
882
882
|
top: `${t}%`
|
|
883
883
|
}
|
|
884
884
|
}, n));
|
|
885
885
|
return /* @__PURE__ */ u("div", {
|
|
886
|
-
className:
|
|
886
|
+
className: N.diceRoll,
|
|
887
887
|
children: [
|
|
888
888
|
/* @__PURE__ */ l("div", {
|
|
889
|
-
className:
|
|
889
|
+
className: N.scene,
|
|
890
890
|
children: /* @__PURE__ */ l("div", {
|
|
891
|
-
className: `${
|
|
891
|
+
className: `${N.cube} ${r ? N.rolling : ""}`,
|
|
892
892
|
style: { transform: `rotateX(${d.x}deg) rotateY(${d.y}deg) rotateZ(${d.z}deg)` },
|
|
893
893
|
children: [
|
|
894
894
|
1,
|
|
@@ -898,28 +898,28 @@ var te = {
|
|
|
898
898
|
5,
|
|
899
899
|
6
|
|
900
900
|
].map((e) => /* @__PURE__ */ l("div", {
|
|
901
|
-
className: `${
|
|
901
|
+
className: `${N.face} ${N[`face${e}`]}`,
|
|
902
902
|
children: g(e)
|
|
903
903
|
}, e))
|
|
904
904
|
})
|
|
905
905
|
}),
|
|
906
906
|
/* @__PURE__ */ l("button", {
|
|
907
907
|
type: "button",
|
|
908
|
-
className:
|
|
908
|
+
className: N.rollBtn,
|
|
909
909
|
onClick: h,
|
|
910
910
|
disabled: r,
|
|
911
911
|
children: r ? "掷骰中..." : "掷骰子"
|
|
912
912
|
}),
|
|
913
913
|
!r && /* @__PURE__ */ u("p", {
|
|
914
|
-
className:
|
|
914
|
+
className: N.result,
|
|
915
915
|
children: ["点数: ", a]
|
|
916
916
|
})
|
|
917
917
|
]
|
|
918
918
|
});
|
|
919
|
-
},
|
|
919
|
+
}, ve = {
|
|
920
920
|
doublePendulum: "cos-doublePendulum-FUEeK",
|
|
921
921
|
canvas: "cos-canvas-OVkhW"
|
|
922
|
-
},
|
|
922
|
+
}, ye = ({ width: e = 400, height: t = 400, trailLength: r = 120, color: i = "#38bdf8", color2: a = "#a78bfa" }) => {
|
|
923
923
|
let s = o(null), c = o({
|
|
924
924
|
theta1: Math.PI / 2 + .1,
|
|
925
925
|
theta2: Math.PI / 2 - .2,
|
|
@@ -938,13 +938,13 @@ var te = {
|
|
|
938
938
|
y = e;
|
|
939
939
|
}), x = () => {
|
|
940
940
|
if (_ = requestAnimationFrame(x), y) return;
|
|
941
|
-
let n = c.current, { theta1: o, theta2: s, omega1: v, omega2: b } = n, S = Math.sin(o), C = Math.sin(o - s), w = Math.cos(o - s), T = Math.cos(o),
|
|
942
|
-
n.omega1 +=
|
|
943
|
-
let
|
|
944
|
-
|
|
945
|
-
x:
|
|
946
|
-
y:
|
|
947
|
-
}),
|
|
941
|
+
let n = c.current, { theta1: o, theta2: s, omega1: v, omega2: b } = n, S = Math.sin(o), C = Math.sin(o - s), w = Math.cos(o - s), T = Math.cos(o), ee = p * (3 - 1 * Math.cos(2 * o - 2 * s)), te = (-9.8 * 3 * S - 1 * h * Math.sin(o - 2 * s) - 2 * C * 1 * (b * b * m + v * v * p * w)) / ee, E = 2 * C * (v * v * p * 2 + h * 2 * T + b * b * m * 1 * w) / (m * (3 - 1 * Math.cos(2 * o - 2 * s)));
|
|
942
|
+
n.omega1 += te * g, n.omega2 += E * g, n.theta1 += n.omega1 * g, n.theta2 += n.omega2 * g;
|
|
943
|
+
let D = d + p * Math.sin(n.theta1), O = f + p * Math.cos(n.theta1), k = D + m * Math.sin(n.theta2), A = O + m * Math.cos(n.theta2), j = u.current;
|
|
944
|
+
j.push({
|
|
945
|
+
x: k,
|
|
946
|
+
y: A
|
|
947
|
+
}), j.length > r && j.shift(), l.fillStyle = "rgba(15, 23, 42, 0.22)", l.fillRect(0, 0, e, t), j.length > 1 && (l.beginPath(), j.forEach((e, t) => t === 0 ? l.moveTo(e.x, e.y) : l.lineTo(e.x, e.y)), l.strokeStyle = a, l.lineWidth = 1.5, l.globalAlpha = .7, l.stroke(), l.globalAlpha = 1), l.beginPath(), l.moveTo(d, f), l.lineTo(D, O), l.lineTo(k, A), l.strokeStyle = "#64748b", l.lineWidth = 2, l.stroke(), l.beginPath(), l.arc(d, f, 5, 0, Math.PI * 2), l.fillStyle = "#94a3b8", l.fill(), l.beginPath(), l.arc(D, O, 10, 0, Math.PI * 2), l.fillStyle = i, l.shadowColor = i, l.shadowBlur = 10, l.fill(), l.shadowBlur = 0, l.beginPath(), l.arc(k, A, 10, 0, Math.PI * 2), l.fillStyle = a, l.shadowColor = a, l.shadowBlur = 10, l.fill(), l.shadowBlur = 0;
|
|
948
948
|
};
|
|
949
949
|
return l.fillStyle = "#0f172a", l.fillRect(0, 0, e, t), x(), () => {
|
|
950
950
|
cancelAnimationFrame(_), b();
|
|
@@ -956,32 +956,32 @@ var te = {
|
|
|
956
956
|
r,
|
|
957
957
|
e
|
|
958
958
|
]), /* @__PURE__ */ l("div", {
|
|
959
|
-
className:
|
|
959
|
+
className: ve.doublePendulum,
|
|
960
960
|
style: {
|
|
961
961
|
width: e,
|
|
962
962
|
height: t
|
|
963
963
|
},
|
|
964
964
|
children: /* @__PURE__ */ l("canvas", {
|
|
965
965
|
ref: s,
|
|
966
|
-
className:
|
|
966
|
+
className: ve.canvas,
|
|
967
967
|
style: {
|
|
968
968
|
width: e,
|
|
969
969
|
height: t
|
|
970
970
|
}
|
|
971
971
|
})
|
|
972
972
|
});
|
|
973
|
-
},
|
|
973
|
+
}, be = {
|
|
974
974
|
fireworks: "cos-fireworks-fsSqL",
|
|
975
975
|
canvas: "cos-canvas-spL8G",
|
|
976
976
|
hint: "cos-hint-5XDRH"
|
|
977
|
-
},
|
|
977
|
+
}, xe = [
|
|
978
978
|
"#ff6b6b",
|
|
979
979
|
"#ffd93d",
|
|
980
980
|
"#6bcb77",
|
|
981
981
|
"#4d96ff",
|
|
982
982
|
"#a66cff",
|
|
983
983
|
"#ff85c0"
|
|
984
|
-
],
|
|
984
|
+
], Se = .12, Ce = 240, we = () => xe[Math.floor(Math.random() * xe.length)], Te = (e, t, n) => {
|
|
985
985
|
let r = 60 + Math.floor(Math.random() * 30);
|
|
986
986
|
return Array.from({ length: r }, () => {
|
|
987
987
|
let r = Math.random() * Math.PI * 2, i = Math.random() * 4 + 2;
|
|
@@ -991,11 +991,11 @@ var te = {
|
|
|
991
991
|
vx: Math.cos(r) * i,
|
|
992
992
|
vy: Math.sin(r) * i,
|
|
993
993
|
alpha: 1,
|
|
994
|
-
color: Math.random() > .3 ? n :
|
|
994
|
+
color: Math.random() > .3 ? n : we(),
|
|
995
995
|
decay: Math.random() * .015 + .01
|
|
996
996
|
};
|
|
997
997
|
});
|
|
998
|
-
},
|
|
998
|
+
}, Ee = e(({ width: e = 800, height: r = 500, auto: a = !0 }, s) => {
|
|
999
999
|
let c = o(null), d = o([]), f = o(0), p = t((t) => {
|
|
1000
1000
|
let n = t ?? Math.random() * e * .6 + e * .2;
|
|
1001
1001
|
d.current.push({
|
|
@@ -1003,7 +1003,7 @@ var te = {
|
|
|
1003
1003
|
y: r,
|
|
1004
1004
|
vy: -(Math.random() * 4 + 6),
|
|
1005
1005
|
targetY: Math.random() * r * .35 + r * .15,
|
|
1006
|
-
color:
|
|
1006
|
+
color: we(),
|
|
1007
1007
|
exploded: !1,
|
|
1008
1008
|
particles: [],
|
|
1009
1009
|
age: 0
|
|
@@ -1022,9 +1022,9 @@ var te = {
|
|
|
1022
1022
|
}), u = () => {
|
|
1023
1023
|
f.current = requestAnimationFrame(u), !s && (i.fillStyle = "rgb(15 23 42 / 25%)", i.fillRect(0, 0, e, r), d.current = d.current.filter((e) => {
|
|
1024
1024
|
if (!e.exploded) {
|
|
1025
|
-
e.age += 1, e.y += e.vy, e.vy +=
|
|
1026
|
-
let t = e.vy >= 0, n = e.y <= e.targetY, r = e.y < 0, a = e.age >=
|
|
1027
|
-
return (t || n || r || a) && (e.exploded = !0, e.particles =
|
|
1025
|
+
e.age += 1, e.y += e.vy, e.vy += Se, i.beginPath(), i.arc(e.x, e.y, 2.5, 0, Math.PI * 2), i.fillStyle = e.color, i.fill();
|
|
1026
|
+
let t = e.vy >= 0, n = e.y <= e.targetY, r = e.y < 0, a = e.age >= Ce;
|
|
1027
|
+
return (t || n || r || a) && (e.exploded = !0, e.particles = Te(e.x, e.y, e.color)), !0;
|
|
1028
1028
|
}
|
|
1029
1029
|
return e.particles = e.particles.filter((e) => (e.x += e.vx, e.y += e.vy, e.vy += .06, e.alpha -= e.decay, e.alpha <= 0 ? !1 : (i.beginPath(), i.arc(e.x, e.y, 2, 0, Math.PI * 2), i.fillStyle = e.color, i.globalAlpha = e.alpha, i.fill(), i.globalAlpha = 1, !0))), e.particles.length > 0;
|
|
1030
1030
|
}));
|
|
@@ -1038,14 +1038,14 @@ var te = {
|
|
|
1038
1038
|
p,
|
|
1039
1039
|
e
|
|
1040
1040
|
]), /* @__PURE__ */ u("div", {
|
|
1041
|
-
className:
|
|
1041
|
+
className: be.fireworks,
|
|
1042
1042
|
style: {
|
|
1043
1043
|
width: e,
|
|
1044
1044
|
height: r
|
|
1045
1045
|
},
|
|
1046
1046
|
children: [/* @__PURE__ */ l("canvas", {
|
|
1047
1047
|
ref: c,
|
|
1048
|
-
className:
|
|
1048
|
+
className: be.canvas,
|
|
1049
1049
|
style: {
|
|
1050
1050
|
width: e,
|
|
1051
1051
|
height: r
|
|
@@ -1055,13 +1055,13 @@ var te = {
|
|
|
1055
1055
|
p(e.clientX - t.left);
|
|
1056
1056
|
}
|
|
1057
1057
|
}), /* @__PURE__ */ l("p", {
|
|
1058
|
-
className:
|
|
1058
|
+
className: be.hint,
|
|
1059
1059
|
children: "点击画布燃放烟花"
|
|
1060
1060
|
})]
|
|
1061
1061
|
});
|
|
1062
1062
|
});
|
|
1063
|
-
|
|
1064
|
-
var
|
|
1063
|
+
Ee.displayName = "Fireworks";
|
|
1064
|
+
var P = {
|
|
1065
1065
|
flipCounter: "cos-flipCounter-3LuI0",
|
|
1066
1066
|
digit: "cos-digit-yJRPy",
|
|
1067
1067
|
digitCard: "cos-digitCard-zZUzt",
|
|
@@ -1073,7 +1073,7 @@ var L = {
|
|
|
1073
1073
|
isFlipping: "cos-isFlipping-EVEdI",
|
|
1074
1074
|
"fold-top": "cos-fold-top-v-6XJ",
|
|
1075
1075
|
"unfold-bottom": "cos-unfold-bottom-e2gzU"
|
|
1076
|
-
},
|
|
1076
|
+
}, De = (e, t) => Math.max(0, Math.floor(e)).toString().padStart(t, "0").slice(-t), Oe = ({ digit: e, color: t, duration: r }) => {
|
|
1077
1077
|
let i = o(e), [a, d] = s(!1), [f, p] = s(e);
|
|
1078
1078
|
n(() => {
|
|
1079
1079
|
if (e === i.current) return;
|
|
@@ -1083,58 +1083,58 @@ var L = {
|
|
|
1083
1083
|
}, [e, r]);
|
|
1084
1084
|
let m = a ? f : e;
|
|
1085
1085
|
return /* @__PURE__ */ l("div", {
|
|
1086
|
-
className:
|
|
1086
|
+
className: P.digit,
|
|
1087
1087
|
style: {
|
|
1088
1088
|
"--flip-color": t,
|
|
1089
1089
|
"--flip-duration": `${r}ms`
|
|
1090
1090
|
},
|
|
1091
1091
|
children: /* @__PURE__ */ u("div", {
|
|
1092
|
-
className: `${
|
|
1092
|
+
className: `${P.digitCard} ${a ? P.isFlipping : ""}`,
|
|
1093
1093
|
children: [
|
|
1094
1094
|
/* @__PURE__ */ l("div", {
|
|
1095
|
-
className:
|
|
1095
|
+
className: P.staticTop,
|
|
1096
1096
|
children: /* @__PURE__ */ l("span", { children: m })
|
|
1097
1097
|
}),
|
|
1098
1098
|
/* @__PURE__ */ l("div", {
|
|
1099
|
-
className:
|
|
1099
|
+
className: P.staticBottom,
|
|
1100
1100
|
children: /* @__PURE__ */ l("span", { children: m })
|
|
1101
1101
|
}),
|
|
1102
1102
|
a && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("div", {
|
|
1103
|
-
className: `${
|
|
1103
|
+
className: `${P.flap} ${P.flapTop}`,
|
|
1104
1104
|
children: /* @__PURE__ */ l("span", { children: f })
|
|
1105
1105
|
}), /* @__PURE__ */ l("div", {
|
|
1106
|
-
className: `${
|
|
1106
|
+
className: `${P.flap} ${P.flapBottom}`,
|
|
1107
1107
|
children: /* @__PURE__ */ l("span", { children: e })
|
|
1108
1108
|
})] })
|
|
1109
1109
|
]
|
|
1110
1110
|
})
|
|
1111
1111
|
});
|
|
1112
|
-
},
|
|
1113
|
-
let i =
|
|
1112
|
+
}, ke = ({ value: e, digits: t = 4, color: n = "#38bdf8", duration: r = 600 }) => {
|
|
1113
|
+
let i = De(e, t).split("");
|
|
1114
1114
|
return /* @__PURE__ */ l("div", {
|
|
1115
|
-
className:
|
|
1116
|
-
children: i.map((e, t) => /* @__PURE__ */ l(
|
|
1115
|
+
className: P.flipCounter,
|
|
1116
|
+
children: i.map((e, t) => /* @__PURE__ */ l(Oe, {
|
|
1117
1117
|
digit: e,
|
|
1118
1118
|
color: n,
|
|
1119
1119
|
duration: r
|
|
1120
1120
|
}, t))
|
|
1121
1121
|
});
|
|
1122
|
-
},
|
|
1122
|
+
}, Ae = {
|
|
1123
1123
|
gradientFlow: "cos-gradientFlow-XhN16",
|
|
1124
1124
|
text: "cos-text-ORuqk",
|
|
1125
1125
|
flow: "cos-flow-9FzMA"
|
|
1126
|
-
},
|
|
1126
|
+
}, je = [
|
|
1127
1127
|
"#ff00de",
|
|
1128
1128
|
"#7c3aed",
|
|
1129
1129
|
"#00f0ff",
|
|
1130
1130
|
"#38bdf8",
|
|
1131
1131
|
"#ff00de"
|
|
1132
|
-
],
|
|
1133
|
-
let r = t.length >= 2 ? t.join(", ") :
|
|
1132
|
+
], Me = ({ text: e = "GRADIENT", colors: t = je, fontSize: n = 64 }) => {
|
|
1133
|
+
let r = t.length >= 2 ? t.join(", ") : je.join(", ");
|
|
1134
1134
|
return /* @__PURE__ */ l("div", {
|
|
1135
|
-
className:
|
|
1135
|
+
className: Ae.gradientFlow,
|
|
1136
1136
|
children: /* @__PURE__ */ l("h1", {
|
|
1137
|
-
className:
|
|
1137
|
+
className: Ae.text,
|
|
1138
1138
|
style: {
|
|
1139
1139
|
fontSize: n,
|
|
1140
1140
|
backgroundImage: `linear-gradient(90deg, ${r})`
|
|
@@ -1142,15 +1142,15 @@ var L = {
|
|
|
1142
1142
|
children: e
|
|
1143
1143
|
})
|
|
1144
1144
|
});
|
|
1145
|
-
},
|
|
1145
|
+
}, Ne = {
|
|
1146
1146
|
glitchText: "cos-glitchText-dZ-sR",
|
|
1147
1147
|
text: "cos-text-JsPHN",
|
|
1148
1148
|
"glitch-1": "cos-glitch-1-s9pqH",
|
|
1149
1149
|
"glitch-2": "cos-glitch-2-GhFB-"
|
|
1150
|
-
},
|
|
1151
|
-
className:
|
|
1150
|
+
}, Pe = ({ text: e = "GLITCH", color: t = "#f8fafc", glitchColor1: n = "#ff00de", glitchColor2: r = "#00f0ff", fontSize: i = 64 }) => /* @__PURE__ */ l("div", {
|
|
1151
|
+
className: Ne.glitchText,
|
|
1152
1152
|
children: /* @__PURE__ */ l("h1", {
|
|
1153
|
-
className:
|
|
1153
|
+
className: Ne.text,
|
|
1154
1154
|
"data-text": e,
|
|
1155
1155
|
style: {
|
|
1156
1156
|
fontSize: i,
|
|
@@ -1160,16 +1160,16 @@ var L = {
|
|
|
1160
1160
|
},
|
|
1161
1161
|
children: e
|
|
1162
1162
|
})
|
|
1163
|
-
}),
|
|
1163
|
+
}), Fe = {
|
|
1164
1164
|
gravityBalls: "cos-gravityBalls-LdwFo",
|
|
1165
1165
|
canvas: "cos-canvas-n7esd"
|
|
1166
|
-
},
|
|
1166
|
+
}, Ie = [
|
|
1167
1167
|
"#38bdf8",
|
|
1168
1168
|
"#a78bfa",
|
|
1169
1169
|
"#f472b6",
|
|
1170
1170
|
"#4ade80",
|
|
1171
1171
|
"#fbbf24"
|
|
1172
|
-
],
|
|
1172
|
+
], Le = ({ width: e = 400, height: t = 300, ballCount: r = 12 }) => {
|
|
1173
1173
|
let i = o(null), a = o([]);
|
|
1174
1174
|
return n(() => {
|
|
1175
1175
|
a.current = Array.from({ length: r }, () => ({
|
|
@@ -1178,7 +1178,7 @@ var L = {
|
|
|
1178
1178
|
vx: (Math.random() - .5) * 4,
|
|
1179
1179
|
vy: Math.random() * 2,
|
|
1180
1180
|
r: Math.random() * 10 + 8,
|
|
1181
|
-
color:
|
|
1181
|
+
color: Ie[Math.floor(Math.random() * Ie.length)]
|
|
1182
1182
|
}));
|
|
1183
1183
|
}, [
|
|
1184
1184
|
r,
|
|
@@ -1218,34 +1218,34 @@ var L = {
|
|
|
1218
1218
|
cancelAnimationFrame(s), l();
|
|
1219
1219
|
};
|
|
1220
1220
|
}, [t, e]), /* @__PURE__ */ l("div", {
|
|
1221
|
-
className:
|
|
1221
|
+
className: Fe.gravityBalls,
|
|
1222
1222
|
style: {
|
|
1223
1223
|
width: e,
|
|
1224
1224
|
height: t
|
|
1225
1225
|
},
|
|
1226
1226
|
children: /* @__PURE__ */ l("canvas", {
|
|
1227
1227
|
ref: i,
|
|
1228
|
-
className:
|
|
1228
|
+
className: Fe.canvas,
|
|
1229
1229
|
style: {
|
|
1230
1230
|
width: e,
|
|
1231
1231
|
height: t
|
|
1232
1232
|
}
|
|
1233
1233
|
})
|
|
1234
1234
|
});
|
|
1235
|
-
},
|
|
1235
|
+
}, F = {
|
|
1236
1236
|
wrap: "cos-wrap-r1gGL",
|
|
1237
1237
|
card: "cos-card-3W10s",
|
|
1238
1238
|
shine: "cos-shine-0xjID",
|
|
1239
1239
|
image: "cos-image-AV2XG",
|
|
1240
1240
|
placeholder: "cos-placeholder-wuuL3",
|
|
1241
1241
|
info: "cos-info-CNR0r"
|
|
1242
|
-
},
|
|
1242
|
+
}, Re = ({ title: e = "全息卡片", subtitle: t = "移动鼠标体验 3D 效果", image: n }) => {
|
|
1243
1243
|
let r = o(null);
|
|
1244
1244
|
return /* @__PURE__ */ l("div", {
|
|
1245
|
-
className:
|
|
1245
|
+
className: F.wrap,
|
|
1246
1246
|
children: /* @__PURE__ */ u("div", {
|
|
1247
1247
|
ref: r,
|
|
1248
|
-
className:
|
|
1248
|
+
className: F.card,
|
|
1249
1249
|
onMouseMove: (e) => {
|
|
1250
1250
|
let t = r.current;
|
|
1251
1251
|
if (!t) return;
|
|
@@ -1257,23 +1257,23 @@ var L = {
|
|
|
1257
1257
|
e && (e.style.setProperty("--rx", "0deg"), e.style.setProperty("--ry", "0deg"), e.style.setProperty("--gx", "50%"), e.style.setProperty("--gy", "50%"));
|
|
1258
1258
|
},
|
|
1259
1259
|
children: [
|
|
1260
|
-
/* @__PURE__ */ l("div", { className:
|
|
1260
|
+
/* @__PURE__ */ l("div", { className: F.shine }),
|
|
1261
1261
|
n ? /* @__PURE__ */ l("img", {
|
|
1262
1262
|
src: n,
|
|
1263
1263
|
alt: e,
|
|
1264
|
-
className:
|
|
1264
|
+
className: F.image
|
|
1265
1265
|
}) : /* @__PURE__ */ l("div", {
|
|
1266
|
-
className:
|
|
1266
|
+
className: F.placeholder,
|
|
1267
1267
|
children: /* @__PURE__ */ l("span", { children: "✦" })
|
|
1268
1268
|
}),
|
|
1269
1269
|
/* @__PURE__ */ u("div", {
|
|
1270
|
-
className:
|
|
1270
|
+
className: F.info,
|
|
1271
1271
|
children: [/* @__PURE__ */ l("h3", { children: e }), /* @__PURE__ */ l("p", { children: t })]
|
|
1272
1272
|
})
|
|
1273
1273
|
]
|
|
1274
1274
|
})
|
|
1275
1275
|
});
|
|
1276
|
-
},
|
|
1276
|
+
}, I = {
|
|
1277
1277
|
liquidProgress: "cos-liquidProgress-ABZZA",
|
|
1278
1278
|
svg: "cos-svg-YdTvy",
|
|
1279
1279
|
track: "cos-track-IhMjO",
|
|
@@ -1281,7 +1281,7 @@ var L = {
|
|
|
1281
1281
|
fillBg: "cos-fillBg-pwLI1",
|
|
1282
1282
|
wave: "cos-wave-CBwgG",
|
|
1283
1283
|
label: "cos-label-WYDqS"
|
|
1284
|
-
},
|
|
1284
|
+
}, ze = ({ value: e = 0, max: t = 100, size: i = 160, color: a = "#38bdf8" }) => {
|
|
1285
1285
|
let s = o(null), c = r().replace(/:/g, ""), d = y(t > 0 ? e / t * 100 : 0, 0, 100), f = 100 - d;
|
|
1286
1286
|
return n(() => {
|
|
1287
1287
|
let e = 0, t = 0, n = document.hidden, r = v((e) => {
|
|
@@ -1301,7 +1301,7 @@ var L = {
|
|
|
1301
1301
|
cancelAnimationFrame(e), r();
|
|
1302
1302
|
};
|
|
1303
1303
|
}, [f]), /* @__PURE__ */ u("div", {
|
|
1304
|
-
className:
|
|
1304
|
+
className: I.liquidProgress,
|
|
1305
1305
|
style: {
|
|
1306
1306
|
width: i,
|
|
1307
1307
|
height: i,
|
|
@@ -1309,7 +1309,7 @@ var L = {
|
|
|
1309
1309
|
},
|
|
1310
1310
|
children: [/* @__PURE__ */ u("svg", {
|
|
1311
1311
|
viewBox: "0 0 100 100",
|
|
1312
|
-
className:
|
|
1312
|
+
className: I.svg,
|
|
1313
1313
|
children: [
|
|
1314
1314
|
/* @__PURE__ */ l("defs", { children: /* @__PURE__ */ l("clipPath", {
|
|
1315
1315
|
id: `clip-${c}`,
|
|
@@ -1323,7 +1323,7 @@ var L = {
|
|
|
1323
1323
|
cx: "50",
|
|
1324
1324
|
cy: "50",
|
|
1325
1325
|
r: 45,
|
|
1326
|
-
className:
|
|
1326
|
+
className: I.track,
|
|
1327
1327
|
strokeWidth: 10,
|
|
1328
1328
|
fill: "none"
|
|
1329
1329
|
}),
|
|
@@ -1334,10 +1334,10 @@ var L = {
|
|
|
1334
1334
|
y: "0",
|
|
1335
1335
|
width: "100",
|
|
1336
1336
|
height: "100",
|
|
1337
|
-
className:
|
|
1337
|
+
className: I.fillBg
|
|
1338
1338
|
}), /* @__PURE__ */ l("path", {
|
|
1339
1339
|
ref: s,
|
|
1340
|
-
className:
|
|
1340
|
+
className: I.wave,
|
|
1341
1341
|
d: `M0,${f} Q25,${f - 4} 50,${f} T100,${f} V100 H0 Z`
|
|
1342
1342
|
})]
|
|
1343
1343
|
}),
|
|
@@ -1345,20 +1345,20 @@ var L = {
|
|
|
1345
1345
|
cx: "50",
|
|
1346
1346
|
cy: "50",
|
|
1347
1347
|
r: 45,
|
|
1348
|
-
className:
|
|
1348
|
+
className: I.ring,
|
|
1349
1349
|
strokeWidth: 10,
|
|
1350
1350
|
fill: "none"
|
|
1351
1351
|
})
|
|
1352
1352
|
]
|
|
1353
1353
|
}), /* @__PURE__ */ u("span", {
|
|
1354
|
-
className:
|
|
1354
|
+
className: I.label,
|
|
1355
1355
|
children: [Math.round(d), "%"]
|
|
1356
1356
|
})]
|
|
1357
1357
|
});
|
|
1358
|
-
},
|
|
1358
|
+
}, Be = {
|
|
1359
1359
|
lorenzAttractor: "cos-lorenzAttractor--UAI7",
|
|
1360
1360
|
canvas: "cos-canvas-oeXce"
|
|
1361
|
-
},
|
|
1361
|
+
}, Ve = ({ width: e = 400, height: t = 360, speed: r = 1, color: i = "#f472b6", pointCount: a = 2e3 }) => {
|
|
1362
1362
|
let s = o(null), c = o(0);
|
|
1363
1363
|
return n(() => {
|
|
1364
1364
|
let n = s.current;
|
|
@@ -1408,45 +1408,45 @@ var L = {
|
|
|
1408
1408
|
r,
|
|
1409
1409
|
e
|
|
1410
1410
|
]), /* @__PURE__ */ l("div", {
|
|
1411
|
-
className:
|
|
1411
|
+
className: Be.lorenzAttractor,
|
|
1412
1412
|
style: {
|
|
1413
1413
|
width: e,
|
|
1414
1414
|
height: t
|
|
1415
1415
|
},
|
|
1416
1416
|
children: /* @__PURE__ */ l("canvas", {
|
|
1417
1417
|
ref: s,
|
|
1418
|
-
className:
|
|
1418
|
+
className: Be.canvas,
|
|
1419
1419
|
style: {
|
|
1420
1420
|
width: e,
|
|
1421
1421
|
height: t
|
|
1422
1422
|
}
|
|
1423
1423
|
})
|
|
1424
1424
|
});
|
|
1425
|
-
},
|
|
1425
|
+
}, L = {
|
|
1426
1426
|
liquidGlass: "cos-liquidGlass-Z3bQg",
|
|
1427
1427
|
panel: "cos-panel-XYboD",
|
|
1428
1428
|
content: "cos-content-MHfkS"
|
|
1429
|
-
},
|
|
1430
|
-
className:
|
|
1429
|
+
}, He = ({ children: e = "液态玻璃面板", blur: t = 16, borderRadius: n = 20 }) => /* @__PURE__ */ l("div", {
|
|
1430
|
+
className: L.liquidGlass,
|
|
1431
1431
|
children: /* @__PURE__ */ l("div", {
|
|
1432
|
-
className:
|
|
1432
|
+
className: L.panel,
|
|
1433
1433
|
style: {
|
|
1434
1434
|
"--glass-blur": `${t}px`,
|
|
1435
1435
|
"--glass-radius": `${n}px`
|
|
1436
1436
|
},
|
|
1437
1437
|
children: /* @__PURE__ */ l("div", {
|
|
1438
|
-
className:
|
|
1438
|
+
className: L.content,
|
|
1439
1439
|
children: e
|
|
1440
1440
|
})
|
|
1441
1441
|
})
|
|
1442
|
-
}),
|
|
1442
|
+
}), Ue = {
|
|
1443
1443
|
magneticButton: "cos-magneticButton-GbRkE",
|
|
1444
1444
|
btn: "cos-btn--b2BJ"
|
|
1445
|
-
},
|
|
1445
|
+
}, We = ({ children: e = "磁吸按钮", strength: t = .4, color: n = "#6366f1" }) => {
|
|
1446
1446
|
let r = o(null), i = o(null);
|
|
1447
1447
|
return /* @__PURE__ */ l("div", {
|
|
1448
1448
|
ref: r,
|
|
1449
|
-
className:
|
|
1449
|
+
className: Ue.magneticButton,
|
|
1450
1450
|
onMouseMove: (e) => {
|
|
1451
1451
|
let n = r.current, a = i.current;
|
|
1452
1452
|
if (!n || !a) return;
|
|
@@ -1460,19 +1460,19 @@ var L = {
|
|
|
1460
1460
|
children: /* @__PURE__ */ l("button", {
|
|
1461
1461
|
ref: i,
|
|
1462
1462
|
type: "button",
|
|
1463
|
-
className:
|
|
1463
|
+
className: Ue.btn,
|
|
1464
1464
|
style: { "--btn-color": n },
|
|
1465
1465
|
children: e
|
|
1466
1466
|
})
|
|
1467
1467
|
});
|
|
1468
|
-
},
|
|
1468
|
+
}, R = {
|
|
1469
1469
|
matrixRain: "cos-matrixRain-qg9HC",
|
|
1470
1470
|
canvas: "cos-canvas--AvpG",
|
|
1471
1471
|
overlay: "cos-overlay-knj3b",
|
|
1472
1472
|
title: "cos-title-sDfhs",
|
|
1473
1473
|
flicker: "cos-flicker-smHxl",
|
|
1474
1474
|
subtitle: "cos-subtitle-CWheW"
|
|
1475
|
-
},
|
|
1475
|
+
}, Ge = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*アイウエオカキクケコ", Ke = ({ width: e = 800, height: t = 500, density: r = .6, color: i = "#00ff41", showOverlay: a = !0, title: s = "MATRIX", subtitle: c = "数字雨效果" }) => {
|
|
1476
1476
|
let d = o(null);
|
|
1477
1477
|
return n(() => {
|
|
1478
1478
|
let n = d.current;
|
|
@@ -1486,7 +1486,7 @@ var L = {
|
|
|
1486
1486
|
u = e;
|
|
1487
1487
|
}), p = () => {
|
|
1488
1488
|
l = requestAnimationFrame(p), !u && (o.fillStyle = "rgb(0 0 0 / 8%)", o.fillRect(0, 0, e, t), o.font = "16px monospace", c.forEach((e, n) => {
|
|
1489
|
-
let a =
|
|
1489
|
+
let a = Ge[Math.floor(Math.random() * 53)], s = n / r * 16;
|
|
1490
1490
|
o.fillStyle = i, o.fillText(a, s, e * 16), e * 16 > t && Math.random() > .975 && (c[n] = 0), c[n] += 1;
|
|
1491
1491
|
}));
|
|
1492
1492
|
};
|
|
@@ -1499,33 +1499,33 @@ var L = {
|
|
|
1499
1499
|
t,
|
|
1500
1500
|
e
|
|
1501
1501
|
]), /* @__PURE__ */ u("div", {
|
|
1502
|
-
className:
|
|
1502
|
+
className: R.matrixRain,
|
|
1503
1503
|
style: {
|
|
1504
1504
|
width: e,
|
|
1505
1505
|
height: t
|
|
1506
1506
|
},
|
|
1507
1507
|
children: [/* @__PURE__ */ l("canvas", {
|
|
1508
1508
|
ref: d,
|
|
1509
|
-
className:
|
|
1509
|
+
className: R.canvas,
|
|
1510
1510
|
style: {
|
|
1511
1511
|
width: e,
|
|
1512
1512
|
height: t
|
|
1513
1513
|
}
|
|
1514
1514
|
}), a && /* @__PURE__ */ u("div", {
|
|
1515
|
-
className:
|
|
1515
|
+
className: R.overlay,
|
|
1516
1516
|
children: [/* @__PURE__ */ l("h2", {
|
|
1517
|
-
className:
|
|
1517
|
+
className: R.title,
|
|
1518
1518
|
children: s
|
|
1519
1519
|
}), /* @__PURE__ */ l("p", {
|
|
1520
|
-
className:
|
|
1520
|
+
className: R.subtitle,
|
|
1521
1521
|
children: c
|
|
1522
1522
|
})]
|
|
1523
1523
|
})]
|
|
1524
1524
|
});
|
|
1525
|
-
},
|
|
1525
|
+
}, qe = {
|
|
1526
1526
|
metaballPool: "cos-metaballPool-JJaI9",
|
|
1527
1527
|
canvas: "cos-canvas-S7fDD"
|
|
1528
|
-
},
|
|
1528
|
+
}, Je = ({ width: e = 400, height: t = 300, ballCount: r = 5, color: i = "#38bdf8" }) => {
|
|
1529
1529
|
let a = o(null), s = o([]), c = o({
|
|
1530
1530
|
x: -999,
|
|
1531
1531
|
y: -999,
|
|
@@ -1615,7 +1615,7 @@ var L = {
|
|
|
1615
1615
|
t,
|
|
1616
1616
|
e
|
|
1617
1617
|
]), /* @__PURE__ */ l("div", {
|
|
1618
|
-
className:
|
|
1618
|
+
className: qe.metaballPool,
|
|
1619
1619
|
style: {
|
|
1620
1620
|
width: e,
|
|
1621
1621
|
height: t,
|
|
@@ -1623,17 +1623,17 @@ var L = {
|
|
|
1623
1623
|
},
|
|
1624
1624
|
children: /* @__PURE__ */ l("canvas", {
|
|
1625
1625
|
ref: a,
|
|
1626
|
-
className:
|
|
1626
|
+
className: qe.canvas,
|
|
1627
1627
|
style: {
|
|
1628
1628
|
width: e,
|
|
1629
1629
|
height: t
|
|
1630
1630
|
}
|
|
1631
1631
|
})
|
|
1632
1632
|
});
|
|
1633
|
-
},
|
|
1633
|
+
}, Ye = {
|
|
1634
1634
|
mazeGenerator: "cos-mazeGenerator-QEa0s",
|
|
1635
1635
|
canvas: "cos-canvas-emhxb"
|
|
1636
|
-
},
|
|
1636
|
+
}, Xe = ({ width: e = 400, height: t = 300, cellSize: r = 20, onGenerated: i }) => {
|
|
1637
1637
|
let a = o(null), s = o(i);
|
|
1638
1638
|
return n(() => {
|
|
1639
1639
|
s.current = i;
|
|
@@ -1720,24 +1720,24 @@ var L = {
|
|
|
1720
1720
|
t,
|
|
1721
1721
|
e
|
|
1722
1722
|
]), /* @__PURE__ */ l("div", {
|
|
1723
|
-
className:
|
|
1723
|
+
className: Ye.mazeGenerator,
|
|
1724
1724
|
style: {
|
|
1725
1725
|
width: e,
|
|
1726
1726
|
height: t
|
|
1727
1727
|
},
|
|
1728
1728
|
children: /* @__PURE__ */ l("canvas", {
|
|
1729
1729
|
ref: a,
|
|
1730
|
-
className:
|
|
1730
|
+
className: Ye.canvas,
|
|
1731
1731
|
style: {
|
|
1732
1732
|
width: e,
|
|
1733
1733
|
height: t
|
|
1734
1734
|
}
|
|
1735
1735
|
})
|
|
1736
1736
|
});
|
|
1737
|
-
},
|
|
1737
|
+
}, Ze = {
|
|
1738
1738
|
meteorRain: "cos-meteorRain-v8RNI",
|
|
1739
1739
|
canvas: "cos-canvas-hyFMr"
|
|
1740
|
-
},
|
|
1740
|
+
}, Qe = ({ width: e = 800, height: t = 500, meteorCount: r = 8 }) => {
|
|
1741
1741
|
let i = o(null), a = o([]), s = o(0);
|
|
1742
1742
|
return n(() => {
|
|
1743
1743
|
a.current = Array.from({ length: r }, () => ({
|
|
@@ -1772,47 +1772,47 @@ var L = {
|
|
|
1772
1772
|
cancelAnimationFrame(s.current), l();
|
|
1773
1773
|
};
|
|
1774
1774
|
}, [t, e]), /* @__PURE__ */ l("div", {
|
|
1775
|
-
className:
|
|
1775
|
+
className: Ze.meteorRain,
|
|
1776
1776
|
style: {
|
|
1777
1777
|
width: e,
|
|
1778
1778
|
height: t
|
|
1779
1779
|
},
|
|
1780
1780
|
children: /* @__PURE__ */ l("canvas", {
|
|
1781
1781
|
ref: i,
|
|
1782
|
-
className:
|
|
1782
|
+
className: Ze.canvas,
|
|
1783
1783
|
style: {
|
|
1784
1784
|
width: e,
|
|
1785
1785
|
height: t
|
|
1786
1786
|
}
|
|
1787
1787
|
})
|
|
1788
1788
|
});
|
|
1789
|
-
},
|
|
1789
|
+
}, z = {
|
|
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
|
+
}, $e = ({ text: e = "NEON", color: t = "#ff00de", fontSize: n = 72, flicker: r = !0 }) => /* @__PURE__ */ u("div", {
|
|
1796
|
+
className: z.neonText,
|
|
1797
1797
|
children: [/* @__PURE__ */ l("h1", {
|
|
1798
|
-
className: `${
|
|
1798
|
+
className: `${z.text} ${r ? z.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: z.reflection,
|
|
1806
1806
|
style: {
|
|
1807
1807
|
fontSize: n * .35,
|
|
1808
1808
|
color: t
|
|
1809
1809
|
},
|
|
1810
1810
|
children: e
|
|
1811
1811
|
})]
|
|
1812
|
-
}),
|
|
1812
|
+
}), et = {
|
|
1813
1813
|
newtonCradle: "cos-newtonCradle-mFl-b",
|
|
1814
1814
|
canvas: "cos-canvas-TWKl5"
|
|
1815
|
-
},
|
|
1815
|
+
}, tt = ({ 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: et.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: et.canvas,
|
|
1887
1887
|
style: {
|
|
1888
1888
|
width: r,
|
|
1889
1889
|
height: i
|
|
1890
1890
|
}
|
|
1891
1891
|
})
|
|
1892
1892
|
});
|
|
1893
|
-
},
|
|
1893
|
+
}, B = {
|
|
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: B.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: B.canvas,
|
|
1956
1956
|
style: {
|
|
1957
1957
|
width: t,
|
|
1958
1958
|
height: t
|
|
1959
1959
|
}
|
|
1960
1960
|
}), /* @__PURE__ */ l("ul", {
|
|
1961
|
-
className:
|
|
1961
|
+
className: B.legend,
|
|
1962
1962
|
children: e.map((e) => /* @__PURE__ */ u("li", { children: [
|
|
1963
1963
|
/* @__PURE__ */ l("span", {
|
|
1964
|
-
className:
|
|
1964
|
+
className: B.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,81 +2143,135 @@ 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
|
-
let
|
|
2165
|
-
return
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2163
|
+
}, lt = (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
|
+
}, ut = (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
|
+
}, dt = ({ 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 }, () => lt(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 = ut(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
|
-
}, [
|
|
2203
|
-
className:
|
|
2256
|
+
}, [r, e]), /* @__PURE__ */ l("div", {
|
|
2257
|
+
className: ct.smokeFog,
|
|
2204
2258
|
style: {
|
|
2205
2259
|
width: e,
|
|
2206
|
-
height:
|
|
2260
|
+
height: r
|
|
2207
2261
|
},
|
|
2208
2262
|
children: /* @__PURE__ */ l("canvas", {
|
|
2209
|
-
ref:
|
|
2210
|
-
className:
|
|
2263
|
+
ref: a,
|
|
2264
|
+
className: ct.canvas,
|
|
2211
2265
|
style: {
|
|
2212
2266
|
width: e,
|
|
2213
|
-
height:
|
|
2267
|
+
height: r
|
|
2214
2268
|
}
|
|
2215
2269
|
})
|
|
2216
2270
|
});
|
|
2217
|
-
},
|
|
2271
|
+
}, ft = {
|
|
2218
2272
|
solarSystem: "cos-solarSystem-27h8F",
|
|
2219
2273
|
canvas: "cos-canvas-C0nRa"
|
|
2220
|
-
},
|
|
2274
|
+
}, pt = [
|
|
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
|
+
], mt = ({ 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 = pt.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: ft.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: ft.canvas,
|
|
2338
2392
|
style: {
|
|
2339
2393
|
width: e,
|
|
2340
2394
|
height: t
|
|
2341
2395
|
}
|
|
2342
2396
|
})
|
|
2343
2397
|
});
|
|
2344
|
-
},
|
|
2398
|
+
}, ht = {
|
|
2345
2399
|
snowfall: "cos-snowfall-Q-Dhg",
|
|
2346
2400
|
canvas: "cos-canvas-bJVF8"
|
|
2347
|
-
},
|
|
2401
|
+
}, gt = ({ 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: ht.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: ht.canvas,
|
|
2402
2456
|
style: {
|
|
2403
2457
|
width: e,
|
|
2404
2458
|
height: r
|
|
2405
2459
|
}
|
|
2406
2460
|
})
|
|
2407
2461
|
});
|
|
2408
|
-
},
|
|
2462
|
+
}, _t = {
|
|
2409
2463
|
starfield: "cos-starfield-QTwia",
|
|
2410
2464
|
canvas: "cos-canvas-C2t3g"
|
|
2411
|
-
},
|
|
2465
|
+
}, vt = ({ 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,21 +2505,21 @@ var L = {
|
|
|
2451
2505
|
r,
|
|
2452
2506
|
e
|
|
2453
2507
|
]), /* @__PURE__ */ l("div", {
|
|
2454
|
-
className:
|
|
2508
|
+
className: _t.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: _t.canvas,
|
|
2462
2516
|
style: {
|
|
2463
2517
|
width: e,
|
|
2464
2518
|
height: t
|
|
2465
2519
|
}
|
|
2466
2520
|
})
|
|
2467
2521
|
});
|
|
2468
|
-
},
|
|
2522
|
+
}, V = {
|
|
2469
2523
|
progressChest: "cos-progressChest-Bqcv1",
|
|
2470
2524
|
barWrap: "cos-barWrap-E2pnl",
|
|
2471
2525
|
barTrack: "cos-barTrack-dKLhs",
|
|
@@ -2480,37 +2534,37 @@ var L = {
|
|
|
2480
2534
|
treasure: "cos-treasure-nx-6S",
|
|
2481
2535
|
pop: "cos-pop-uRZvT",
|
|
2482
2536
|
label: "cos-label-61hRe"
|
|
2483
|
-
},
|
|
2537
|
+
}, yt = ({ 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;
|
|
2487
2541
|
}, [t]), n(() => {
|
|
2488
2542
|
c && !i.current && (i.current = !0, a.current?.()), c || (i.current = !1);
|
|
2489
2543
|
}, [c]), /* @__PURE__ */ u("div", {
|
|
2490
|
-
className:
|
|
2544
|
+
className: V.progressChest,
|
|
2491
2545
|
children: [
|
|
2492
2546
|
/* @__PURE__ */ u("div", {
|
|
2493
|
-
className:
|
|
2547
|
+
className: V.barWrap,
|
|
2494
2548
|
children: [/* @__PURE__ */ l("div", {
|
|
2495
|
-
className:
|
|
2549
|
+
className: V.barTrack,
|
|
2496
2550
|
children: /* @__PURE__ */ l("div", {
|
|
2497
|
-
className:
|
|
2551
|
+
className: V.barFill,
|
|
2498
2552
|
style: { width: `${s}%` }
|
|
2499
2553
|
})
|
|
2500
2554
|
}), /* @__PURE__ */ u("span", {
|
|
2501
|
-
className:
|
|
2555
|
+
className: V.pct,
|
|
2502
2556
|
children: [s.toFixed(0), "%"]
|
|
2503
2557
|
})]
|
|
2504
2558
|
}),
|
|
2505
2559
|
/* @__PURE__ */ u("div", {
|
|
2506
|
-
className: `${
|
|
2560
|
+
className: `${V.chest} ${c ? V.open : ""}`,
|
|
2507
2561
|
children: [/* @__PURE__ */ u("div", {
|
|
2508
|
-
className:
|
|
2509
|
-
children: [/* @__PURE__ */ l("div", { className:
|
|
2562
|
+
className: V.lid,
|
|
2563
|
+
children: [/* @__PURE__ */ l("div", { className: V.lidTop }), /* @__PURE__ */ l("div", { className: V.lock })]
|
|
2510
2564
|
}), /* @__PURE__ */ l("div", {
|
|
2511
|
-
className:
|
|
2565
|
+
className: V.body,
|
|
2512
2566
|
children: c && /* @__PURE__ */ u("div", {
|
|
2513
|
-
className:
|
|
2567
|
+
className: V.treasure,
|
|
2514
2568
|
children: [
|
|
2515
2569
|
/* @__PURE__ */ l("span", { children: "💎" }),
|
|
2516
2570
|
/* @__PURE__ */ l("span", { children: "✨" }),
|
|
@@ -2520,15 +2574,15 @@ var L = {
|
|
|
2520
2574
|
})]
|
|
2521
2575
|
}),
|
|
2522
2576
|
/* @__PURE__ */ l("p", {
|
|
2523
|
-
className:
|
|
2577
|
+
className: V.label,
|
|
2524
2578
|
children: c ? "宝箱已开启!" : r
|
|
2525
2579
|
})
|
|
2526
2580
|
]
|
|
2527
2581
|
});
|
|
2528
|
-
},
|
|
2582
|
+
}, bt = {
|
|
2529
2583
|
radarScan: "cos-radarScan-PZaG8",
|
|
2530
2584
|
canvas: "cos-canvas-fUw5N"
|
|
2531
|
-
},
|
|
2585
|
+
}, xt = ({ 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,27 +2619,27 @@ var L = {
|
|
|
2565
2619
|
t,
|
|
2566
2620
|
e
|
|
2567
2621
|
]), /* @__PURE__ */ l("div", {
|
|
2568
|
-
className:
|
|
2622
|
+
className: bt.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: bt.canvas,
|
|
2576
2630
|
style: {
|
|
2577
2631
|
width: e,
|
|
2578
2632
|
height: e
|
|
2579
2633
|
}
|
|
2580
2634
|
})
|
|
2581
2635
|
});
|
|
2582
|
-
},
|
|
2636
|
+
}, H = {
|
|
2583
2637
|
redPacketRain: "cos-redPacketRain-eJ7FW",
|
|
2584
2638
|
canvas: "cos-canvas-direH",
|
|
2585
2639
|
hud: "cos-hud-InqMq",
|
|
2586
2640
|
end: "cos-end-u0J7o",
|
|
2587
2641
|
hint: "cos-hint-sO6ld"
|
|
2588
|
-
},
|
|
2642
|
+
}, St = ({ 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;
|
|
@@ -2631,11 +2685,11 @@ var L = {
|
|
|
2631
2685
|
cancelAnimationFrame(c.current), clearTimeout(l), s();
|
|
2632
2686
|
};
|
|
2633
2687
|
}, [e, b]), /* @__PURE__ */ u("div", {
|
|
2634
|
-
className:
|
|
2688
|
+
className: H.redPacketRain,
|
|
2635
2689
|
children: [
|
|
2636
2690
|
/* @__PURE__ */ l("canvas", {
|
|
2637
2691
|
ref: i,
|
|
2638
|
-
className:
|
|
2692
|
+
className: H.canvas,
|
|
2639
2693
|
style: {
|
|
2640
2694
|
width: 400,
|
|
2641
2695
|
height: 500
|
|
@@ -2649,25 +2703,25 @@ var L = {
|
|
|
2649
2703
|
}
|
|
2650
2704
|
}),
|
|
2651
2705
|
/* @__PURE__ */ u("div", {
|
|
2652
|
-
className:
|
|
2706
|
+
className: H.hud,
|
|
2653
2707
|
children: [/* @__PURE__ */ u("span", { children: ["已抢: ¥", p] }), !h && /* @__PURE__ */ l("span", {
|
|
2654
|
-
className:
|
|
2708
|
+
className: H.end,
|
|
2655
2709
|
children: "红包雨结束"
|
|
2656
2710
|
})]
|
|
2657
2711
|
}),
|
|
2658
2712
|
/* @__PURE__ */ l("p", {
|
|
2659
|
-
className:
|
|
2713
|
+
className: H.hint,
|
|
2660
2714
|
children: "点击红包抢夺"
|
|
2661
2715
|
})
|
|
2662
2716
|
]
|
|
2663
2717
|
});
|
|
2664
|
-
},
|
|
2718
|
+
}, U = {
|
|
2665
2719
|
returnCityContainer: "cos-returnCityContainer-6XTxj",
|
|
2666
2720
|
star: "cos-star-a59Dx",
|
|
2667
2721
|
glassWrap: "cos-glassWrap-golMO",
|
|
2668
2722
|
rotate: "cos-rotate-7X9Jj",
|
|
2669
2723
|
glassItem: "cos-glassItem-OwlFI"
|
|
2670
|
-
},
|
|
2724
|
+
}, Ct = ({ 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;
|
|
@@ -2676,13 +2730,13 @@ var L = {
|
|
|
2676
2730
|
for (let e = 0; e < f; e++) {
|
|
2677
2731
|
let e = window.setTimeout(() => {
|
|
2678
2732
|
let e = document.createElement("div");
|
|
2679
|
-
e.className =
|
|
2733
|
+
e.className = U.star, e.style.top = `${Math.random() * d}px`, e.style.left = `${Math.random() * u}px`, n.append(e), c.push(e);
|
|
2680
2734
|
}, Math.random() * 2e3);
|
|
2681
2735
|
s.push(e);
|
|
2682
2736
|
}
|
|
2683
2737
|
for (let e = 0; e < t; e++) {
|
|
2684
2738
|
let n = document.createElement("div");
|
|
2685
|
-
n.className =
|
|
2739
|
+
n.className = U.glassItem, n.style.transform = `rotateY(${360 / t * e}deg) translateZ(${r}px)`, o.appendChild(n), l.push(n);
|
|
2686
2740
|
let i = window.setTimeout(() => {
|
|
2687
2741
|
n.style.top = "0px", n.style.opacity = "1";
|
|
2688
2742
|
}, e * 300);
|
|
@@ -2697,16 +2751,16 @@ var L = {
|
|
|
2697
2751
|
r
|
|
2698
2752
|
]), /* @__PURE__ */ l("div", {
|
|
2699
2753
|
ref: i,
|
|
2700
|
-
className:
|
|
2754
|
+
className: U.returnCityContainer,
|
|
2701
2755
|
children: /* @__PURE__ */ l("div", {
|
|
2702
2756
|
ref: a,
|
|
2703
|
-
className:
|
|
2757
|
+
className: U.glassWrap
|
|
2704
2758
|
})
|
|
2705
2759
|
});
|
|
2706
|
-
},
|
|
2760
|
+
}, wt = {
|
|
2707
2761
|
ropeChain: "cos-ropeChain-gYaSK",
|
|
2708
2762
|
canvas: "cos-canvas-5i95N"
|
|
2709
|
-
},
|
|
2763
|
+
}, Tt = ({ 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,21 +2845,21 @@ var L = {
|
|
|
2791
2845
|
r,
|
|
2792
2846
|
e
|
|
2793
2847
|
]), /* @__PURE__ */ l("div", {
|
|
2794
|
-
className:
|
|
2848
|
+
className: wt.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: wt.canvas,
|
|
2802
2856
|
style: {
|
|
2803
2857
|
width: e,
|
|
2804
2858
|
height: t
|
|
2805
2859
|
}
|
|
2806
2860
|
})
|
|
2807
2861
|
});
|
|
2808
|
-
},
|
|
2862
|
+
}, W = {
|
|
2809
2863
|
speedometer: "cos-speedometer-INc7F",
|
|
2810
2864
|
svg: "cos-svg-HG-lE",
|
|
2811
2865
|
track: "cos-track-5-922",
|
|
@@ -2815,37 +2869,37 @@ var L = {
|
|
|
2815
2869
|
hub: "cos-hub-4WaHw",
|
|
2816
2870
|
valueText: "cos-valueText--q4Xi",
|
|
2817
2871
|
label: "cos-label-hOPy1"
|
|
2818
|
-
},
|
|
2872
|
+
}, G = (e, t, n, r) => {
|
|
2819
2873
|
let i = (r - 90) * Math.PI / 180;
|
|
2820
2874
|
return {
|
|
2821
2875
|
x: e + n * Math.cos(i),
|
|
2822
2876
|
y: t + n * Math.sin(i)
|
|
2823
2877
|
};
|
|
2824
|
-
},
|
|
2878
|
+
}, Et = ({ 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
|
-
let e =
|
|
2880
|
+
let e = G(100, 100, 72, -120), t = G(100, 100, 72, 120);
|
|
2827
2881
|
return `M ${e.x} ${e.y} A 72 72 0 1 1 ${t.x} ${t.y}`;
|
|
2828
2882
|
}, []), s = a(() => {
|
|
2829
|
-
let e =
|
|
2883
|
+
let e = G(100, 100, 72, -120), t = G(100, 100, 72, i), n = +(i - -120 > 180);
|
|
2830
2884
|
return `M ${e.x} ${e.y} A 72 72 0 ${n} 1 ${t.x} ${t.y}`;
|
|
2831
|
-
}, [i]), c =
|
|
2885
|
+
}, [i]), c = G(100, 100, 58, i);
|
|
2832
2886
|
return /* @__PURE__ */ u("div", {
|
|
2833
|
-
className:
|
|
2887
|
+
className: W.speedometer,
|
|
2834
2888
|
style: { "--gauge-color": r },
|
|
2835
2889
|
children: [/* @__PURE__ */ u("svg", {
|
|
2836
2890
|
viewBox: "0 0 200 130",
|
|
2837
|
-
className:
|
|
2891
|
+
className: W.svg,
|
|
2838
2892
|
children: [
|
|
2839
2893
|
/* @__PURE__ */ l("path", {
|
|
2840
2894
|
d: o,
|
|
2841
|
-
className:
|
|
2895
|
+
className: W.track,
|
|
2842
2896
|
fill: "none",
|
|
2843
2897
|
strokeWidth: "12",
|
|
2844
2898
|
strokeLinecap: "round"
|
|
2845
2899
|
}),
|
|
2846
2900
|
/* @__PURE__ */ l("path", {
|
|
2847
2901
|
d: s,
|
|
2848
|
-
className:
|
|
2902
|
+
className: W.valueArc,
|
|
2849
2903
|
fill: "none",
|
|
2850
2904
|
strokeWidth: "12",
|
|
2851
2905
|
strokeLinecap: "round"
|
|
@@ -2857,13 +2911,13 @@ var L = {
|
|
|
2857
2911
|
60,
|
|
2858
2912
|
120
|
|
2859
2913
|
].map((e) => {
|
|
2860
|
-
let t =
|
|
2914
|
+
let t = G(100, 100, 58, e), n = G(100, 100, 66, e);
|
|
2861
2915
|
return /* @__PURE__ */ l("line", {
|
|
2862
2916
|
x1: t.x,
|
|
2863
2917
|
y1: t.y,
|
|
2864
2918
|
x2: n.x,
|
|
2865
2919
|
y2: n.y,
|
|
2866
|
-
className:
|
|
2920
|
+
className: W.tick
|
|
2867
2921
|
}, e);
|
|
2868
2922
|
}),
|
|
2869
2923
|
/* @__PURE__ */ l("line", {
|
|
@@ -2871,27 +2925,27 @@ var L = {
|
|
|
2871
2925
|
y1: "100",
|
|
2872
2926
|
x2: c.x,
|
|
2873
2927
|
y2: c.y,
|
|
2874
|
-
className:
|
|
2928
|
+
className: W.needle
|
|
2875
2929
|
}),
|
|
2876
2930
|
/* @__PURE__ */ l("circle", {
|
|
2877
2931
|
cx: "100",
|
|
2878
2932
|
cy: "100",
|
|
2879
2933
|
r: "6",
|
|
2880
|
-
className:
|
|
2934
|
+
className: W.hub
|
|
2881
2935
|
}),
|
|
2882
2936
|
/* @__PURE__ */ l("text", {
|
|
2883
2937
|
x: "100",
|
|
2884
2938
|
y: "118",
|
|
2885
|
-
className:
|
|
2939
|
+
className: W.valueText,
|
|
2886
2940
|
children: Math.round(e)
|
|
2887
2941
|
})
|
|
2888
2942
|
]
|
|
2889
2943
|
}), /* @__PURE__ */ l("span", {
|
|
2890
|
-
className:
|
|
2944
|
+
className: W.label,
|
|
2891
2945
|
children: n
|
|
2892
2946
|
})]
|
|
2893
2947
|
});
|
|
2894
|
-
},
|
|
2948
|
+
}, K = {
|
|
2895
2949
|
timelinePulse: "cos-timelinePulse-kcBM6",
|
|
2896
2950
|
axis: "cos-axis-9DWis",
|
|
2897
2951
|
track: "cos-track-jG-HV",
|
|
@@ -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
|
+
}, Dt = ({ steps: e = [
|
|
2905
2959
|
"Start",
|
|
2906
2960
|
"Process",
|
|
2907
2961
|
"Review",
|
|
@@ -2909,26 +2963,26 @@ var L = {
|
|
|
2909
2963
|
], current: t = 0, color: n = "#22d3ee" }) => {
|
|
2910
2964
|
let r = y(t, 0, Math.max(0, e.length - 1)), i = e.length > 1 ? r / (e.length - 1) : 0;
|
|
2911
2965
|
return /* @__PURE__ */ l("div", {
|
|
2912
|
-
className:
|
|
2966
|
+
className: K.timelinePulse,
|
|
2913
2967
|
style: {
|
|
2914
2968
|
"--pulse-color": n,
|
|
2915
2969
|
"--step-count": e.length,
|
|
2916
2970
|
"--progress-ratio": i
|
|
2917
2971
|
},
|
|
2918
2972
|
children: /* @__PURE__ */ u("div", {
|
|
2919
|
-
className:
|
|
2973
|
+
className: K.axis,
|
|
2920
2974
|
children: [
|
|
2921
|
-
/* @__PURE__ */ l("div", { className:
|
|
2922
|
-
/* @__PURE__ */ l("div", { className:
|
|
2975
|
+
/* @__PURE__ */ l("div", { className: K.track }),
|
|
2976
|
+
/* @__PURE__ */ l("div", { className: K.progress }),
|
|
2923
2977
|
/* @__PURE__ */ l("ul", {
|
|
2924
|
-
className:
|
|
2978
|
+
className: K.steps,
|
|
2925
2979
|
children: e.map((e, t) => {
|
|
2926
2980
|
let n = t < r ? "done" : t === r ? "current" : "pending";
|
|
2927
2981
|
return /* @__PURE__ */ u("li", {
|
|
2928
|
-
className:
|
|
2982
|
+
className: K.step,
|
|
2929
2983
|
"data-state": n,
|
|
2930
|
-
children: [/* @__PURE__ */ l("span", { className:
|
|
2931
|
-
className:
|
|
2984
|
+
children: [/* @__PURE__ */ l("span", { className: K.dot }), /* @__PURE__ */ l("span", {
|
|
2985
|
+
className: K.name,
|
|
2932
2986
|
children: e
|
|
2933
2987
|
})]
|
|
2934
2988
|
}, e + t);
|
|
@@ -2937,11 +2991,11 @@ var L = {
|
|
|
2937
2991
|
]
|
|
2938
2992
|
})
|
|
2939
2993
|
});
|
|
2940
|
-
},
|
|
2994
|
+
}, Ot = {
|
|
2941
2995
|
rippleWater: "cos-rippleWater-wsinI",
|
|
2942
2996
|
canvas: "cos-canvas-XOdSF",
|
|
2943
2997
|
hint: "cos-hint-0JH5D"
|
|
2944
|
-
},
|
|
2998
|
+
}, kt = ({ width: e = 800, height: r = 500, color: i = "#38bdf8" }) => {
|
|
2945
2999
|
let a = o(null), s = o([]), c = o(0), d = t((t, n) => {
|
|
2946
3000
|
let i = a.current;
|
|
2947
3001
|
if (!i) return;
|
|
@@ -2988,32 +3042,32 @@ var L = {
|
|
|
2988
3042
|
r,
|
|
2989
3043
|
e
|
|
2990
3044
|
]), /* @__PURE__ */ u("div", {
|
|
2991
|
-
className:
|
|
3045
|
+
className: Ot.rippleWater,
|
|
2992
3046
|
style: {
|
|
2993
3047
|
width: e,
|
|
2994
3048
|
height: r
|
|
2995
3049
|
},
|
|
2996
3050
|
children: [/* @__PURE__ */ l("canvas", {
|
|
2997
3051
|
ref: a,
|
|
2998
|
-
className:
|
|
3052
|
+
className: Ot.canvas,
|
|
2999
3053
|
style: {
|
|
3000
3054
|
width: e,
|
|
3001
3055
|
height: r
|
|
3002
3056
|
}
|
|
3003
3057
|
}), /* @__PURE__ */ l("span", {
|
|
3004
|
-
className:
|
|
3058
|
+
className: Ot.hint,
|
|
3005
3059
|
children: "点击水面产生涟漪"
|
|
3006
3060
|
})]
|
|
3007
3061
|
});
|
|
3008
|
-
},
|
|
3062
|
+
}, At = {
|
|
3009
3063
|
scrambleText: "cos-scrambleText-hN4Wm",
|
|
3010
3064
|
text: "cos-text-frsHs",
|
|
3011
3065
|
cursor: "cos-cursor-3zQOy",
|
|
3012
3066
|
blink: "cos-blink-OcKXu"
|
|
3013
|
-
},
|
|
3067
|
+
}, jt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*", Mt = ({ text: e = "DECRYPTED", duration: t = 2e3, charset: r = jt }) => {
|
|
3014
3068
|
let [i, a] = s(""), c = o(0), d = o(0);
|
|
3015
3069
|
return n(() => {
|
|
3016
|
-
let n = r.length > 0 ? r :
|
|
3070
|
+
let n = r.length > 0 ? r : jt, i = e;
|
|
3017
3071
|
d.current = performance.now();
|
|
3018
3072
|
let o = (e) => {
|
|
3019
3073
|
let r = e - d.current, s = Math.min(r / t, 1), l = Math.floor(s * i.length);
|
|
@@ -3025,18 +3079,18 @@ var L = {
|
|
|
3025
3079
|
t,
|
|
3026
3080
|
r
|
|
3027
3081
|
]), /* @__PURE__ */ l("div", {
|
|
3028
|
-
className:
|
|
3082
|
+
className: At.scrambleText,
|
|
3029
3083
|
children: /* @__PURE__ */ u("p", {
|
|
3030
|
-
className:
|
|
3031
|
-
children: [i, /* @__PURE__ */ l("span", { className:
|
|
3084
|
+
className: At.text,
|
|
3085
|
+
children: [i, /* @__PURE__ */ l("span", { className: At.cursor })]
|
|
3032
3086
|
})
|
|
3033
3087
|
});
|
|
3034
|
-
},
|
|
3088
|
+
}, q = {
|
|
3035
3089
|
scratchCard: "cos-scratchCard-McIEK",
|
|
3036
3090
|
prize: "cos-prize-X0z5V",
|
|
3037
3091
|
canvas: "cos-canvas-JqIlr",
|
|
3038
3092
|
hidden: "cos-hidden-Lsfbt"
|
|
3039
|
-
},
|
|
3093
|
+
}, Nt = ({ coverColor: e = "#94a3b8", prize: r = "🎉 恭喜中奖!", onReveal: i, width: a = 300, height: c = 180 }) => {
|
|
3040
3094
|
let d = o(null), f = o(!1), p = o(!1), m = o(i), [h, g] = s(!1);
|
|
3041
3095
|
n(() => {
|
|
3042
3096
|
m.current = i;
|
|
@@ -3099,17 +3153,17 @@ var L = {
|
|
|
3099
3153
|
f.current = !1;
|
|
3100
3154
|
};
|
|
3101
3155
|
return /* @__PURE__ */ u("div", {
|
|
3102
|
-
className:
|
|
3156
|
+
className: q.scratchCard,
|
|
3103
3157
|
style: {
|
|
3104
3158
|
width: a,
|
|
3105
3159
|
height: c
|
|
3106
3160
|
},
|
|
3107
3161
|
children: [/* @__PURE__ */ l("div", {
|
|
3108
|
-
className:
|
|
3162
|
+
className: q.prize,
|
|
3109
3163
|
children: r
|
|
3110
3164
|
}), /* @__PURE__ */ l("canvas", {
|
|
3111
3165
|
ref: d,
|
|
3112
|
-
className: `${
|
|
3166
|
+
className: `${q.canvas} ${h ? q.hidden : ""}`,
|
|
3113
3167
|
style: {
|
|
3114
3168
|
width: a,
|
|
3115
3169
|
height: c
|
|
@@ -3123,7 +3177,7 @@ var L = {
|
|
|
3123
3177
|
onTouchEnd: C
|
|
3124
3178
|
})]
|
|
3125
3179
|
});
|
|
3126
|
-
},
|
|
3180
|
+
}, J = {
|
|
3127
3181
|
slotMachine: "cos-slotMachine-P6FyZ",
|
|
3128
3182
|
machine: "cos-machine-B066r",
|
|
3129
3183
|
reel: "cos-reel-eEpJ3",
|
|
@@ -3132,14 +3186,14 @@ var L = {
|
|
|
3132
3186
|
mask: "cos-mask-jdrj3",
|
|
3133
3187
|
spinBtn: "cos-spinBtn-DvDE7",
|
|
3134
3188
|
result: "cos-result-dLN5b"
|
|
3135
|
-
},
|
|
3189
|
+
}, Pt = [
|
|
3136
3190
|
"🍒",
|
|
3137
3191
|
"🍋",
|
|
3138
3192
|
"🍊",
|
|
3139
3193
|
"🍇",
|
|
3140
3194
|
"⭐",
|
|
3141
3195
|
"7️⃣"
|
|
3142
|
-
],
|
|
3196
|
+
], Ft = (e) => 1 - (1 - e) ** 3, It = ({ symbols: e = Pt, onSpinEnd: r }) => {
|
|
3143
3197
|
let [i, a] = s(!1), [c, d] = s([
|
|
3144
3198
|
0,
|
|
3145
3199
|
0,
|
|
@@ -3156,31 +3210,31 @@ var L = {
|
|
|
3156
3210
|
return n(() => () => {
|
|
3157
3211
|
g.current && (g.current.cancelled = !0), cancelAnimationFrame(m.current);
|
|
3158
3212
|
}, []), /* @__PURE__ */ u("div", {
|
|
3159
|
-
className:
|
|
3213
|
+
className: J.slotMachine,
|
|
3160
3214
|
children: [
|
|
3161
3215
|
/* @__PURE__ */ l("div", {
|
|
3162
|
-
className:
|
|
3216
|
+
className: J.machine,
|
|
3163
3217
|
children: [
|
|
3164
3218
|
0,
|
|
3165
3219
|
1,
|
|
3166
3220
|
2
|
|
3167
3221
|
].map((e) => /* @__PURE__ */ u("div", {
|
|
3168
|
-
className:
|
|
3222
|
+
className: J.reel,
|
|
3169
3223
|
style: { height: 240 },
|
|
3170
3224
|
children: [/* @__PURE__ */ l("div", {
|
|
3171
|
-
className:
|
|
3225
|
+
className: J.strip,
|
|
3172
3226
|
style: { transform: `translateY(${c[e]}px)` },
|
|
3173
3227
|
children: _.map((e, t) => /* @__PURE__ */ l("div", {
|
|
3174
|
-
className:
|
|
3228
|
+
className: J.item,
|
|
3175
3229
|
style: { height: 80 },
|
|
3176
3230
|
children: e
|
|
3177
3231
|
}, t))
|
|
3178
|
-
}), /* @__PURE__ */ l("div", { className:
|
|
3232
|
+
}), /* @__PURE__ */ l("div", { className: J.mask })]
|
|
3179
3233
|
}, e))
|
|
3180
3234
|
}),
|
|
3181
3235
|
/* @__PURE__ */ l("button", {
|
|
3182
3236
|
type: "button",
|
|
3183
|
-
className:
|
|
3237
|
+
className: J.spinBtn,
|
|
3184
3238
|
onClick: () => {
|
|
3185
3239
|
if (i) return;
|
|
3186
3240
|
a(!0), p([]);
|
|
@@ -3199,7 +3253,7 @@ var L = {
|
|
|
3199
3253
|
if (d(r.map((e, t) => {
|
|
3200
3254
|
let r = i - l - s[t];
|
|
3201
3255
|
if (r < 0) return e;
|
|
3202
|
-
let a =
|
|
3256
|
+
let a = Ft(Math.min(r / o, 1));
|
|
3203
3257
|
return e + (n[t] - e) * a;
|
|
3204
3258
|
})), !s.every((e) => i - l - e >= o)) m.current = requestAnimationFrame(f);
|
|
3205
3259
|
else if (!u.cancelled) {
|
|
@@ -3214,12 +3268,12 @@ var L = {
|
|
|
3214
3268
|
children: i ? "旋转中..." : "开始"
|
|
3215
3269
|
}),
|
|
3216
3270
|
f.length > 0 && !i && /* @__PURE__ */ l("p", {
|
|
3217
|
-
className:
|
|
3271
|
+
className: J.result,
|
|
3218
3272
|
children: f[0] === f[1] && f[1] === f[2] ? "🎰 大奖!" : `结果: ${f.join(" ")}`
|
|
3219
3273
|
})
|
|
3220
3274
|
]
|
|
3221
3275
|
});
|
|
3222
|
-
},
|
|
3276
|
+
}, Y = {
|
|
3223
3277
|
splitReveal: "cos-splitReveal-6W8-6",
|
|
3224
3278
|
text: "cos-text-miTsj",
|
|
3225
3279
|
char: "cos-char-0gPJV",
|
|
@@ -3228,27 +3282,27 @@ var L = {
|
|
|
3228
3282
|
fromBottom: "cos-fromBottom-24D6g",
|
|
3229
3283
|
fromLeft: "cos-fromLeft-OMiPY",
|
|
3230
3284
|
fromRight: "cos-fromRight-EcMOR"
|
|
3231
|
-
},
|
|
3285
|
+
}, Lt = [
|
|
3232
3286
|
"fromTop",
|
|
3233
3287
|
"fromBottom",
|
|
3234
3288
|
"fromLeft",
|
|
3235
3289
|
"fromRight"
|
|
3236
|
-
],
|
|
3237
|
-
className:
|
|
3290
|
+
], Rt = ({ text: e = "REVEAL", delay: t = 80, color: n = "#f8fafc" }) => /* @__PURE__ */ l("div", {
|
|
3291
|
+
className: Y.splitReveal,
|
|
3238
3292
|
children: /* @__PURE__ */ l("h1", {
|
|
3239
|
-
className:
|
|
3293
|
+
className: Y.text,
|
|
3240
3294
|
style: { "--reveal-color": n },
|
|
3241
3295
|
children: e.split("").map((e, n) => /* @__PURE__ */ l("span", {
|
|
3242
|
-
className: `${
|
|
3296
|
+
className: `${Y.char} ${Y[Lt[n % Lt.length]]}`,
|
|
3243
3297
|
style: { animationDelay: `${n * t}ms` },
|
|
3244
3298
|
children: e === " " ? "\xA0" : e
|
|
3245
3299
|
}, `${e}-${n}`))
|
|
3246
3300
|
})
|
|
3247
|
-
}),
|
|
3301
|
+
}), zt = {
|
|
3248
3302
|
spotlight: "cos-spotlight-OddY1",
|
|
3249
3303
|
content: "cos-content-5I1Wy",
|
|
3250
3304
|
overlay: "cos-overlay-F6CJ5"
|
|
3251
|
-
},
|
|
3305
|
+
}, Bt = ({ children: e, radius: n = 120, dimColor: r = "rgba(0, 0, 0, 0.85)" }) => {
|
|
3252
3306
|
let i = o(null), a = t((e) => {
|
|
3253
3307
|
let t = i.current;
|
|
3254
3308
|
if (!t) return;
|
|
@@ -3257,18 +3311,18 @@ var L = {
|
|
|
3257
3311
|
}, []);
|
|
3258
3312
|
return /* @__PURE__ */ u("div", {
|
|
3259
3313
|
ref: i,
|
|
3260
|
-
className:
|
|
3314
|
+
className: zt.spotlight,
|
|
3261
3315
|
style: {
|
|
3262
3316
|
"--spot-radius": `${n}px`,
|
|
3263
3317
|
"--dim-color": r
|
|
3264
3318
|
},
|
|
3265
3319
|
onMouseMove: a,
|
|
3266
3320
|
children: [/* @__PURE__ */ l("div", {
|
|
3267
|
-
className:
|
|
3321
|
+
className: zt.content,
|
|
3268
3322
|
children: e
|
|
3269
|
-
}), /* @__PURE__ */ l("div", { className:
|
|
3323
|
+
}), /* @__PURE__ */ l("div", { className: zt.overlay })]
|
|
3270
3324
|
});
|
|
3271
|
-
},
|
|
3325
|
+
}, X = {
|
|
3272
3326
|
turntable: "cos-turntable-dkc32",
|
|
3273
3327
|
wheelWrap: "cos-wheelWrap-n7lhc",
|
|
3274
3328
|
canvas: "cos-canvas-A1-4x",
|
|
@@ -3276,7 +3330,7 @@ var L = {
|
|
|
3276
3330
|
spinBtn: "cos-spinBtn-l9JIC",
|
|
3277
3331
|
result: "cos-result-H8q2c",
|
|
3278
3332
|
"fade-in": "cos-fade-in-U9bUC"
|
|
3279
|
-
},
|
|
3333
|
+
}, Vt = [
|
|
3280
3334
|
"#FF6B6B",
|
|
3281
3335
|
"#4ECDC4",
|
|
3282
3336
|
"#FFE66D",
|
|
@@ -3285,19 +3339,19 @@ var L = {
|
|
|
3285
3339
|
"#F472B6",
|
|
3286
3340
|
"#34D399",
|
|
3287
3341
|
"#FB923C"
|
|
3288
|
-
],
|
|
3342
|
+
], Ht = [
|
|
3289
3343
|
{ label: "一等奖" },
|
|
3290
3344
|
{ label: "二等奖" },
|
|
3291
3345
|
{ label: "三等奖" },
|
|
3292
3346
|
{ label: "谢谢参与" },
|
|
3293
3347
|
{ label: "优惠券" },
|
|
3294
3348
|
{ label: "再来一次" }
|
|
3295
|
-
],
|
|
3349
|
+
], Ut = (e) => 1 - (1 - e) ** 3, Wt = ({ prizes: e = Ht, size: r = 360, spinDuration: i = 4e3, spinRounds: a = 5, buttonText: c = "开始抽奖", onSpinEnd: d }) => {
|
|
3296
3350
|
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
3351
|
n(() => {
|
|
3298
3352
|
b.current = d;
|
|
3299
3353
|
}, [d]);
|
|
3300
|
-
let S = r + 48, C = (e, t) => t.color ??
|
|
3354
|
+
let S = r + 48, C = (e, t) => t.color ?? Vt[e % Vt.length], w = t((t) => {
|
|
3301
3355
|
let n = f.current;
|
|
3302
3356
|
if (!n) return;
|
|
3303
3357
|
let i = n.getContext("2d");
|
|
@@ -3332,22 +3386,22 @@ var L = {
|
|
|
3332
3386
|
return Math.floor((360 - r + n / 2) % 360 / n) % e.length;
|
|
3333
3387
|
};
|
|
3334
3388
|
return /* @__PURE__ */ u("div", {
|
|
3335
|
-
className:
|
|
3389
|
+
className: X.turntable,
|
|
3336
3390
|
style: {
|
|
3337
3391
|
width: S,
|
|
3338
3392
|
height: S + 80
|
|
3339
3393
|
},
|
|
3340
3394
|
children: [/* @__PURE__ */ u("div", {
|
|
3341
|
-
className:
|
|
3395
|
+
className: X.wheelWrap,
|
|
3342
3396
|
style: {
|
|
3343
3397
|
width: S,
|
|
3344
3398
|
height: S
|
|
3345
3399
|
},
|
|
3346
3400
|
children: [
|
|
3347
|
-
/* @__PURE__ */ l("div", { className:
|
|
3401
|
+
/* @__PURE__ */ l("div", { className: X.pointer }),
|
|
3348
3402
|
/* @__PURE__ */ l("canvas", {
|
|
3349
3403
|
ref: f,
|
|
3350
|
-
className:
|
|
3404
|
+
className: X.canvas,
|
|
3351
3405
|
style: {
|
|
3352
3406
|
width: S,
|
|
3353
3407
|
height: S
|
|
@@ -3355,7 +3409,7 @@ var L = {
|
|
|
3355
3409
|
}),
|
|
3356
3410
|
/* @__PURE__ */ l("button", {
|
|
3357
3411
|
type: "button",
|
|
3358
|
-
className:
|
|
3412
|
+
className: X.spinBtn,
|
|
3359
3413
|
onClick: () => {
|
|
3360
3414
|
if (g || e.length === 0) return;
|
|
3361
3415
|
_(!0), y(null);
|
|
@@ -3363,7 +3417,7 @@ var L = {
|
|
|
3363
3417
|
x.current = l;
|
|
3364
3418
|
let u = (t) => {
|
|
3365
3419
|
if (l.cancelled) return;
|
|
3366
|
-
let n = t - c, r = Math.min(n / i, 1), a =
|
|
3420
|
+
let n = t - c, r = Math.min(n / i, 1), a = Ut(r), d = s + (o - s) * a;
|
|
3367
3421
|
if (p.current = d, w(d), r < 1) m.current = requestAnimationFrame(u);
|
|
3368
3422
|
else if (!l.cancelled) {
|
|
3369
3423
|
let t = T(d), n = e[t];
|
|
@@ -3377,11 +3431,11 @@ var L = {
|
|
|
3377
3431
|
})
|
|
3378
3432
|
]
|
|
3379
3433
|
}), v && !g && /* @__PURE__ */ u("p", {
|
|
3380
|
-
className:
|
|
3434
|
+
className: X.result,
|
|
3381
3435
|
children: ["恭喜获得:", /* @__PURE__ */ l("strong", { children: v.label })]
|
|
3382
3436
|
})]
|
|
3383
3437
|
});
|
|
3384
|
-
},
|
|
3438
|
+
}, Z = {
|
|
3385
3439
|
typewriter: "cos-typewriter-7UhOL",
|
|
3386
3440
|
terminal: "cos-terminal-NWNVN",
|
|
3387
3441
|
dots: "cos-dots-oulNg",
|
|
@@ -3389,11 +3443,11 @@ var L = {
|
|
|
3389
3443
|
prompt: "cos-prompt-Y4hVD",
|
|
3390
3444
|
cursor: "cos-cursor-m8hGi",
|
|
3391
3445
|
blink: "cos-blink-XykM7"
|
|
3392
|
-
},
|
|
3446
|
+
}, Gt = [
|
|
3393
3447
|
"Hello, cos-design!",
|
|
3394
3448
|
"欢迎来到组件库 ✨",
|
|
3395
3449
|
"Build something fun 🚀"
|
|
3396
|
-
],
|
|
3450
|
+
], Kt = ({ texts: e, speed: t, deleteSpeed: r, pause: i }) => {
|
|
3397
3451
|
let [a, o] = s(""), [c, d] = s(0), [f, p] = s(!1);
|
|
3398
3452
|
return n(() => {
|
|
3399
3453
|
let n = e[c % e.length], s;
|
|
@@ -3415,66 +3469,66 @@ var L = {
|
|
|
3415
3469
|
r,
|
|
3416
3470
|
i
|
|
3417
3471
|
]), /* @__PURE__ */ l("div", {
|
|
3418
|
-
className:
|
|
3472
|
+
className: Z.typewriter,
|
|
3419
3473
|
children: /* @__PURE__ */ u("div", {
|
|
3420
|
-
className:
|
|
3474
|
+
className: Z.terminal,
|
|
3421
3475
|
children: [/* @__PURE__ */ u("div", {
|
|
3422
|
-
className:
|
|
3476
|
+
className: Z.dots,
|
|
3423
3477
|
children: [
|
|
3424
3478
|
/* @__PURE__ */ l("span", {}),
|
|
3425
3479
|
/* @__PURE__ */ l("span", {}),
|
|
3426
3480
|
/* @__PURE__ */ l("span", {})
|
|
3427
3481
|
]
|
|
3428
3482
|
}), /* @__PURE__ */ u("p", {
|
|
3429
|
-
className:
|
|
3483
|
+
className: Z.text,
|
|
3430
3484
|
children: [
|
|
3431
3485
|
/* @__PURE__ */ l("span", {
|
|
3432
|
-
className:
|
|
3486
|
+
className: Z.prompt,
|
|
3433
3487
|
children: ">"
|
|
3434
3488
|
}),
|
|
3435
3489
|
a,
|
|
3436
3490
|
/* @__PURE__ */ l("span", {
|
|
3437
|
-
className:
|
|
3491
|
+
className: Z.cursor,
|
|
3438
3492
|
children: "|"
|
|
3439
3493
|
})
|
|
3440
3494
|
]
|
|
3441
3495
|
})]
|
|
3442
3496
|
})
|
|
3443
3497
|
});
|
|
3444
|
-
},
|
|
3445
|
-
let i = e.length > 0 ? e :
|
|
3446
|
-
return /* @__PURE__ */ l(
|
|
3498
|
+
}, qt = ({ texts: e = Gt, speed: t = 100, deleteSpeed: n = 50, pause: r = 2e3 }) => {
|
|
3499
|
+
let i = e.length > 0 ? e : Gt;
|
|
3500
|
+
return /* @__PURE__ */ l(Kt, {
|
|
3447
3501
|
texts: i,
|
|
3448
3502
|
speed: t,
|
|
3449
3503
|
deleteSpeed: n,
|
|
3450
3504
|
pause: r
|
|
3451
3505
|
}, i.join("\0"));
|
|
3452
|
-
},
|
|
3506
|
+
}, Q = {
|
|
3453
3507
|
waveButton: "cos-waveButton-Aa7G-",
|
|
3454
3508
|
btn: "cos-btn-WJrEN",
|
|
3455
3509
|
label: "cos-label-9BHOU",
|
|
3456
3510
|
wave: "cos-wave-GycLU",
|
|
3457
3511
|
ripple: "cos-ripple-5ZFpr"
|
|
3458
|
-
},
|
|
3459
|
-
className:
|
|
3512
|
+
}, Jt = ({ text: e = "点我试试", color: t = "#38bdf8", className: n, style: r, ...i }) => /* @__PURE__ */ l("div", {
|
|
3513
|
+
className: Q.waveButton,
|
|
3460
3514
|
children: /* @__PURE__ */ u("button", {
|
|
3461
3515
|
type: "button",
|
|
3462
|
-
className: `${
|
|
3516
|
+
className: `${Q.btn} ${n ?? ""}`,
|
|
3463
3517
|
style: {
|
|
3464
3518
|
"--wave-color": t,
|
|
3465
3519
|
...r
|
|
3466
3520
|
},
|
|
3467
3521
|
...i,
|
|
3468
3522
|
children: [
|
|
3469
|
-
/* @__PURE__ */ l("span", { className:
|
|
3470
|
-
/* @__PURE__ */ l("span", { className:
|
|
3523
|
+
/* @__PURE__ */ l("span", { className: Q.wave }),
|
|
3524
|
+
/* @__PURE__ */ l("span", { className: Q.wave }),
|
|
3471
3525
|
/* @__PURE__ */ l("span", {
|
|
3472
|
-
className:
|
|
3526
|
+
className: Q.label,
|
|
3473
3527
|
children: e
|
|
3474
3528
|
})
|
|
3475
3529
|
]
|
|
3476
3530
|
})
|
|
3477
|
-
}),
|
|
3531
|
+
}), Yt = 39, Xt = {
|
|
3478
3532
|
0: "sunny",
|
|
3479
3533
|
1: "sunny",
|
|
3480
3534
|
2: "partlyCloudy",
|
|
@@ -3482,15 +3536,15 @@ var L = {
|
|
|
3482
3536
|
45: "fog",
|
|
3483
3537
|
48: "fog",
|
|
3484
3538
|
51: "lightRain",
|
|
3485
|
-
53: "
|
|
3539
|
+
53: "moderateRain",
|
|
3486
3540
|
55: "moderateRain",
|
|
3487
|
-
56: "
|
|
3488
|
-
57: "
|
|
3541
|
+
56: "lightRain",
|
|
3542
|
+
57: "moderateRain",
|
|
3489
3543
|
61: "lightRain",
|
|
3490
3544
|
63: "moderateRain",
|
|
3491
3545
|
65: "heavyRain",
|
|
3492
|
-
66: "
|
|
3493
|
-
67: "
|
|
3546
|
+
66: "lightRain",
|
|
3547
|
+
67: "heavyRain",
|
|
3494
3548
|
71: "lightSnow",
|
|
3495
3549
|
73: "moderateSnow",
|
|
3496
3550
|
75: "heavySnow",
|
|
@@ -3501,28 +3555,28 @@ var L = {
|
|
|
3501
3555
|
85: "lightSnow",
|
|
3502
3556
|
86: "heavySnow",
|
|
3503
3557
|
95: "thunderstorm",
|
|
3504
|
-
96: "
|
|
3505
|
-
99: "
|
|
3506
|
-
},
|
|
3507
|
-
let n =
|
|
3508
|
-
return (n === "sunny" || n === "partlyCloudy" || n === "overcast") && t >=
|
|
3509
|
-
},
|
|
3558
|
+
96: "hail",
|
|
3559
|
+
99: "hail"
|
|
3560
|
+
}, Zt = (e, t = 0) => {
|
|
3561
|
+
let n = Xt[e] ?? "overcast";
|
|
3562
|
+
return (n === "sunny" || n === "partlyCloudy" || n === "overcast") && t >= Yt ? "gale" : n;
|
|
3563
|
+
}, Qt = {
|
|
3510
3564
|
weather: null,
|
|
3511
3565
|
status: "idle",
|
|
3512
3566
|
error: null,
|
|
3513
3567
|
current: null
|
|
3514
|
-
},
|
|
3568
|
+
}, $t = {
|
|
3515
3569
|
weather: null,
|
|
3516
3570
|
status: "locating",
|
|
3517
3571
|
error: null,
|
|
3518
3572
|
current: null
|
|
3519
|
-
},
|
|
3573
|
+
}, en = {
|
|
3520
3574
|
weather: null,
|
|
3521
3575
|
status: "fetching",
|
|
3522
3576
|
error: null,
|
|
3523
3577
|
current: null
|
|
3524
|
-
},
|
|
3525
|
-
let r =
|
|
3578
|
+
}, tn = (e) => e != null && Number.isFinite(e.latitude) && Number.isFinite(e.longitude), nn = (e = !0, t) => {
|
|
3579
|
+
let r = tn(t), i = r ? t.latitude : null, a = r ? t.longitude : null, o = e ? r ? en : $t : Qt, c = `${e}:${i},${a}`, [l, u] = s(o), [d, f] = s(c);
|
|
3526
3580
|
return d !== c && (f(c), u((t) => e && t.weather ? {
|
|
3527
3581
|
...o,
|
|
3528
3582
|
weather: t.weather,
|
|
@@ -3542,7 +3596,7 @@ var L = {
|
|
|
3542
3596
|
let c = Number(o?.current?.wind_speed_10m ?? 0);
|
|
3543
3597
|
if (t) return;
|
|
3544
3598
|
u({
|
|
3545
|
-
weather:
|
|
3599
|
+
weather: Zt(s, c),
|
|
3546
3600
|
status: "success",
|
|
3547
3601
|
error: null,
|
|
3548
3602
|
current: {
|
|
@@ -3597,13 +3651,192 @@ var L = {
|
|
|
3597
3651
|
i,
|
|
3598
3652
|
a
|
|
3599
3653
|
]), l;
|
|
3600
|
-
}
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
}
|
|
3654
|
+
};
|
|
3655
|
+
//#endregion
|
|
3656
|
+
//#region src/components/weatherBackground/scene/draw-atmosphere.ts
|
|
3657
|
+
function rn(e) {
|
|
3658
|
+
let t = e.activeWeather === "gale" ? 7 : 1;
|
|
3659
|
+
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);
|
|
3660
|
+
}
|
|
3661
|
+
function an(e) {
|
|
3662
|
+
let t = e.fogSprite;
|
|
3663
|
+
if (!t || e.state.fogBanks.length === 0) return;
|
|
3664
|
+
let { canvas: n, baseR: r } = t;
|
|
3665
|
+
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();
|
|
3666
|
+
}
|
|
3667
|
+
function on(e) {
|
|
3668
|
+
if (e.cfg.haze <= 0) return;
|
|
3669
|
+
let t = e.activeWeather === "smog" ? "177, 164, 135" : "220, 226, 232";
|
|
3670
|
+
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);
|
|
3671
|
+
}
|
|
3672
|
+
//#endregion
|
|
3673
|
+
//#region src/components/weatherBackground/lightning.ts
|
|
3674
|
+
function sn(e, t, n, r, i, a) {
|
|
3675
|
+
if (a <= 0) return [[e, t], [n, r]];
|
|
3676
|
+
let o = (e + n) / 2 + (Math.random() - .5) * i, s = (t + r) / 2, c = sn(e, t, o, s, i * .55, a - 1), l = sn(o, s, n, r, i * .55, a - 1);
|
|
3677
|
+
return [...c.slice(0, -1), ...l];
|
|
3678
|
+
}
|
|
3679
|
+
//#endregion
|
|
3680
|
+
//#region src/components/weatherBackground/scene/draw-effects.ts
|
|
3681
|
+
function cn(e) {
|
|
3682
|
+
if (e.state.windStreaks.length !== 0) for (let t of e.state.windStreaks) {
|
|
3683
|
+
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);
|
|
3684
|
+
let n = Math.sin(t.wave) * 8, r = t.x + t.length;
|
|
3685
|
+
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) {
|
|
3686
|
+
let r = t.x + t.length * .58, i = t.y - n * .4;
|
|
3687
|
+
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();
|
|
3688
|
+
}
|
|
3689
|
+
}
|
|
3690
|
+
}
|
|
3691
|
+
function ln(e) {
|
|
3692
|
+
if (e.cfg.lightning) {
|
|
3693
|
+
if (e.state.t >= e.state.nextStrike) {
|
|
3694
|
+
e.state.nextStrike = e.state.t + 150 + Math.random() * 300, e.state.flashAlpha = .5, e.state.boltLife = 9;
|
|
3695
|
+
let t = e.width * (.15 + Math.random() * .7);
|
|
3696
|
+
e.state.boltPoints = sn(t, e.height * .12, t + (Math.random() - .5) * e.width * .2, e.height * .92, 60, 6);
|
|
3697
|
+
}
|
|
3698
|
+
if (e.state.boltLife > 0) {
|
|
3699
|
+
--e.state.boltLife;
|
|
3700
|
+
let t = e.state.boltLife / 9;
|
|
3701
|
+
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;
|
|
3702
|
+
}
|
|
3703
|
+
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);
|
|
3704
|
+
}
|
|
3705
|
+
}
|
|
3706
|
+
//#endregion
|
|
3707
|
+
//#region src/components/weatherBackground/sprites/hail.ts
|
|
3708
|
+
var un = 3.2, dn = (e) => {
|
|
3709
|
+
let t = Math.ceil(e * 2.8 + 4), n = document.createElement("canvas");
|
|
3710
|
+
n.width = t, n.height = t;
|
|
3711
|
+
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) => {
|
|
3712
|
+
let r = n / o * Math.PI * 2 + (Math.random() - .5) * .22, s = e * (.72 + Math.random() * .44);
|
|
3713
|
+
return {
|
|
3714
|
+
x: i + Math.cos(r) * s,
|
|
3715
|
+
y: a + Math.sin(r) * s
|
|
3716
|
+
};
|
|
3717
|
+
}), c = (e, t) => ({
|
|
3718
|
+
x: (e.x + t.x) / 2,
|
|
3719
|
+
y: (e.y + t.y) / 2
|
|
3720
|
+
});
|
|
3721
|
+
r.beginPath();
|
|
3722
|
+
let l = c(s[s.length - 1], s[0]);
|
|
3723
|
+
r.moveTo(l.x, l.y);
|
|
3724
|
+
for (let e = 0; e < s.length; e++) {
|
|
3725
|
+
let t = c(s[e], s[(e + 1) % s.length]);
|
|
3726
|
+
r.quadraticCurveTo(s[e].x, s[e].y, t.x, t.y);
|
|
3727
|
+
}
|
|
3728
|
+
r.closePath();
|
|
3729
|
+
let u = i - e * .3, d = a - e * .34, f = r.createRadialGradient(u, d, e * .06, i, a, e * 1.2);
|
|
3730
|
+
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();
|
|
3731
|
+
let p = 1 + Math.floor(Math.random() * 2);
|
|
3732
|
+
for (let t = 0; t < p; t++) {
|
|
3733
|
+
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);
|
|
3734
|
+
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();
|
|
3735
|
+
}
|
|
3736
|
+
if (Math.random() < .75) {
|
|
3737
|
+
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);
|
|
3738
|
+
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();
|
|
3739
|
+
}
|
|
3740
|
+
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;
|
|
3741
|
+
}, fn = (e = 16) => Array.from({ length: e }, () => dn(un)), pn = (e) => e[Math.floor(Math.random() * e.length)], mn = (e, t, n, r, i = !0) => {
|
|
3742
|
+
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;
|
|
3743
|
+
}, hn = (e, t, n) => {
|
|
3744
|
+
let r = {
|
|
3745
|
+
x: 0,
|
|
3746
|
+
y: 0,
|
|
3747
|
+
r: 2,
|
|
3748
|
+
vx: 0,
|
|
3749
|
+
vy: 0,
|
|
3750
|
+
bounces: 0,
|
|
3751
|
+
opacity: 1,
|
|
3752
|
+
delay: 0,
|
|
3753
|
+
gravity: .16,
|
|
3754
|
+
phase: 0,
|
|
3755
|
+
gust: 0,
|
|
3756
|
+
maxBounces: 1,
|
|
3757
|
+
sprite: n[0],
|
|
3758
|
+
drawSize: 9.6,
|
|
3759
|
+
rotation: 0,
|
|
3760
|
+
rotationSpeed: 0
|
|
3761
|
+
};
|
|
3762
|
+
return mn(r, e, t, n, Math.random() < .72), r;
|
|
3763
|
+
};
|
|
3764
|
+
//#endregion
|
|
3765
|
+
//#region src/components/weatherBackground/scene/draw-precipitation.ts
|
|
3766
|
+
function gn(e) {
|
|
3767
|
+
if (!e.cfg.rain) return;
|
|
3768
|
+
let { wind: t, alpha: n, splash: r } = e.cfg.rain;
|
|
3769
|
+
e.ctx.strokeStyle = `rgba(214, 228, 240, ${n})`, e.ctx.lineWidth = 1.2, e.ctx.beginPath();
|
|
3770
|
+
for (let n of e.state.drops) {
|
|
3771
|
+
let i = Math.hypot(t, n.speed) || 1, a = t / i, o = n.speed / i;
|
|
3772
|
+
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({
|
|
3773
|
+
x: n.x,
|
|
3774
|
+
r: 1,
|
|
3775
|
+
alpha: .5
|
|
3776
|
+
}), n.y = -n.len, n.x = Math.random() * (e.width + 160) - 80);
|
|
3777
|
+
}
|
|
3778
|
+
e.ctx.stroke();
|
|
3779
|
+
for (let t = e.state.splashes.length - 1; t >= 0; t--) {
|
|
3780
|
+
let n = e.state.splashes[t];
|
|
3781
|
+
if (n.r += .8, n.alpha -= .035, n.alpha <= 0) {
|
|
3782
|
+
e.state.splashes.splice(t, 1);
|
|
3783
|
+
continue;
|
|
3784
|
+
}
|
|
3785
|
+
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();
|
|
3786
|
+
}
|
|
3787
|
+
}
|
|
3788
|
+
function _n(e) {
|
|
3789
|
+
for (let t of e.state.flakes) {
|
|
3790
|
+
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);
|
|
3791
|
+
let n = t.drawSize / 2;
|
|
3792
|
+
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();
|
|
3793
|
+
}
|
|
3794
|
+
}
|
|
3795
|
+
function vn(e) {
|
|
3796
|
+
if (e.state.hailstones.length === 0) return;
|
|
3797
|
+
let t = e.state.hailPool;
|
|
3798
|
+
for (let n of e.state.hailstones) {
|
|
3799
|
+
if (n.delay > 0) {
|
|
3800
|
+
--n.delay;
|
|
3801
|
+
continue;
|
|
3802
|
+
}
|
|
3803
|
+
let r = n.x, i = n.y;
|
|
3804
|
+
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;
|
|
3805
|
+
else {
|
|
3806
|
+
mn(n, e.width, e.height, t, !0);
|
|
3807
|
+
continue;
|
|
3808
|
+
}
|
|
3809
|
+
let a = n.drawSize / 2;
|
|
3810
|
+
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();
|
|
3811
|
+
}
|
|
3812
|
+
}
|
|
3813
|
+
//#endregion
|
|
3814
|
+
//#region src/components/weatherBackground/scene/draw-sky.ts
|
|
3815
|
+
function yn(e) {
|
|
3816
|
+
e.ctx.fillStyle = e.skyGradient, e.ctx.fillRect(0, 0, e.width, e.height);
|
|
3817
|
+
}
|
|
3818
|
+
function bn(e) {
|
|
3819
|
+
if (e.state.stars.length !== 0) for (let t of e.state.stars) {
|
|
3820
|
+
let n = .35 + (Math.sin(e.state.t * t.speed + t.phase) + 1) * .325;
|
|
3821
|
+
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();
|
|
3822
|
+
}
|
|
3823
|
+
}
|
|
3824
|
+
function xn(e) {
|
|
3825
|
+
let t = e.celestial;
|
|
3826
|
+
if (!t) return;
|
|
3827
|
+
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;
|
|
3828
|
+
n.drawImage(t.canvas, r - s, i - s, c, c);
|
|
3829
|
+
}
|
|
3830
|
+
function Sn(e) {
|
|
3831
|
+
if (e.activeNight) {
|
|
3832
|
+
bn(e), xn(e);
|
|
3833
|
+
return;
|
|
3834
|
+
}
|
|
3835
|
+
xn(e);
|
|
3836
|
+
}
|
|
3837
|
+
//#endregion
|
|
3838
|
+
//#region src/components/weatherBackground/configs.ts
|
|
3839
|
+
var Cn = {
|
|
3607
3840
|
sunny: {
|
|
3608
3841
|
sky: ["#4a9fe0", "#c8e8fb"],
|
|
3609
3842
|
sun: "full",
|
|
@@ -3912,7 +4145,9 @@ var L = {
|
|
|
3912
4145
|
snowCount: 160,
|
|
3913
4146
|
lightning: !1
|
|
3914
4147
|
}
|
|
3915
|
-
}
|
|
4148
|
+
};
|
|
4149
|
+
Cn.snow = Cn.moderateSnow;
|
|
4150
|
+
var wn = {
|
|
3916
4151
|
sunny: {
|
|
3917
4152
|
sky: ["#0b1a33", "#27476e"],
|
|
3918
4153
|
stars: 110
|
|
@@ -3977,16 +4212,150 @@ var L = {
|
|
|
3977
4212
|
sky: ["#131a26", "#333f4f"],
|
|
3978
4213
|
stars: 8
|
|
3979
4214
|
}
|
|
3980
|
-
}
|
|
4215
|
+
};
|
|
4216
|
+
wn.snow = wn.moderateSnow;
|
|
4217
|
+
var Tn = ([e, t, n]) => [
|
|
3981
4218
|
Math.round(e * .3 + 18),
|
|
3982
4219
|
Math.round(t * .3 + 24),
|
|
3983
4220
|
Math.round(n * .3 + 42)
|
|
3984
|
-
]
|
|
4221
|
+
];
|
|
4222
|
+
//#endregion
|
|
4223
|
+
//#region src/components/weatherBackground/sprites/cloud.ts
|
|
4224
|
+
function En(e, t, n, r) {
|
|
4225
|
+
let [i, a, o] = n, s = Infinity, c = Infinity, l = -Infinity, u = -Infinity;
|
|
4226
|
+
for (let n of t) {
|
|
4227
|
+
let t = n.dx * e, r = n.dy * e, i = n.r * e;
|
|
4228
|
+
s = Math.min(s, t - i), c = Math.min(c, r - i), l = Math.max(l, t + i), u = Math.max(u, r + i);
|
|
4229
|
+
}
|
|
4230
|
+
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");
|
|
4231
|
+
h.width = p, h.height = m;
|
|
4232
|
+
let g = h.getContext("2d");
|
|
4233
|
+
for (let n of t) {
|
|
4234
|
+
let t = n.dx * e - d, s = n.dy * e - f, c = n.r * e, l = g.createRadialGradient(t, s, 0, t, s, c);
|
|
4235
|
+
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();
|
|
4236
|
+
}
|
|
4237
|
+
return {
|
|
4238
|
+
sprite: h,
|
|
4239
|
+
ox: d,
|
|
4240
|
+
oy: f
|
|
4241
|
+
};
|
|
4242
|
+
}
|
|
4243
|
+
function Dn(e, t, n, r, i) {
|
|
4244
|
+
let a = .7 + Math.random() * .9, o = 4 + Math.floor(Math.random() * 3), s = Array.from({ length: o }, (e, t) => ({
|
|
4245
|
+
dx: (t - o / 2) * 26 + (Math.random() - .5) * 14,
|
|
4246
|
+
dy: (Math.random() - .5) * 14,
|
|
4247
|
+
r: 22 + Math.random() * 20
|
|
4248
|
+
})), { sprite: c, ox: l, oy: u } = En(a, s, r, i);
|
|
4249
|
+
return {
|
|
4250
|
+
x: Math.random() * (e + 240) - 120,
|
|
4251
|
+
y: t * .06 + Math.random() * t * n,
|
|
4252
|
+
scale: a,
|
|
4253
|
+
speed: .12 + Math.random() * .22,
|
|
4254
|
+
puffs: s,
|
|
4255
|
+
sprite: c,
|
|
4256
|
+
ox: l,
|
|
4257
|
+
oy: u
|
|
4258
|
+
};
|
|
4259
|
+
}
|
|
4260
|
+
function On(e, t = 120) {
|
|
4261
|
+
let n = t * 2, r = document.createElement("canvas");
|
|
4262
|
+
r.width = n, r.height = n;
|
|
4263
|
+
let i = r.getContext("2d"), a = i.createRadialGradient(t, t, 0, t, t, t);
|
|
4264
|
+
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(), {
|
|
4265
|
+
canvas: r,
|
|
4266
|
+
baseR: t
|
|
4267
|
+
};
|
|
4268
|
+
}
|
|
4269
|
+
//#endregion
|
|
4270
|
+
//#region src/components/weatherBackground/sprites/celestial.ts
|
|
4271
|
+
function kn(e, t) {
|
|
4272
|
+
let n = e.sun;
|
|
4273
|
+
if (n === "none") return null;
|
|
4274
|
+
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;
|
|
4275
|
+
n === "full" && (o = Math.max(o, 1.55 * t * 5.5)), o = Math.ceil(o + 2);
|
|
4276
|
+
let s = o * 2, c = document.createElement("canvas");
|
|
4277
|
+
c.width = s, c.height = s;
|
|
4278
|
+
let l = c.getContext("2d"), u = o, d = o;
|
|
4279
|
+
l.save(), l.globalCompositeOperation = "lighter";
|
|
4280
|
+
let f = l.createRadialGradient(u, d, 0, u, d, a);
|
|
4281
|
+
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);
|
|
4282
|
+
let p = t * (n === "full" ? 3.4 : 2.6), m = l.createRadialGradient(u, d, i * .15, u, d, p);
|
|
4283
|
+
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") {
|
|
4284
|
+
l.translate(u, d), l.scale(1.55, .55);
|
|
4285
|
+
let e = l.createRadialGradient(0, 0, 0, 0, 0, t * 5.5);
|
|
4286
|
+
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();
|
|
4287
|
+
}
|
|
4288
|
+
l.restore();
|
|
4289
|
+
let h = i * 2.05, g = l.createRadialGradient(u, d, 0, u, d, h);
|
|
4290
|
+
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();
|
|
4291
|
+
let _ = l.createRadialGradient(u, d, 0, u, d, i);
|
|
4292
|
+
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(), {
|
|
4293
|
+
canvas: c,
|
|
4294
|
+
half: o,
|
|
4295
|
+
breathSpeed: .018,
|
|
4296
|
+
breathAmp: .018
|
|
4297
|
+
};
|
|
4298
|
+
}
|
|
4299
|
+
function An(e, t, n) {
|
|
4300
|
+
if (e.sun === "none") return null;
|
|
4301
|
+
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");
|
|
4302
|
+
l.width = c, l.height = c;
|
|
4303
|
+
let u = l.getContext("2d"), d = s, f = s;
|
|
4304
|
+
u.save(), u.globalCompositeOperation = "lighter";
|
|
4305
|
+
let p = u.createRadialGradient(d, f, 0, d, f, o);
|
|
4306
|
+
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);
|
|
4307
|
+
let m = r * 2.6, h = u.createRadialGradient(d, f, r * .2, d, f, m);
|
|
4308
|
+
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();
|
|
4309
|
+
let g = u.createRadialGradient(d - r * .28, f - r * .3, 0, d, f, r);
|
|
4310
|
+
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();
|
|
4311
|
+
for (let e of [
|
|
4312
|
+
{
|
|
4313
|
+
dx: -.18,
|
|
4314
|
+
dy: .12,
|
|
4315
|
+
rx: .38,
|
|
4316
|
+
ry: .28,
|
|
4317
|
+
a: .14
|
|
4318
|
+
},
|
|
4319
|
+
{
|
|
4320
|
+
dx: .22,
|
|
4321
|
+
dy: -.08,
|
|
4322
|
+
rx: .26,
|
|
4323
|
+
ry: .2,
|
|
4324
|
+
a: .11
|
|
4325
|
+
},
|
|
4326
|
+
{
|
|
4327
|
+
dx: .05,
|
|
4328
|
+
dy: .32,
|
|
4329
|
+
rx: .2,
|
|
4330
|
+
ry: .14,
|
|
4331
|
+
a: .09
|
|
4332
|
+
}
|
|
4333
|
+
]) {
|
|
4334
|
+
let t = d + e.dx * r, n = f + e.dy * r, i = u.createRadialGradient(t, n, 0, t, n, e.rx * r);
|
|
4335
|
+
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();
|
|
4336
|
+
}
|
|
4337
|
+
for (let e of n) {
|
|
4338
|
+
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);
|
|
4339
|
+
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();
|
|
4340
|
+
}
|
|
4341
|
+
let _ = u.createRadialGradient(d - r * .35, f - r * .38, 0, d - r * .1, f - r * .1, r * .7);
|
|
4342
|
+
_.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();
|
|
4343
|
+
let v = u.createRadialGradient(d, f, r * .72, d, f, r * 1.35);
|
|
4344
|
+
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(), {
|
|
4345
|
+
canvas: l,
|
|
4346
|
+
half: s,
|
|
4347
|
+
breathSpeed: .012,
|
|
4348
|
+
breathAmp: .012
|
|
4349
|
+
};
|
|
4350
|
+
}
|
|
4351
|
+
//#endregion
|
|
4352
|
+
//#region src/components/weatherBackground/sprites/snow.ts
|
|
4353
|
+
var jn = (e) => {
|
|
3985
4354
|
let t = Math.ceil(e * 2 + 4), n = document.createElement("canvas");
|
|
3986
4355
|
n.width = t, n.height = t;
|
|
3987
4356
|
let r = n.getContext("2d"), i = r.createRadialGradient(t / 2, t / 2, 0, t / 2, t / 2, e + 1);
|
|
3988
4357
|
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
|
-
},
|
|
4358
|
+
}, Mn = (e) => {
|
|
3990
4359
|
let t = Math.ceil(e * 2 + 6), n = document.createElement("canvas");
|
|
3991
4360
|
n.width = t, n.height = t;
|
|
3992
4361
|
let r = n.getContext("2d");
|
|
@@ -4013,269 +4382,218 @@ var L = {
|
|
|
4013
4382
|
r.closePath(), r.stroke();
|
|
4014
4383
|
}
|
|
4015
4384
|
return n;
|
|
4016
|
-
},
|
|
4017
|
-
|
|
4385
|
+
}, Nn = () => ({
|
|
4386
|
+
dots: [
|
|
4387
|
+
1.2,
|
|
4388
|
+
1.6,
|
|
4389
|
+
2,
|
|
4390
|
+
2.3
|
|
4391
|
+
].map((e) => jn(e)),
|
|
4392
|
+
crystals: [
|
|
4393
|
+
2.6,
|
|
4394
|
+
3.2,
|
|
4395
|
+
3.8,
|
|
4396
|
+
4.4,
|
|
4397
|
+
5
|
|
4398
|
+
].map((e) => Mn(e * 2.4))
|
|
4399
|
+
}), Pn = (e) => e[Math.floor(Math.random() * e.length)], Fn = (e, t, n, r) => {
|
|
4400
|
+
let i = 1 + Math.random() ** 1.6 * 4.2, a = i >= 2.4, o = Pn(a ? n.crystals : n.dots), s = a ? i * 4.8 + 6 : i * 2 + 4;
|
|
4018
4401
|
return {
|
|
4019
4402
|
x: Math.random() * e,
|
|
4020
|
-
y:
|
|
4021
|
-
size:
|
|
4022
|
-
speed: .4 +
|
|
4403
|
+
y: r ?? Math.random() * t,
|
|
4404
|
+
size: i,
|
|
4405
|
+
speed: .4 + i * .28 + Math.random() * .4,
|
|
4023
4406
|
phase: Math.random() * Math.PI * 2,
|
|
4024
4407
|
drift: (Math.random() - .5) * .4,
|
|
4025
4408
|
rotation: Math.random() * Math.PI * 2,
|
|
4026
4409
|
rotationSpeed: (Math.random() - .5) * .025,
|
|
4027
4410
|
opacity: .55 + Math.random() * .45,
|
|
4028
|
-
sprite:
|
|
4411
|
+
sprite: o,
|
|
4412
|
+
drawSize: s
|
|
4029
4413
|
};
|
|
4030
|
-
},
|
|
4031
|
-
|
|
4032
|
-
let
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4414
|
+
}, In = (e, t) => t ? e === "smog" ? "96, 88, 66" : "138, 150, 168" : e === "smog" ? "168, 155, 126" : "226, 232, 238";
|
|
4415
|
+
function Ln(e) {
|
|
4416
|
+
let { ctx: t, width: n, height: r, activeWeather: i, activeNight: a } = e, o = Cn[i], s = wn[i], c = a ? s.sky : o.sky, l = a ? Tn(o.cloudColor) : o.cloudColor, u = n * .72, d = r * .26, f = Math.min(n, r) * .09, p = t.createLinearGradient(0, 0, 0, r);
|
|
4417
|
+
p.addColorStop(0, c[0]), p.addColorStop(1, c[1]);
|
|
4418
|
+
let m = a ? Array.from({ length: s.stars }, () => ({
|
|
4419
|
+
x: Math.random() * n,
|
|
4420
|
+
y: Math.random() * r * .72,
|
|
4421
|
+
r: .4 + Math.random() * 1.1,
|
|
4422
|
+
phase: Math.random() * Math.PI * 2,
|
|
4423
|
+
speed: .015 + Math.random() * .035
|
|
4424
|
+
})) : [], h = [
|
|
4425
|
+
{
|
|
4426
|
+
dx: -.32,
|
|
4427
|
+
dy: .08,
|
|
4428
|
+
r: .17
|
|
4429
|
+
},
|
|
4430
|
+
{
|
|
4431
|
+
dx: .24,
|
|
4432
|
+
dy: -.22,
|
|
4433
|
+
r: .12
|
|
4434
|
+
},
|
|
4435
|
+
{
|
|
4436
|
+
dx: .04,
|
|
4437
|
+
dy: .34,
|
|
4438
|
+
r: .1
|
|
4439
|
+
},
|
|
4440
|
+
{
|
|
4441
|
+
dx: .36,
|
|
4442
|
+
dy: .24,
|
|
4443
|
+
r: .07
|
|
4444
|
+
}
|
|
4445
|
+
], g = a ? An(o, f, h) : kn(o, f), _ = Array.from({ length: o.cloudCount }, () => Dn(n, r, o.cloudSpread, l, o.cloudAlpha)), v = o.rain ? Array.from({ length: o.rain.count }, () => ({
|
|
4446
|
+
x: Math.random() * (n + 160) - 80,
|
|
4447
|
+
y: Math.random() * r,
|
|
4448
|
+
len: 8 + Math.random() * 10,
|
|
4449
|
+
speed: o.rain.speed * (.75 + Math.random() * .5)
|
|
4450
|
+
})) : [], y = [], b = Array.from({ length: o.fogBanks }, (e, t) => ({
|
|
4451
|
+
x: Math.random() * n,
|
|
4452
|
+
y: t / Math.max(o.fogBanks - 1, 1) * r * .9 + r * .05,
|
|
4453
|
+
rw: n * (.25 + Math.random() * .3),
|
|
4454
|
+
rh: r * (.08 + Math.random() * .08),
|
|
4455
|
+
speed: (.1 + Math.random() * .25) * (t % 2 == 0 ? 1 : -1),
|
|
4456
|
+
alpha: .16 + Math.random() * .14
|
|
4457
|
+
})), x = o.fogBanks > 0 ? On(In(i, a)) : null, S = o.snowCount > 0 ? Nn() : null, C = S == null ? [] : Array.from({ length: o.snowCount }, () => Fn(n, r, S)), w = i === "hail" ? fn() : null, T = w == null ? [] : Array.from({ length: 145 }, () => hn(n, r, w)), ee = i === "gale" ? Array.from({ length: 46 }, () => ({
|
|
4458
|
+
x: Math.random() * n,
|
|
4459
|
+
y: Math.random() * r,
|
|
4460
|
+
length: 45 + Math.random() * 130,
|
|
4461
|
+
speed: 8 + Math.random() * 10,
|
|
4462
|
+
wave: Math.random() * Math.PI * 2,
|
|
4463
|
+
alpha: .12 + Math.random() * .3,
|
|
4464
|
+
width: .6 + Math.random() * 1.2
|
|
4465
|
+
})) : [], te = [], E = 120 + Math.random() * 240;
|
|
4466
|
+
return {
|
|
4467
|
+
sky: c,
|
|
4468
|
+
cloudRgb: l,
|
|
4469
|
+
cfg: o,
|
|
4470
|
+
sunX: u,
|
|
4471
|
+
sunY: d,
|
|
4472
|
+
sunR: f,
|
|
4473
|
+
skyGradient: p,
|
|
4474
|
+
celestial: g,
|
|
4475
|
+
fogSprite: x,
|
|
4476
|
+
state: {
|
|
4477
|
+
stars: m,
|
|
4478
|
+
moonCraters: h,
|
|
4479
|
+
clouds: _,
|
|
4480
|
+
drops: v,
|
|
4481
|
+
splashes: y,
|
|
4482
|
+
fogBanks: b,
|
|
4483
|
+
flakes: C,
|
|
4484
|
+
hailstones: T,
|
|
4485
|
+
hailPool: w ?? [],
|
|
4486
|
+
windStreaks: ee,
|
|
4487
|
+
t: 0,
|
|
4488
|
+
flashAlpha: 0,
|
|
4489
|
+
boltLife: 0,
|
|
4490
|
+
boltPoints: te,
|
|
4491
|
+
nextStrike: E
|
|
4492
|
+
}
|
|
4493
|
+
};
|
|
4494
|
+
}
|
|
4495
|
+
//#endregion
|
|
4496
|
+
//#region src/components/weatherBackground/scene/create-weather-scene.ts
|
|
4497
|
+
function Rn(e, t) {
|
|
4498
|
+
t && (e.state.t += 1), yn(e), Sn(e), rn(e), an(e), on(e), gn(e), _n(e), vn(e), cn(e), ln(e);
|
|
4499
|
+
}
|
|
4500
|
+
function zn(e) {
|
|
4501
|
+
let { ctx: t, width: n, height: r, activeWeather: i, activeNight: a } = e, o = {
|
|
4502
|
+
ctx: t,
|
|
4503
|
+
width: n,
|
|
4504
|
+
height: r,
|
|
4505
|
+
activeWeather: i,
|
|
4506
|
+
activeNight: a,
|
|
4507
|
+
...Ln(e)
|
|
4508
|
+
};
|
|
4509
|
+
if (typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return Rn(o, !1), () => void 0;
|
|
4510
|
+
let s = 0, c = document.hidden, l = v((e) => {
|
|
4511
|
+
c = e;
|
|
4512
|
+
}), u = () => {
|
|
4513
|
+
s = requestAnimationFrame(u), !c && Rn(o, !0);
|
|
4514
|
+
};
|
|
4515
|
+
return u(), () => {
|
|
4516
|
+
cancelAnimationFrame(s), l();
|
|
4517
|
+
};
|
|
4518
|
+
}
|
|
4519
|
+
var $ = {
|
|
4520
|
+
weatherBackground: "cos-weatherBackground-Mnm22",
|
|
4521
|
+
canvas: "cos-canvas-nvqMt",
|
|
4522
|
+
loadingOverlay: "cos-loadingOverlay-O58B7",
|
|
4523
|
+
loadingSpinner: "cos-loadingSpinner-NQ9yG",
|
|
4524
|
+
"weather-loading-spin": "cos-weather-loading-spin-IPFWZ"
|
|
4525
|
+
}, Bn = ({ width: e = 800, height: t = 450, weather: r = "sunny", night: i = !1, live: a = !1, latitude: s, longitude: c, onLiveWeather: d, loading: f = !1 }) => {
|
|
4526
|
+
let p = o(null), m = nn(a, s != null && c != null ? {
|
|
4036
4527
|
latitude: s,
|
|
4037
4528
|
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"),
|
|
4529
|
+
} : 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
4530
|
return n(() => {
|
|
4040
|
-
|
|
4531
|
+
v.current = d;
|
|
4041
4532
|
}), n(() => {
|
|
4042
|
-
m.weather &&
|
|
4533
|
+
m.weather && v.current?.(m.weather);
|
|
4043
4534
|
}, [m.weather]), n(() => {
|
|
4044
4535
|
let n = p.current;
|
|
4045
4536
|
if (!n) return;
|
|
4046
4537
|
let r = window.devicePixelRatio || 1;
|
|
4047
4538
|
n.width = e * r, n.height = t * r;
|
|
4048
4539
|
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
|
-
};
|
|
4540
|
+
if (i) return i.setTransform(r, 0, 0, r, 0, 0), zn({
|
|
4541
|
+
ctx: i,
|
|
4542
|
+
width: e,
|
|
4543
|
+
height: t,
|
|
4544
|
+
activeWeather: h,
|
|
4545
|
+
activeNight: g
|
|
4546
|
+
});
|
|
4236
4547
|
}, [
|
|
4237
4548
|
g,
|
|
4238
4549
|
h,
|
|
4239
4550
|
t,
|
|
4240
4551
|
e
|
|
4241
4552
|
]), /* @__PURE__ */ u("div", {
|
|
4242
|
-
className:
|
|
4553
|
+
className: $.weatherBackground,
|
|
4243
4554
|
style: {
|
|
4244
4555
|
width: e,
|
|
4245
4556
|
height: t
|
|
4246
4557
|
},
|
|
4247
4558
|
children: [/* @__PURE__ */ l("canvas", {
|
|
4248
4559
|
ref: p,
|
|
4249
|
-
className:
|
|
4560
|
+
className: $.canvas,
|
|
4250
4561
|
style: {
|
|
4251
4562
|
width: e,
|
|
4252
4563
|
height: t
|
|
4253
|
-
}
|
|
4564
|
+
},
|
|
4565
|
+
role: "img",
|
|
4566
|
+
"aria-label": `天气背景:${h}${g ? "(夜间)" : ""}`
|
|
4254
4567
|
}), _ && /* @__PURE__ */ u("div", {
|
|
4255
|
-
className:
|
|
4256
|
-
|
|
4568
|
+
className: $.loadingOverlay,
|
|
4569
|
+
role: "status",
|
|
4570
|
+
"aria-live": "polite",
|
|
4571
|
+
children: [/* @__PURE__ */ l("div", {
|
|
4572
|
+
className: $.loadingSpinner,
|
|
4573
|
+
"aria-hidden": !0
|
|
4574
|
+
}), /* @__PURE__ */ l("span", { children: "天气加载中…" })]
|
|
4257
4575
|
})]
|
|
4258
4576
|
});
|
|
4259
|
-
},
|
|
4577
|
+
}, Vn = {
|
|
4260
4578
|
waveText: "cos-waveText-Zy2Tp",
|
|
4261
4579
|
text: "cos-text-el-KR",
|
|
4262
4580
|
char: "cos-char-Y9-mV",
|
|
4263
4581
|
wave: "cos-wave-jVRCz"
|
|
4264
|
-
},
|
|
4265
|
-
className:
|
|
4582
|
+
}, Hn = ({ text: e = "WAVE", amplitude: t = 12, color: n = "#38bdf8", fontSize: r = 56 }) => /* @__PURE__ */ l("div", {
|
|
4583
|
+
className: Vn.waveText,
|
|
4266
4584
|
children: /* @__PURE__ */ l("h1", {
|
|
4267
|
-
className:
|
|
4585
|
+
className: Vn.text,
|
|
4268
4586
|
style: {
|
|
4269
4587
|
fontSize: r,
|
|
4270
4588
|
"--wave-color": n,
|
|
4271
4589
|
"--wave-amp": `${t}px`
|
|
4272
4590
|
},
|
|
4273
4591
|
children: e.split("").map((e, t) => /* @__PURE__ */ l("span", {
|
|
4274
|
-
className:
|
|
4592
|
+
className: Vn.char,
|
|
4275
4593
|
style: { animationDelay: `${t * .1}s` },
|
|
4276
4594
|
children: e === " " ? "\xA0" : e
|
|
4277
4595
|
}, `${e}-${t}`))
|
|
4278
4596
|
})
|
|
4279
4597
|
});
|
|
4280
4598
|
//#endregion
|
|
4281
|
-
export { x as AudioVisualizer, _ as Aurora, f as BarcodeScan, m as BurnAway, C as CanvasClock,
|
|
4599
|
+
export { x as AudioVisualizer, _ as Aurora, f as BarcodeScan, m as BurnAway, C as CanvasClock, te as Charge, D as ClickSpark, ne as Confetti, ce as Countdown, he as CursorTrail, ie as CyberGrid, _e as DiceRoll, ue as DnaHelix, ye as DoublePendulum, pe as ElectricArc, Ee as Fireworks, ke as FlipCounter, Pe as GlitchText, Me as GradientFlow, Le as GravityBalls, Re as HolographicCard, He as LiquidGlass, ze as LiquidProgress, Ve as LorenzAttractor, We as MagneticButton, Ke as MatrixRain, Xe as MazeGenerator, Je as MetaballPool, Qe as MeteorRain, $e as NeonText, tt as NewtonCradle, rt as OrbitalChart, at as ParticleNetwork, st as PlasmaBall, yt as ProgressChest, xt as RadarScan, St as RedPacketRain, Ct as ReturnCity, kt as RippleWater, Tt as RopeChain, Mt as ScrambleText, Nt as ScratchCard, It as SlotMachine, dt as SmokeFog, gt as Snowfall, mt as SolarSystem, Et as Speedometer, Rt as SplitReveal, Bt as Spotlight, vt as Starfield, Dt as TimelinePulse, Wt as Turntable, qt as Typewriter, Jt as WaveButton, Hn as WaveText, Bn as WeatherBackground, Zt as mapWmoCodeToWeatherType, nn as useLiveWeather };
|