cos-design 3.5.4 → 3.5.5
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/dist/index.cjs +3 -3
- package/dist/index.js +1034 -540
- package/dist/src/components/index.d.ts +11 -1
- package/dist/src/components/weatherBackground/day-cycle.d.ts +53 -0
- package/dist/src/components/weatherBackground/fog.d.ts +25 -0
- package/dist/src/components/weatherBackground/hail-level.d.ts +24 -0
- package/dist/src/components/weatherBackground/live-weather.d.ts +51 -2
- package/dist/src/components/weatherBackground/precipitation.d.ts +51 -0
- package/dist/src/components/weatherBackground/scene/init-state.d.ts +29 -0
- package/dist/src/components/weatherBackground/scene/runtime.d.ts +19 -2
- package/dist/src/components/weatherBackground/smog.d.ts +17 -0
- package/dist/src/components/weatherBackground/sprites/hail.d.ts +8 -2
- package/dist/src/components/weatherBackground/types.d.ts +63 -9
- package/dist/src/components/weatherBackground/wind.d.ts +68 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -433,7 +433,7 @@ import './index.css';var d = {
|
|
|
433
433
|
gravity: Math.random() * .15 + .12
|
|
434
434
|
};
|
|
435
435
|
});
|
|
436
|
-
},
|
|
436
|
+
}, P = e(({ width: e = 800, height: r = 400, auto: a = !0, particleCount: s = 120 }, c) => {
|
|
437
437
|
let d = o(null), f = o([]), p = o(0), m = o({
|
|
438
438
|
width: e,
|
|
439
439
|
height: r,
|
|
@@ -486,11 +486,11 @@ import './index.css';var d = {
|
|
|
486
486
|
})]
|
|
487
487
|
});
|
|
488
488
|
});
|
|
489
|
-
|
|
490
|
-
var
|
|
489
|
+
P.displayName = "Confetti";
|
|
490
|
+
var F = {
|
|
491
491
|
cyberGrid: "cos-cyberGrid-VgJwl",
|
|
492
492
|
canvas: "cos-canvas--Mq-O"
|
|
493
|
-
},
|
|
493
|
+
}, I = ({ 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 P = {
|
|
|
532
532
|
i,
|
|
533
533
|
e
|
|
534
534
|
]), /* @__PURE__ */ l("div", {
|
|
535
|
-
className:
|
|
535
|
+
className: F.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: F.canvas,
|
|
543
543
|
style: {
|
|
544
544
|
width: e,
|
|
545
545
|
height: t
|
|
546
546
|
}
|
|
547
547
|
})
|
|
548
548
|
});
|
|
549
|
-
},
|
|
549
|
+
}, L = {
|
|
550
550
|
countdown: "cos-countdown-5ZKKP",
|
|
551
551
|
unit: "cos-unit-dth8N",
|
|
552
552
|
value: "cos-value-yVzcP",
|
|
@@ -554,7 +554,7 @@ var P = {
|
|
|
554
554
|
ended: "cos-ended-c0dsD",
|
|
555
555
|
pulse: "cos-pulse-krQd-",
|
|
556
556
|
invalid: "cos-invalid-d6t-L"
|
|
557
|
-
},
|
|
557
|
+
}, R = (e) => e instanceof Date ? e.getTime() : typeof e == "number" ? e : new Date(e).getTime(), ee = (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 P = {
|
|
|
563
563
|
minutes: Math.floor(n % 3600 / 60),
|
|
564
564
|
seconds: n % 60
|
|
565
565
|
};
|
|
566
|
-
},
|
|
566
|
+
}, te = [
|
|
567
567
|
{
|
|
568
568
|
key: "days",
|
|
569
569
|
label: "天"
|
|
@@ -580,8 +580,8 @@ var P = {
|
|
|
580
580
|
key: "seconds",
|
|
581
581
|
label: "秒"
|
|
582
582
|
}
|
|
583
|
-
],
|
|
584
|
-
let c = a(() =>
|
|
583
|
+
], ne = ({ targetDate: e, onEnd: t, showLabels: r = !0, color: i = "#f472b6" }) => {
|
|
584
|
+
let c = a(() => R(e), [e]), d = !Number.isNaN(c), [, f] = s(0), p = o(!1), m = o(t), h = d ? ee(c) : {
|
|
585
585
|
days: 0,
|
|
586
586
|
hours: 0,
|
|
587
587
|
minutes: 0,
|
|
@@ -601,32 +601,32 @@ var P = {
|
|
|
601
601
|
}, 1e3);
|
|
602
602
|
return () => clearInterval(e);
|
|
603
603
|
}, [d, c]), d ? /* @__PURE__ */ u("div", {
|
|
604
|
-
className:
|
|
604
|
+
className: L.countdown,
|
|
605
605
|
style: { "--countdown-color": i },
|
|
606
|
-
children: [
|
|
607
|
-
className:
|
|
606
|
+
children: [te.map(({ key: e, label: t }) => /* @__PURE__ */ u("div", {
|
|
607
|
+
className: L.unit,
|
|
608
608
|
children: [/* @__PURE__ */ l("div", {
|
|
609
|
-
className:
|
|
609
|
+
className: L.value,
|
|
610
610
|
children: String(h[e]).padStart(2, "0")
|
|
611
611
|
}), r && /* @__PURE__ */ l("span", {
|
|
612
|
-
className:
|
|
612
|
+
className: L.label,
|
|
613
613
|
children: t
|
|
614
614
|
})]
|
|
615
615
|
}, e)), h.total <= 0 && /* @__PURE__ */ l("p", {
|
|
616
|
-
className:
|
|
616
|
+
className: L.ended,
|
|
617
617
|
children: "时间到!"
|
|
618
618
|
})]
|
|
619
619
|
}) : /* @__PURE__ */ l("div", {
|
|
620
|
-
className:
|
|
620
|
+
className: L.countdown,
|
|
621
621
|
children: /* @__PURE__ */ l("p", {
|
|
622
|
-
className:
|
|
622
|
+
className: L.invalid,
|
|
623
623
|
children: "无效的目标时间"
|
|
624
624
|
})
|
|
625
625
|
});
|
|
626
|
-
},
|
|
626
|
+
}, re = {
|
|
627
627
|
dnaHelix: "cos-dnaHelix-nEQLW",
|
|
628
628
|
canvas: "cos-canvas-uEV8B"
|
|
629
|
-
},
|
|
629
|
+
}, ie = ({ 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 P = {
|
|
|
656
656
|
r,
|
|
657
657
|
e
|
|
658
658
|
]), /* @__PURE__ */ l("div", {
|
|
659
|
-
className:
|
|
659
|
+
className: re.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: re.canvas,
|
|
667
667
|
style: {
|
|
668
668
|
width: e,
|
|
669
669
|
height: t
|
|
670
670
|
}
|
|
671
671
|
})
|
|
672
672
|
});
|
|
673
|
-
},
|
|
673
|
+
}, ae = {
|
|
674
674
|
electricArc: "cos-electricArc-BFlY3",
|
|
675
675
|
canvas: "cos-canvas-iowDx"
|
|
676
|
-
},
|
|
676
|
+
}, oe = (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 = oe(e, t, o + f, s + p, i * .6, a - 1), h = oe(o + f, s + p, n, r, i * .6, a - 1);
|
|
679
679
|
return [...m.slice(0, -1), ...h];
|
|
680
|
-
},
|
|
680
|
+
}, se = ({ 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 P = {
|
|
|
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 = oe(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 P = {
|
|
|
705
705
|
t,
|
|
706
706
|
e
|
|
707
707
|
]), /* @__PURE__ */ l("div", {
|
|
708
|
-
className:
|
|
708
|
+
className: ae.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: ae.canvas,
|
|
716
716
|
style: {
|
|
717
717
|
width: e,
|
|
718
718
|
height: t
|
|
719
719
|
}
|
|
720
720
|
})
|
|
721
721
|
});
|
|
722
|
-
},
|
|
722
|
+
}, ce = {
|
|
723
723
|
cursorTrail: "cos-cursorTrail-fpz5p",
|
|
724
724
|
canvas: "cos-canvas-Iuyp3",
|
|
725
725
|
hint: "cos-hint-9GLHx"
|
|
726
|
-
},
|
|
726
|
+
}, le = ({ 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 P = {
|
|
|
762
762
|
t,
|
|
763
763
|
r
|
|
764
764
|
]), /* @__PURE__ */ u("div", {
|
|
765
|
-
className:
|
|
765
|
+
className: ce.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: ce.canvas,
|
|
773
773
|
style: {
|
|
774
774
|
width: r,
|
|
775
775
|
height: i
|
|
@@ -782,11 +782,11 @@ var P = {
|
|
|
782
782
|
};
|
|
783
783
|
}
|
|
784
784
|
}), /* @__PURE__ */ l("p", {
|
|
785
|
-
className:
|
|
785
|
+
className: ce.hint,
|
|
786
786
|
children: "移动鼠标查看粒子轨迹"
|
|
787
787
|
})]
|
|
788
788
|
});
|
|
789
|
-
},
|
|
789
|
+
}, z = {
|
|
790
790
|
diceRoll: "cos-diceRoll-GDwjV",
|
|
791
791
|
scene: "cos-scene-tmnKM",
|
|
792
792
|
cube: "cos-cube-RklEa",
|
|
@@ -801,7 +801,7 @@ var P = {
|
|
|
801
801
|
face6: "cos-face6-Yp-MX",
|
|
802
802
|
rollBtn: "cos-rollBtn-nXMWJ",
|
|
803
803
|
result: "cos-result-kXzu9"
|
|
804
|
-
},
|
|
804
|
+
}, ue = {
|
|
805
805
|
1: {
|
|
806
806
|
x: 0,
|
|
807
807
|
y: 0
|
|
@@ -826,7 +826,7 @@ var P = {
|
|
|
826
826
|
x: 90,
|
|
827
827
|
y: 0
|
|
828
828
|
}
|
|
829
|
-
},
|
|
829
|
+
}, de = ({ 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 P = {
|
|
|
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 = ue[e] ?? ue[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 P = {
|
|
|
876
876
|
[75, 75]
|
|
877
877
|
]
|
|
878
878
|
}[e] ?? []).map(([e, t], n) => /* @__PURE__ */ l("span", {
|
|
879
|
-
className:
|
|
879
|
+
className: z.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: z.diceRoll,
|
|
887
887
|
children: [
|
|
888
888
|
/* @__PURE__ */ l("div", {
|
|
889
|
-
className:
|
|
889
|
+
className: z.scene,
|
|
890
890
|
children: /* @__PURE__ */ l("div", {
|
|
891
|
-
className: `${
|
|
891
|
+
className: `${z.cube} ${r ? z.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 P = {
|
|
|
898
898
|
5,
|
|
899
899
|
6
|
|
900
900
|
].map((e) => /* @__PURE__ */ l("div", {
|
|
901
|
-
className: `${
|
|
901
|
+
className: `${z.face} ${z[`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: z.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: z.result,
|
|
915
915
|
children: ["点数: ", a]
|
|
916
916
|
})
|
|
917
917
|
]
|
|
918
918
|
});
|
|
919
|
-
},
|
|
919
|
+
}, fe = {
|
|
920
920
|
doublePendulum: "cos-doublePendulum-FUEeK",
|
|
921
921
|
canvas: "cos-canvas-OVkhW"
|
|
922
|
-
},
|
|
922
|
+
}, pe = ({ 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,
|
|
@@ -956,32 +956,32 @@ var P = {
|
|
|
956
956
|
r,
|
|
957
957
|
e
|
|
958
958
|
]), /* @__PURE__ */ l("div", {
|
|
959
|
-
className:
|
|
959
|
+
className: fe.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: fe.canvas,
|
|
967
967
|
style: {
|
|
968
968
|
width: e,
|
|
969
969
|
height: t
|
|
970
970
|
}
|
|
971
971
|
})
|
|
972
972
|
});
|
|
973
|
-
},
|
|
973
|
+
}, me = {
|
|
974
974
|
fireworks: "cos-fireworks-fsSqL",
|
|
975
975
|
canvas: "cos-canvas-spL8G",
|
|
976
976
|
hint: "cos-hint-5XDRH"
|
|
977
|
-
},
|
|
977
|
+
}, he = [
|
|
978
978
|
"#ff6b6b",
|
|
979
979
|
"#ffd93d",
|
|
980
980
|
"#6bcb77",
|
|
981
981
|
"#4d96ff",
|
|
982
982
|
"#a66cff",
|
|
983
983
|
"#ff85c0"
|
|
984
|
-
],
|
|
984
|
+
], ge = .12, _e = 240, ve = () => he[Math.floor(Math.random() * he.length)], ye = (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 P = {
|
|
|
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 : ve(),
|
|
995
995
|
decay: Math.random() * .015 + .01
|
|
996
996
|
};
|
|
997
997
|
});
|
|
998
|
-
},
|
|
998
|
+
}, be = 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 P = {
|
|
|
1003
1003
|
y: r,
|
|
1004
1004
|
vy: -(Math.random() * 4 + 6),
|
|
1005
1005
|
targetY: Math.random() * r * .35 + r * .15,
|
|
1006
|
-
color:
|
|
1006
|
+
color: ve(),
|
|
1007
1007
|
exploded: !1,
|
|
1008
1008
|
particles: [],
|
|
1009
1009
|
age: 0
|
|
@@ -1022,9 +1022,9 @@ var P = {
|
|
|
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 += ge, 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 >= _e;
|
|
1027
|
+
return (t || n || r || a) && (e.exploded = !0, e.particles = ye(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 P = {
|
|
|
1038
1038
|
p,
|
|
1039
1039
|
e
|
|
1040
1040
|
]), /* @__PURE__ */ u("div", {
|
|
1041
|
-
className:
|
|
1041
|
+
className: me.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: me.canvas,
|
|
1049
1049
|
style: {
|
|
1050
1050
|
width: e,
|
|
1051
1051
|
height: r
|
|
@@ -1055,13 +1055,13 @@ var P = {
|
|
|
1055
1055
|
p(e.clientX - t.left);
|
|
1056
1056
|
}
|
|
1057
1057
|
}), /* @__PURE__ */ l("p", {
|
|
1058
|
-
className:
|
|
1058
|
+
className: me.hint,
|
|
1059
1059
|
children: "点击画布燃放烟花"
|
|
1060
1060
|
})]
|
|
1061
1061
|
});
|
|
1062
1062
|
});
|
|
1063
|
-
|
|
1064
|
-
var
|
|
1063
|
+
be.displayName = "Fireworks";
|
|
1064
|
+
var B = {
|
|
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
|
+
}, xe = (e, t) => Math.max(0, Math.floor(e)).toString().padStart(t, "0").slice(-t), Se = ({ 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: B.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: `${B.digitCard} ${a ? B.isFlipping : ""}`,
|
|
1093
1093
|
children: [
|
|
1094
1094
|
/* @__PURE__ */ l("div", {
|
|
1095
|
-
className:
|
|
1095
|
+
className: B.staticTop,
|
|
1096
1096
|
children: /* @__PURE__ */ l("span", { children: m })
|
|
1097
1097
|
}),
|
|
1098
1098
|
/* @__PURE__ */ l("div", {
|
|
1099
|
-
className:
|
|
1099
|
+
className: B.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: `${B.flap} ${B.flapTop}`,
|
|
1104
1104
|
children: /* @__PURE__ */ l("span", { children: f })
|
|
1105
1105
|
}), /* @__PURE__ */ l("div", {
|
|
1106
|
-
className: `${
|
|
1106
|
+
className: `${B.flap} ${B.flapBottom}`,
|
|
1107
1107
|
children: /* @__PURE__ */ l("span", { children: e })
|
|
1108
1108
|
})] })
|
|
1109
1109
|
]
|
|
1110
1110
|
})
|
|
1111
1111
|
});
|
|
1112
|
-
},
|
|
1113
|
-
let i =
|
|
1112
|
+
}, Ce = ({ value: e, digits: t = 4, color: n = "#38bdf8", duration: r = 600 }) => {
|
|
1113
|
+
let i = xe(e, t).split("");
|
|
1114
1114
|
return /* @__PURE__ */ l("div", {
|
|
1115
|
-
className:
|
|
1116
|
-
children: i.map((e, t) => /* @__PURE__ */ l(
|
|
1115
|
+
className: B.flipCounter,
|
|
1116
|
+
children: i.map((e, t) => /* @__PURE__ */ l(Se, {
|
|
1117
1117
|
digit: e,
|
|
1118
1118
|
color: n,
|
|
1119
1119
|
duration: r
|
|
1120
1120
|
}, t))
|
|
1121
1121
|
});
|
|
1122
|
-
},
|
|
1122
|
+
}, we = {
|
|
1123
1123
|
gradientFlow: "cos-gradientFlow-XhN16",
|
|
1124
1124
|
text: "cos-text-ORuqk",
|
|
1125
1125
|
flow: "cos-flow-9FzMA"
|
|
1126
|
-
},
|
|
1126
|
+
}, Te = [
|
|
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
|
+
], Ee = ({ text: e = "GRADIENT", colors: t = Te, fontSize: n = 64 }) => {
|
|
1133
|
+
let r = t.length >= 2 ? t.join(", ") : Te.join(", ");
|
|
1134
1134
|
return /* @__PURE__ */ l("div", {
|
|
1135
|
-
className:
|
|
1135
|
+
className: we.gradientFlow,
|
|
1136
1136
|
children: /* @__PURE__ */ l("h1", {
|
|
1137
|
-
className:
|
|
1137
|
+
className: we.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
|
+
}, De = {
|
|
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
|
+
}, Oe = ({ text: e = "GLITCH", color: t = "#f8fafc", glitchColor1: n = "#ff00de", glitchColor2: r = "#00f0ff", fontSize: i = 64 }) => /* @__PURE__ */ l("div", {
|
|
1151
|
+
className: De.glitchText,
|
|
1152
1152
|
children: /* @__PURE__ */ l("h1", {
|
|
1153
|
-
className:
|
|
1153
|
+
className: De.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
|
+
}), ke = {
|
|
1164
1164
|
gravityBalls: "cos-gravityBalls-LdwFo",
|
|
1165
1165
|
canvas: "cos-canvas-n7esd"
|
|
1166
|
-
},
|
|
1166
|
+
}, Ae = [
|
|
1167
1167
|
"#38bdf8",
|
|
1168
1168
|
"#a78bfa",
|
|
1169
1169
|
"#f472b6",
|
|
1170
1170
|
"#4ade80",
|
|
1171
1171
|
"#fbbf24"
|
|
1172
|
-
],
|
|
1172
|
+
], je = ({ 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: Ae[Math.floor(Math.random() * Ae.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: ke.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: ke.canvas,
|
|
1229
1229
|
style: {
|
|
1230
1230
|
width: e,
|
|
1231
1231
|
height: t
|
|
1232
1232
|
}
|
|
1233
1233
|
})
|
|
1234
1234
|
});
|
|
1235
|
-
},
|
|
1235
|
+
}, V = {
|
|
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
|
+
}, Me = ({ title: e = "全息卡片", subtitle: t = "移动鼠标体验 3D 效果", image: n }) => {
|
|
1243
1243
|
let r = o(null);
|
|
1244
1244
|
return /* @__PURE__ */ l("div", {
|
|
1245
|
-
className:
|
|
1245
|
+
className: V.wrap,
|
|
1246
1246
|
children: /* @__PURE__ */ u("div", {
|
|
1247
1247
|
ref: r,
|
|
1248
|
-
className:
|
|
1248
|
+
className: V.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: V.shine }),
|
|
1261
1261
|
n ? /* @__PURE__ */ l("img", {
|
|
1262
1262
|
src: n,
|
|
1263
1263
|
alt: e,
|
|
1264
|
-
className:
|
|
1264
|
+
className: V.image
|
|
1265
1265
|
}) : /* @__PURE__ */ l("div", {
|
|
1266
|
-
className:
|
|
1266
|
+
className: V.placeholder,
|
|
1267
1267
|
children: /* @__PURE__ */ l("span", { children: "✦" })
|
|
1268
1268
|
}),
|
|
1269
1269
|
/* @__PURE__ */ u("div", {
|
|
1270
|
-
className:
|
|
1270
|
+
className: V.info,
|
|
1271
1271
|
children: [/* @__PURE__ */ l("h3", { children: e }), /* @__PURE__ */ l("p", { children: t })]
|
|
1272
1272
|
})
|
|
1273
1273
|
]
|
|
1274
1274
|
})
|
|
1275
1275
|
});
|
|
1276
|
-
},
|
|
1276
|
+
}, H = {
|
|
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
|
+
}, Ne = ({ 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: H.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: H.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: H.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: H.fillBg
|
|
1338
1338
|
}), /* @__PURE__ */ l("path", {
|
|
1339
1339
|
ref: s,
|
|
1340
|
-
className:
|
|
1340
|
+
className: H.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: H.ring,
|
|
1349
1349
|
strokeWidth: 10,
|
|
1350
1350
|
fill: "none"
|
|
1351
1351
|
})
|
|
1352
1352
|
]
|
|
1353
1353
|
}), /* @__PURE__ */ u("span", {
|
|
1354
|
-
className:
|
|
1354
|
+
className: H.label,
|
|
1355
1355
|
children: [Math.round(d), "%"]
|
|
1356
1356
|
})]
|
|
1357
1357
|
});
|
|
1358
|
-
},
|
|
1358
|
+
}, Pe = {
|
|
1359
1359
|
lorenzAttractor: "cos-lorenzAttractor--UAI7",
|
|
1360
1360
|
canvas: "cos-canvas-oeXce"
|
|
1361
|
-
},
|
|
1361
|
+
}, Fe = ({ 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: Pe.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: Pe.canvas,
|
|
1419
1419
|
style: {
|
|
1420
1420
|
width: e,
|
|
1421
1421
|
height: t
|
|
1422
1422
|
}
|
|
1423
1423
|
})
|
|
1424
1424
|
});
|
|
1425
|
-
},
|
|
1425
|
+
}, Ie = {
|
|
1426
1426
|
liquidGlass: "cos-liquidGlass-Z3bQg",
|
|
1427
1427
|
panel: "cos-panel-XYboD",
|
|
1428
1428
|
content: "cos-content-MHfkS"
|
|
1429
|
-
},
|
|
1430
|
-
className:
|
|
1429
|
+
}, Le = ({ children: e = "液态玻璃面板", blur: t = 16, borderRadius: n = 20 }) => /* @__PURE__ */ l("div", {
|
|
1430
|
+
className: Ie.liquidGlass,
|
|
1431
1431
|
children: /* @__PURE__ */ l("div", {
|
|
1432
|
-
className:
|
|
1432
|
+
className: Ie.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: Ie.content,
|
|
1439
1439
|
children: e
|
|
1440
1440
|
})
|
|
1441
1441
|
})
|
|
1442
|
-
}),
|
|
1442
|
+
}), Re = {
|
|
1443
1443
|
magneticButton: "cos-magneticButton-GbRkE",
|
|
1444
1444
|
btn: "cos-btn--b2BJ"
|
|
1445
|
-
},
|
|
1445
|
+
}, ze = ({ 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: Re.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: Re.btn,
|
|
1464
1464
|
style: { "--btn-color": n },
|
|
1465
1465
|
children: e
|
|
1466
1466
|
})
|
|
1467
1467
|
});
|
|
1468
|
-
},
|
|
1468
|
+
}, Be = {
|
|
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
|
+
}, Ve = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*アイウエオカキクケコ", He = ({ 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 = Ve[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: Be.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: Be.canvas,
|
|
1510
1510
|
style: {
|
|
1511
1511
|
width: e,
|
|
1512
1512
|
height: t
|
|
1513
1513
|
}
|
|
1514
1514
|
}), a && /* @__PURE__ */ u("div", {
|
|
1515
|
-
className:
|
|
1515
|
+
className: Be.overlay,
|
|
1516
1516
|
children: [/* @__PURE__ */ l("h2", {
|
|
1517
|
-
className:
|
|
1517
|
+
className: Be.title,
|
|
1518
1518
|
children: s
|
|
1519
1519
|
}), /* @__PURE__ */ l("p", {
|
|
1520
|
-
className:
|
|
1520
|
+
className: Be.subtitle,
|
|
1521
1521
|
children: c
|
|
1522
1522
|
})]
|
|
1523
1523
|
})]
|
|
1524
1524
|
});
|
|
1525
|
-
},
|
|
1525
|
+
}, Ue = {
|
|
1526
1526
|
metaballPool: "cos-metaballPool-JJaI9",
|
|
1527
1527
|
canvas: "cos-canvas-S7fDD"
|
|
1528
|
-
},
|
|
1528
|
+
}, We = ({ 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: Ue.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: Ue.canvas,
|
|
1627
1627
|
style: {
|
|
1628
1628
|
width: e,
|
|
1629
1629
|
height: t
|
|
1630
1630
|
}
|
|
1631
1631
|
})
|
|
1632
1632
|
});
|
|
1633
|
-
},
|
|
1633
|
+
}, Ge = {
|
|
1634
1634
|
mazeGenerator: "cos-mazeGenerator-QEa0s",
|
|
1635
1635
|
canvas: "cos-canvas-emhxb"
|
|
1636
|
-
},
|
|
1636
|
+
}, Ke = ({ 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: Ge.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: Ge.canvas,
|
|
1731
1731
|
style: {
|
|
1732
1732
|
width: e,
|
|
1733
1733
|
height: t
|
|
1734
1734
|
}
|
|
1735
1735
|
})
|
|
1736
1736
|
});
|
|
1737
|
-
},
|
|
1737
|
+
}, qe = {
|
|
1738
1738
|
meteorRain: "cos-meteorRain-v8RNI",
|
|
1739
1739
|
canvas: "cos-canvas-hyFMr"
|
|
1740
|
-
},
|
|
1740
|
+
}, Je = ({ 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: qe.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: qe.canvas,
|
|
1783
1783
|
style: {
|
|
1784
1784
|
width: e,
|
|
1785
1785
|
height: t
|
|
1786
1786
|
}
|
|
1787
1787
|
})
|
|
1788
1788
|
});
|
|
1789
|
-
},
|
|
1789
|
+
}, Ye = {
|
|
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
|
+
}, Xe = ({ text: e = "NEON", color: t = "#ff00de", fontSize: n = 72, flicker: r = !0 }) => /* @__PURE__ */ u("div", {
|
|
1796
|
+
className: Ye.neonText,
|
|
1797
1797
|
children: [/* @__PURE__ */ l("h1", {
|
|
1798
|
-
className: `${
|
|
1798
|
+
className: `${Ye.text} ${r ? Ye.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: Ye.reflection,
|
|
1806
1806
|
style: {
|
|
1807
1807
|
fontSize: n * .35,
|
|
1808
1808
|
color: t
|
|
1809
1809
|
},
|
|
1810
1810
|
children: e
|
|
1811
1811
|
})]
|
|
1812
|
-
}),
|
|
1812
|
+
}), Ze = {
|
|
1813
1813
|
newtonCradle: "cos-newtonCradle-mFl-b",
|
|
1814
1814
|
canvas: "cos-canvas-TWKl5"
|
|
1815
|
-
},
|
|
1815
|
+
}, Qe = ({ 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: Ze.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: Ze.canvas,
|
|
1887
1887
|
style: {
|
|
1888
1888
|
width: r,
|
|
1889
1889
|
height: i
|
|
1890
1890
|
}
|
|
1891
1891
|
})
|
|
1892
1892
|
});
|
|
1893
|
-
},
|
|
1893
|
+
}, $e = {
|
|
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
|
+
}, et = [
|
|
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
|
+
], tt = ({ data: e = et, 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: $e.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: $e.canvas,
|
|
1956
1956
|
style: {
|
|
1957
1957
|
width: t,
|
|
1958
1958
|
height: t
|
|
1959
1959
|
}
|
|
1960
1960
|
}), /* @__PURE__ */ l("ul", {
|
|
1961
|
-
className:
|
|
1961
|
+
className: $e.legend,
|
|
1962
1962
|
children: e.map((e) => /* @__PURE__ */ u("li", { children: [
|
|
1963
1963
|
/* @__PURE__ */ l("span", {
|
|
1964
|
-
className:
|
|
1964
|
+
className: $e.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
|
+
}, nt = {
|
|
1975
1975
|
particleNetwork: "cos-particleNetwork-GSZq-",
|
|
1976
1976
|
canvas: "cos-canvas-E-BGP",
|
|
1977
1977
|
hint: "cos-hint-LEO5o"
|
|
1978
|
-
},
|
|
1978
|
+
}, rt = ({ 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: nt.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: nt.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: nt.hint,
|
|
2079
2079
|
children: "移动鼠标或手指与粒子互动"
|
|
2080
2080
|
})]
|
|
2081
2081
|
});
|
|
2082
|
-
},
|
|
2082
|
+
}, it = {
|
|
2083
2083
|
plasmaBall: "cos-plasmaBall-xGHSj",
|
|
2084
2084
|
canvas: "cos-canvas-V1CgL"
|
|
2085
|
-
},
|
|
2085
|
+
}, at = ({ 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,38 +2143,38 @@ var L = {
|
|
|
2143
2143
|
t,
|
|
2144
2144
|
e
|
|
2145
2145
|
]), /* @__PURE__ */ l("div", {
|
|
2146
|
-
className:
|
|
2146
|
+
className: it.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: it.canvas,
|
|
2154
2154
|
style: {
|
|
2155
2155
|
width: e,
|
|
2156
2156
|
height: t
|
|
2157
2157
|
}
|
|
2158
2158
|
})
|
|
2159
2159
|
});
|
|
2160
|
-
},
|
|
2160
|
+
}, ot = {
|
|
2161
2161
|
smokeFog: "cos-smokeFog-SYlts",
|
|
2162
2162
|
canvas: "cos-canvas-iOJV7"
|
|
2163
|
-
},
|
|
2163
|
+
}, st = 10, U = 128, ct = "#d2d4d8", lt = [
|
|
2164
2164
|
"#14151c",
|
|
2165
2165
|
"#1a1b24",
|
|
2166
2166
|
"#0e0f14"
|
|
2167
|
-
],
|
|
2167
|
+
], ut = (e, t) => {
|
|
2168
2168
|
let n = Math.sin(e * 127.1 + t * 311.7) * 43758.5453;
|
|
2169
2169
|
return n - Math.floor(n);
|
|
2170
|
-
},
|
|
2171
|
-
let n = Math.floor(e), r = Math.floor(t), i = e - n, a = t - r, o = i * i * (3 - 2 * i), s = a * a * (3 - 2 * a), c =
|
|
2170
|
+
}, dt = (e, t) => {
|
|
2171
|
+
let n = Math.floor(e), r = Math.floor(t), i = e - n, a = t - r, o = i * i * (3 - 2 * i), s = a * a * (3 - 2 * a), c = ut(n, r), l = ut(n + 1, r), u = ut(n, r + 1), d = ut(n + 1, r + 1);
|
|
2172
2172
|
return c + (l - c) * o + (u - c) * s + (c - l - u + d) * o * s;
|
|
2173
|
-
},
|
|
2173
|
+
}, ft = (e, t) => {
|
|
2174
2174
|
let n = 0, r = .5, i = 1;
|
|
2175
|
-
for (let a = 0; a < 4; a++) n += r *
|
|
2175
|
+
for (let a = 0; a < 4; a++) n += r * dt(e * i, t * i), i *= 2.05, r *= .5;
|
|
2176
2176
|
return n;
|
|
2177
|
-
},
|
|
2177
|
+
}, pt = (e, t) => {
|
|
2178
2178
|
let n = e.replace("#", "").trim(), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n;
|
|
2179
2179
|
if (r.length !== 6) return t;
|
|
2180
2180
|
let i = Number.parseInt(r, 16);
|
|
@@ -2183,48 +2183,48 @@ var L = {
|
|
|
2183
2183
|
i >> 8 & 255,
|
|
2184
2184
|
i & 255
|
|
2185
2185
|
];
|
|
2186
|
-
},
|
|
2186
|
+
}, mt = (e, t, n) => [
|
|
2187
2187
|
Math.round(e[0] + (t[0] - e[0]) * n),
|
|
2188
2188
|
Math.round(e[1] + (t[1] - e[1]) * n),
|
|
2189
2189
|
Math.round(e[2] + (t[2] - e[2]) * n)
|
|
2190
|
-
],
|
|
2190
|
+
], ht = (e, t = 1) => t >= 1 ? `rgb(${e[0]} ${e[1]} ${e[2]})` : `rgb(${e[0]} ${e[1]} ${e[2]} / ${t})`, gt = (e) => {
|
|
2191
2191
|
if (Array.isArray(e) && e.length >= 3) return [
|
|
2192
2192
|
e[0],
|
|
2193
2193
|
e[1],
|
|
2194
2194
|
e[2]
|
|
2195
2195
|
];
|
|
2196
|
-
let t =
|
|
2196
|
+
let t = pt(typeof e == "string" ? e : lt[2], [
|
|
2197
2197
|
14,
|
|
2198
2198
|
15,
|
|
2199
2199
|
20
|
|
2200
|
-
]), n =
|
|
2200
|
+
]), n = mt(t, [
|
|
2201
2201
|
255,
|
|
2202
2202
|
255,
|
|
2203
2203
|
255
|
|
2204
2204
|
], .06);
|
|
2205
2205
|
return [
|
|
2206
|
-
|
|
2206
|
+
ht(mt(t, [
|
|
2207
2207
|
255,
|
|
2208
2208
|
255,
|
|
2209
2209
|
255
|
|
2210
2210
|
], .1)),
|
|
2211
|
-
|
|
2212
|
-
|
|
2211
|
+
ht(n),
|
|
2212
|
+
ht(t)
|
|
2213
2213
|
];
|
|
2214
2214
|
}, _t = (e, t) => {
|
|
2215
2215
|
let n = document.createElement("canvas");
|
|
2216
|
-
n.width =
|
|
2217
|
-
let r = n.getContext("2d"), i = r.createImageData(
|
|
2218
|
-
for (let n = 0; n <
|
|
2216
|
+
n.width = U, n.height = U;
|
|
2217
|
+
let r = n.getContext("2d"), i = r.createImageData(U, U), a = i.data, o = U / 2, s = U / 2, c = U * .48;
|
|
2218
|
+
for (let n = 0; n < U; n++) for (let r = 0; r < U; r++) {
|
|
2219
2219
|
let i = (r - o) / c, l = (n - s) / c, u = Math.hypot(i, l);
|
|
2220
2220
|
if (u > 1.15) continue;
|
|
2221
|
-
let d =
|
|
2221
|
+
let d = ft(r * .045 + e * 17.1, n * .045 + e * 9.3) * .7 + ft(r * .09 - e * 3.2, n * .09 + e * 5.7) * .3, f = u + (d - .45) * .55, p = 1 - Math.max(0, f);
|
|
2222
2222
|
if (p = Math.max(0, p) ** 1.35, p *= .55 + d * .7, p < .01) continue;
|
|
2223
|
-
let m = (n *
|
|
2223
|
+
let m = (n * U + r) * 4, h = .88 + d * .18;
|
|
2224
2224
|
a[m] = Math.min(255, t[0] * h), a[m + 1] = Math.min(255, t[1] * h + 1), a[m + 2] = Math.min(255, t[2] * h + 3), a[m + 3] = Math.min(255, p * 210);
|
|
2225
2225
|
}
|
|
2226
2226
|
return r.putImageData(i, 0, 0), n;
|
|
2227
|
-
}, vt = (e) => Array.from({ length:
|
|
2227
|
+
}, vt = (e) => Array.from({ length: st }, (t, n) => _t(n + 1, e)), yt = (e, t, n = 0) => {
|
|
2228
2228
|
let r = 70 + Math.random() * 110, i = Math.min(.92, n * .88), a = t * (1 - n * .92) + r * (.15 - n * .1), o = (.32 + Math.random() * .28) * (1 - n * .55);
|
|
2229
2229
|
return {
|
|
2230
2230
|
x: Math.random() * e,
|
|
@@ -2239,7 +2239,7 @@ var L = {
|
|
|
2239
2239
|
age: i,
|
|
2240
2240
|
ageSpeed: 4e-4 + Math.random() * 65e-5,
|
|
2241
2241
|
opacity: o,
|
|
2242
|
-
sprite: Math.floor(Math.random() *
|
|
2242
|
+
sprite: Math.floor(Math.random() * st),
|
|
2243
2243
|
stretch: .85 + Math.random() * .55 + n * .25,
|
|
2244
2244
|
receptivity: .5 + Math.random() * .85,
|
|
2245
2245
|
mass: .5 + Math.random() * .9,
|
|
@@ -2251,7 +2251,7 @@ var L = {
|
|
|
2251
2251
|
if (n <= t) return;
|
|
2252
2252
|
let r = t / n;
|
|
2253
2253
|
e.vx *= r, e.vy *= r;
|
|
2254
|
-
}, xt = (e) => e < .06 ? e / .06 : e > .55 ? Math.max(0, 1 - (e - .55) / .45) : 1, St = (e, t) => .22 + Math.min(1, Math.max(0, e / t)) ** 1.15 * .78, Ct = ({ width: e = 800, height: r = 500, density: i = .5, color: a =
|
|
2254
|
+
}, xt = (e) => e < .06 ? e / .06 : e > .55 ? Math.max(0, 1 - (e - .55) / .45) : 1, St = (e, t) => .22 + Math.min(1, Math.max(0, e / t)) ** 1.15 * .78, Ct = ({ width: e = 800, height: r = 500, density: i = .5, color: a = ct, backgroundColor: s = lt, speed: c = 1, disperseStrength: u = 1, disperseRadius: d = 1, interactive: f = !0 }) => {
|
|
2255
2255
|
let p = o(null), m = o([]), h = o([]), g = o(null), _ = o(""), b = o(0), x = o({
|
|
2256
2256
|
speed: c,
|
|
2257
2257
|
disperseStrength: u,
|
|
@@ -2277,7 +2277,7 @@ var L = {
|
|
|
2277
2277
|
a,
|
|
2278
2278
|
s
|
|
2279
2279
|
]), n(() => {
|
|
2280
|
-
g.current = vt(
|
|
2280
|
+
g.current = vt(pt(a, [
|
|
2281
2281
|
210,
|
|
2282
2282
|
212,
|
|
2283
2283
|
216
|
|
@@ -2321,7 +2321,7 @@ var L = {
|
|
|
2321
2321
|
let i = t.getContext("2d");
|
|
2322
2322
|
if (!i) return;
|
|
2323
2323
|
i.setTransform(n, 0, 0, n, 0, 0);
|
|
2324
|
-
let a =
|
|
2324
|
+
let a = pt(x.current.color, [
|
|
2325
2325
|
210,
|
|
2326
2326
|
212,
|
|
2327
2327
|
216
|
|
@@ -2332,16 +2332,16 @@ var L = {
|
|
|
2332
2332
|
}), u = typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, d = () => {
|
|
2333
2333
|
let [t, n, a] = gt(x.current.backgroundColor), o = i.createLinearGradient(0, 0, 0, r);
|
|
2334
2334
|
o.addColorStop(0, t), o.addColorStop(.45, n), o.addColorStop(1, a), i.fillStyle = o, i.fillRect(0, 0, e, r);
|
|
2335
|
-
let s =
|
|
2335
|
+
let s = pt(a, [
|
|
2336
2336
|
14,
|
|
2337
2337
|
15,
|
|
2338
2338
|
20
|
|
2339
|
-
]), c =
|
|
2339
|
+
]), c = mt(s, [
|
|
2340
2340
|
255,
|
|
2341
2341
|
255,
|
|
2342
2342
|
255
|
|
2343
2343
|
], .22), l = i.createRadialGradient(e * .5, r * .75, 0, e * .5, r, e * .55);
|
|
2344
|
-
l.addColorStop(0,
|
|
2344
|
+
l.addColorStop(0, ht(c, .35)), l.addColorStop(1, ht(s, 0)), i.fillStyle = l, i.fillRect(0, 0, e, r);
|
|
2345
2345
|
}, f = (e) => {
|
|
2346
2346
|
let t = xt(e.age) * St(e.y, r);
|
|
2347
2347
|
if (t <= .01) return;
|
|
@@ -2350,7 +2350,7 @@ var L = {
|
|
|
2350
2350
|
}, S = () => {
|
|
2351
2351
|
if (b.current = requestAnimationFrame(S), c) return;
|
|
2352
2352
|
let t = y(x.current.speed, 0, 3), n = y(x.current.disperseStrength, 0, 3);
|
|
2353
|
-
s += .01 * Math.max(t, .001), d(), _.current !== x.current.color && (g.current = vt(
|
|
2353
|
+
s += .01 * Math.max(t, .001), d(), _.current !== x.current.color && (g.current = vt(pt(x.current.color, [
|
|
2354
2354
|
210,
|
|
2355
2355
|
212,
|
|
2356
2356
|
216
|
|
@@ -2401,14 +2401,14 @@ var L = {
|
|
|
2401
2401
|
cancelAnimationFrame(b.current), l();
|
|
2402
2402
|
};
|
|
2403
2403
|
}, [r, e]), /* @__PURE__ */ l("div", {
|
|
2404
|
-
className:
|
|
2404
|
+
className: ot.smokeFog,
|
|
2405
2405
|
style: {
|
|
2406
2406
|
width: e,
|
|
2407
2407
|
height: r
|
|
2408
2408
|
},
|
|
2409
2409
|
children: /* @__PURE__ */ l("canvas", {
|
|
2410
2410
|
ref: p,
|
|
2411
|
-
className:
|
|
2411
|
+
className: ot.canvas,
|
|
2412
2412
|
style: {
|
|
2413
2413
|
width: e,
|
|
2414
2414
|
height: r,
|
|
@@ -2783,13 +2783,13 @@ var L = {
|
|
|
2783
2783
|
}
|
|
2784
2784
|
})
|
|
2785
2785
|
});
|
|
2786
|
-
},
|
|
2786
|
+
}, Pt = {
|
|
2787
2787
|
redPacketRain: "cos-redPacketRain-eJ7FW",
|
|
2788
2788
|
canvas: "cos-canvas-direH",
|
|
2789
2789
|
hud: "cos-hud-InqMq",
|
|
2790
2790
|
end: "cos-end-u0J7o",
|
|
2791
2791
|
hint: "cos-hint-sO6ld"
|
|
2792
|
-
},
|
|
2792
|
+
}, Ft = ({ duration: e = 1e4, onGrab: r }) => {
|
|
2793
2793
|
let i = o(null), a = o([]), c = o(0), d = o(0), f = o(0), [p, m] = s(0), [h, g] = s(!0), _ = o(!0), y = o(r);
|
|
2794
2794
|
n(() => {
|
|
2795
2795
|
y.current = r;
|
|
@@ -2835,11 +2835,11 @@ var L = {
|
|
|
2835
2835
|
cancelAnimationFrame(c.current), clearTimeout(l), s();
|
|
2836
2836
|
};
|
|
2837
2837
|
}, [e, b]), /* @__PURE__ */ u("div", {
|
|
2838
|
-
className:
|
|
2838
|
+
className: Pt.redPacketRain,
|
|
2839
2839
|
children: [
|
|
2840
2840
|
/* @__PURE__ */ l("canvas", {
|
|
2841
2841
|
ref: i,
|
|
2842
|
-
className:
|
|
2842
|
+
className: Pt.canvas,
|
|
2843
2843
|
style: {
|
|
2844
2844
|
width: 400,
|
|
2845
2845
|
height: 500
|
|
@@ -2853,25 +2853,25 @@ var L = {
|
|
|
2853
2853
|
}
|
|
2854
2854
|
}),
|
|
2855
2855
|
/* @__PURE__ */ u("div", {
|
|
2856
|
-
className:
|
|
2856
|
+
className: Pt.hud,
|
|
2857
2857
|
children: [/* @__PURE__ */ u("span", { children: ["已抢: ¥", p] }), !h && /* @__PURE__ */ l("span", {
|
|
2858
|
-
className:
|
|
2858
|
+
className: Pt.end,
|
|
2859
2859
|
children: "红包雨结束"
|
|
2860
2860
|
})]
|
|
2861
2861
|
}),
|
|
2862
2862
|
/* @__PURE__ */ l("p", {
|
|
2863
|
-
className:
|
|
2863
|
+
className: Pt.hint,
|
|
2864
2864
|
children: "点击红包抢夺"
|
|
2865
2865
|
})
|
|
2866
2866
|
]
|
|
2867
2867
|
});
|
|
2868
|
-
},
|
|
2868
|
+
}, It = {
|
|
2869
2869
|
returnCityContainer: "cos-returnCityContainer-6XTxj",
|
|
2870
2870
|
star: "cos-star-a59Dx",
|
|
2871
2871
|
glassWrap: "cos-glassWrap-golMO",
|
|
2872
2872
|
rotate: "cos-rotate-7X9Jj",
|
|
2873
2873
|
glassItem: "cos-glassItem-OwlFI"
|
|
2874
|
-
},
|
|
2874
|
+
}, Lt = ({ starCount: e, glassCount: t = 8, glassRadius: r = 150 }) => {
|
|
2875
2875
|
let i = o(null), a = o(null);
|
|
2876
2876
|
return n(() => {
|
|
2877
2877
|
let n = i.current, o = a.current;
|
|
@@ -2880,13 +2880,13 @@ var L = {
|
|
|
2880
2880
|
for (let e = 0; e < f; e++) {
|
|
2881
2881
|
let e = window.setTimeout(() => {
|
|
2882
2882
|
let e = document.createElement("div");
|
|
2883
|
-
e.className =
|
|
2883
|
+
e.className = It.star, e.style.top = `${Math.random() * d}px`, e.style.left = `${Math.random() * u}px`, n.append(e), c.push(e);
|
|
2884
2884
|
}, Math.random() * 2e3);
|
|
2885
2885
|
s.push(e);
|
|
2886
2886
|
}
|
|
2887
2887
|
for (let e = 0; e < t; e++) {
|
|
2888
2888
|
let n = document.createElement("div");
|
|
2889
|
-
n.className =
|
|
2889
|
+
n.className = It.glassItem, n.style.transform = `rotateY(${360 / t * e}deg) translateZ(${r}px)`, o.appendChild(n), l.push(n);
|
|
2890
2890
|
let i = window.setTimeout(() => {
|
|
2891
2891
|
n.style.top = "0px", n.style.opacity = "1";
|
|
2892
2892
|
}, e * 300);
|
|
@@ -2901,16 +2901,16 @@ var L = {
|
|
|
2901
2901
|
r
|
|
2902
2902
|
]), /* @__PURE__ */ l("div", {
|
|
2903
2903
|
ref: i,
|
|
2904
|
-
className:
|
|
2904
|
+
className: It.returnCityContainer,
|
|
2905
2905
|
children: /* @__PURE__ */ l("div", {
|
|
2906
2906
|
ref: a,
|
|
2907
|
-
className:
|
|
2907
|
+
className: It.glassWrap
|
|
2908
2908
|
})
|
|
2909
2909
|
});
|
|
2910
|
-
},
|
|
2910
|
+
}, Rt = {
|
|
2911
2911
|
ropeChain: "cos-ropeChain-gYaSK",
|
|
2912
2912
|
canvas: "cos-canvas-5i95N"
|
|
2913
|
-
},
|
|
2913
|
+
}, zt = ({ width: e = 400, height: t = 400, segments: r = 16, color: i = "#38bdf8", gravity: a = .4 }) => {
|
|
2914
2914
|
let s = o(null), c = o([]), u = o({
|
|
2915
2915
|
active: !1,
|
|
2916
2916
|
index: -1
|
|
@@ -2995,21 +2995,21 @@ var L = {
|
|
|
2995
2995
|
r,
|
|
2996
2996
|
e
|
|
2997
2997
|
]), /* @__PURE__ */ l("div", {
|
|
2998
|
-
className:
|
|
2998
|
+
className: Rt.ropeChain,
|
|
2999
2999
|
style: {
|
|
3000
3000
|
width: e,
|
|
3001
3001
|
height: t
|
|
3002
3002
|
},
|
|
3003
3003
|
children: /* @__PURE__ */ l("canvas", {
|
|
3004
3004
|
ref: s,
|
|
3005
|
-
className:
|
|
3005
|
+
className: Rt.canvas,
|
|
3006
3006
|
style: {
|
|
3007
3007
|
width: e,
|
|
3008
3008
|
height: t
|
|
3009
3009
|
}
|
|
3010
3010
|
})
|
|
3011
3011
|
});
|
|
3012
|
-
},
|
|
3012
|
+
}, G = {
|
|
3013
3013
|
speedometer: "cos-speedometer-INc7F",
|
|
3014
3014
|
svg: "cos-svg-HG-lE",
|
|
3015
3015
|
track: "cos-track-5-922",
|
|
@@ -3019,37 +3019,37 @@ var L = {
|
|
|
3019
3019
|
hub: "cos-hub-4WaHw",
|
|
3020
3020
|
valueText: "cos-valueText--q4Xi",
|
|
3021
3021
|
label: "cos-label-hOPy1"
|
|
3022
|
-
},
|
|
3022
|
+
}, K = (e, t, n, r) => {
|
|
3023
3023
|
let i = (r - 90) * Math.PI / 180;
|
|
3024
3024
|
return {
|
|
3025
3025
|
x: e + n * Math.cos(i),
|
|
3026
3026
|
y: t + n * Math.sin(i)
|
|
3027
3027
|
};
|
|
3028
|
-
},
|
|
3028
|
+
}, Bt = ({ value: e = 0, max: t = 100, label: n = "SPEED", color: r = "#f97316" }) => {
|
|
3029
3029
|
let i = -120 + y(t > 0 ? e / t : 0, 0, 1) * 240, o = a(() => {
|
|
3030
|
-
let e =
|
|
3030
|
+
let e = K(100, 100, 72, -120), t = K(100, 100, 72, 120);
|
|
3031
3031
|
return `M ${e.x} ${e.y} A 72 72 0 1 1 ${t.x} ${t.y}`;
|
|
3032
3032
|
}, []), s = a(() => {
|
|
3033
|
-
let e =
|
|
3033
|
+
let e = K(100, 100, 72, -120), t = K(100, 100, 72, i), n = +(i - -120 > 180);
|
|
3034
3034
|
return `M ${e.x} ${e.y} A 72 72 0 ${n} 1 ${t.x} ${t.y}`;
|
|
3035
|
-
}, [i]), c =
|
|
3035
|
+
}, [i]), c = K(100, 100, 58, i);
|
|
3036
3036
|
return /* @__PURE__ */ u("div", {
|
|
3037
|
-
className:
|
|
3037
|
+
className: G.speedometer,
|
|
3038
3038
|
style: { "--gauge-color": r },
|
|
3039
3039
|
children: [/* @__PURE__ */ u("svg", {
|
|
3040
3040
|
viewBox: "0 0 200 130",
|
|
3041
|
-
className:
|
|
3041
|
+
className: G.svg,
|
|
3042
3042
|
children: [
|
|
3043
3043
|
/* @__PURE__ */ l("path", {
|
|
3044
3044
|
d: o,
|
|
3045
|
-
className:
|
|
3045
|
+
className: G.track,
|
|
3046
3046
|
fill: "none",
|
|
3047
3047
|
strokeWidth: "12",
|
|
3048
3048
|
strokeLinecap: "round"
|
|
3049
3049
|
}),
|
|
3050
3050
|
/* @__PURE__ */ l("path", {
|
|
3051
3051
|
d: s,
|
|
3052
|
-
className:
|
|
3052
|
+
className: G.valueArc,
|
|
3053
3053
|
fill: "none",
|
|
3054
3054
|
strokeWidth: "12",
|
|
3055
3055
|
strokeLinecap: "round"
|
|
@@ -3061,13 +3061,13 @@ var L = {
|
|
|
3061
3061
|
60,
|
|
3062
3062
|
120
|
|
3063
3063
|
].map((e) => {
|
|
3064
|
-
let t =
|
|
3064
|
+
let t = K(100, 100, 58, e), n = K(100, 100, 66, e);
|
|
3065
3065
|
return /* @__PURE__ */ l("line", {
|
|
3066
3066
|
x1: t.x,
|
|
3067
3067
|
y1: t.y,
|
|
3068
3068
|
x2: n.x,
|
|
3069
3069
|
y2: n.y,
|
|
3070
|
-
className:
|
|
3070
|
+
className: G.tick
|
|
3071
3071
|
}, e);
|
|
3072
3072
|
}),
|
|
3073
3073
|
/* @__PURE__ */ l("line", {
|
|
@@ -3075,27 +3075,27 @@ var L = {
|
|
|
3075
3075
|
y1: "100",
|
|
3076
3076
|
x2: c.x,
|
|
3077
3077
|
y2: c.y,
|
|
3078
|
-
className:
|
|
3078
|
+
className: G.needle
|
|
3079
3079
|
}),
|
|
3080
3080
|
/* @__PURE__ */ l("circle", {
|
|
3081
3081
|
cx: "100",
|
|
3082
3082
|
cy: "100",
|
|
3083
3083
|
r: "6",
|
|
3084
|
-
className:
|
|
3084
|
+
className: G.hub
|
|
3085
3085
|
}),
|
|
3086
3086
|
/* @__PURE__ */ l("text", {
|
|
3087
3087
|
x: "100",
|
|
3088
3088
|
y: "118",
|
|
3089
|
-
className:
|
|
3089
|
+
className: G.valueText,
|
|
3090
3090
|
children: Math.round(e)
|
|
3091
3091
|
})
|
|
3092
3092
|
]
|
|
3093
3093
|
}), /* @__PURE__ */ l("span", {
|
|
3094
|
-
className:
|
|
3094
|
+
className: G.label,
|
|
3095
3095
|
children: n
|
|
3096
3096
|
})]
|
|
3097
3097
|
});
|
|
3098
|
-
},
|
|
3098
|
+
}, q = {
|
|
3099
3099
|
timelinePulse: "cos-timelinePulse-kcBM6",
|
|
3100
3100
|
axis: "cos-axis-9DWis",
|
|
3101
3101
|
track: "cos-track-jG-HV",
|
|
@@ -3105,7 +3105,7 @@ var L = {
|
|
|
3105
3105
|
dot: "cos-dot-HJEVy",
|
|
3106
3106
|
pulse: "cos-pulse-N6FD1",
|
|
3107
3107
|
name: "cos-name-7zefJ"
|
|
3108
|
-
},
|
|
3108
|
+
}, Vt = ({ steps: e = [
|
|
3109
3109
|
"Start",
|
|
3110
3110
|
"Process",
|
|
3111
3111
|
"Review",
|
|
@@ -3113,26 +3113,26 @@ var L = {
|
|
|
3113
3113
|
], current: t = 0, color: n = "#22d3ee" }) => {
|
|
3114
3114
|
let r = y(t, 0, Math.max(0, e.length - 1)), i = e.length > 1 ? r / (e.length - 1) : 0;
|
|
3115
3115
|
return /* @__PURE__ */ l("div", {
|
|
3116
|
-
className:
|
|
3116
|
+
className: q.timelinePulse,
|
|
3117
3117
|
style: {
|
|
3118
3118
|
"--pulse-color": n,
|
|
3119
3119
|
"--step-count": e.length,
|
|
3120
3120
|
"--progress-ratio": i
|
|
3121
3121
|
},
|
|
3122
3122
|
children: /* @__PURE__ */ u("div", {
|
|
3123
|
-
className:
|
|
3123
|
+
className: q.axis,
|
|
3124
3124
|
children: [
|
|
3125
|
-
/* @__PURE__ */ l("div", { className:
|
|
3126
|
-
/* @__PURE__ */ l("div", { className:
|
|
3125
|
+
/* @__PURE__ */ l("div", { className: q.track }),
|
|
3126
|
+
/* @__PURE__ */ l("div", { className: q.progress }),
|
|
3127
3127
|
/* @__PURE__ */ l("ul", {
|
|
3128
|
-
className:
|
|
3128
|
+
className: q.steps,
|
|
3129
3129
|
children: e.map((e, t) => {
|
|
3130
3130
|
let n = t < r ? "done" : t === r ? "current" : "pending";
|
|
3131
3131
|
return /* @__PURE__ */ u("li", {
|
|
3132
|
-
className:
|
|
3132
|
+
className: q.step,
|
|
3133
3133
|
"data-state": n,
|
|
3134
|
-
children: [/* @__PURE__ */ l("span", { className:
|
|
3135
|
-
className:
|
|
3134
|
+
children: [/* @__PURE__ */ l("span", { className: q.dot }), /* @__PURE__ */ l("span", {
|
|
3135
|
+
className: q.name,
|
|
3136
3136
|
children: e
|
|
3137
3137
|
})]
|
|
3138
3138
|
}, e + t);
|
|
@@ -3141,11 +3141,11 @@ var L = {
|
|
|
3141
3141
|
]
|
|
3142
3142
|
})
|
|
3143
3143
|
});
|
|
3144
|
-
},
|
|
3144
|
+
}, Ht = {
|
|
3145
3145
|
rippleWater: "cos-rippleWater-wsinI",
|
|
3146
3146
|
canvas: "cos-canvas-XOdSF",
|
|
3147
3147
|
hint: "cos-hint-0JH5D"
|
|
3148
|
-
},
|
|
3148
|
+
}, Ut = "\nattribute vec2 a_pos;\nvarying vec2 v_uv;\nvoid main() {\n v_uv = a_pos * 0.5 + 0.5;\n gl_Position = vec4(a_pos, 0.0, 1.0);\n}\n", Wt = "\nprecision highp float;\n\nuniform float u_time;\nuniform vec2 u_res;\nuniform vec3 u_tint;\nuniform vec3 u_from;\nuniform vec3 u_to;\nuniform sampler2D u_height;\nuniform vec2 u_sim;\nuniform float u_waveAmp;\nuniform float u_waveSpeed;\nuniform float u_shimmer;\nuniform float u_reflection;\n\nvarying vec2 v_uv;\n\nfloat hash(vec2 p) {\n return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);\n}\n\nfloat ambientH(vec2 p, float t) {\n float h = 0.0;\n h += sin(p.x * 3.2 + t * 1.3) * cos(p.y * 2.4 - t * 0.9) * 0.45;\n h += sin(p.x * 6.8 - t * 1.7 + p.y * 1.1) * 0.22;\n h += sin(p.x * 12.0 + p.y * 9.0 + t * 2.4) * 0.08;\n h += sin(p.x * 1.4 + p.y * 1.8 + t * 0.55) * 0.35;\n return h;\n}\n\nfloat sampleHeight(vec2 uv) {\n float rip = texture2D(u_height, uv).r * 2.0 - 1.0;\n vec2 p = uv * vec2(u_res.x / u_res.y, 1.0) * 2.8;\n float amb = ambientH(p, u_time * u_waveSpeed) * 0.035 * u_waveAmp;\n return rip * 0.55 + amb;\n}\n\nvec3 calcNormal(vec2 uv) {\n vec2 e = vec2(1.5 / u_sim.x, 1.5 / u_sim.y);\n float hL = sampleHeight(uv - vec2(e.x, 0.0));\n float hR = sampleHeight(uv + vec2(e.x, 0.0));\n float hD = sampleHeight(uv - vec2(0.0, e.y));\n float hU = sampleHeight(uv + vec2(0.0, e.y));\n return normalize(vec3((hL - hR) * 14.0, (hD - hU) * 14.0, 1.0));\n}\n\nvoid main() {\n vec2 uv = v_uv;\n vec3 n = calcNormal(uv);\n float h = sampleHeight(uv);\n\n vec3 V = normalize(vec3(0.0, 0.25, 1.0));\n vec3 L = normalize(vec3(0.45, 0.75, 0.55));\n\n float ndotl = max(dot(n, L), 0.0);\n float fresnel = pow(1.0 - max(dot(n, V), 0.0), 3.2);\n\n float g = clamp((uv.x + (1.0 - uv.y)) * 0.5, 0.0, 1.0);\n vec3 water = mix(u_from, u_to, g);\n water = mix(water, u_from, clamp(h * 1.8 + ndotl * 0.12, 0.0, 0.28));\n water *= 0.92 + n.y * 0.1;\n\n vec3 sky = mix(u_from * 1.15, vec3(0.85, 0.92, 1.0), 0.45);\n vec3 reflectCol = mix(sky, vec3(0.9, 0.95, 1.0), pow(max(n.y, 0.0), 2.0));\n water = mix(water, reflectCol, fresnel * u_reflection);\n\n vec3 H = normalize(L + V);\n float spec = pow(max(dot(n, H), 0.0), 180.0);\n float glitter = pow(max(dot(n, H), 0.0), 48.0);\n float sparkThresh = step(0.992, glitter) * glitter;\n vec3 sparkle = u_tint * (spec * 1.8 + sparkThresh * 2.5) * u_shimmer\n + vec3(1.0) * sparkThresh * 0.8 * u_shimmer;\n\n float softSpec = pow(max(dot(n, H), 0.0), 16.0) * 0.22 * u_shimmer;\n water += u_tint * softSpec + sparkle;\n\n float crest = smoothstep(0.02, 0.12, abs(h)) * fresnel;\n water += mix(u_tint, vec3(1.0), 0.4) * crest * 0.35;\n\n float vig = smoothstep(1.15, 0.35, length((uv - 0.5) * vec2(1.1, 1.0)));\n water *= 0.88 + 0.12 * vig;\n water += (hash(uv * u_res + u_time) - 0.5) * 0.015;\n\n gl_FragColor = vec4(water, 1.0);\n}\n", Gt = (e) => {
|
|
3149
3149
|
let t = e.replace("#", ""), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t, r = Number.parseInt(n, 16);
|
|
3150
3150
|
return Number.isNaN(r) ? [
|
|
3151
3151
|
.22,
|
|
@@ -3156,18 +3156,18 @@ var L = {
|
|
|
3156
3156
|
(r >> 8 & 255) / 255,
|
|
3157
3157
|
(r & 255) / 255
|
|
3158
3158
|
];
|
|
3159
|
-
},
|
|
3159
|
+
}, Kt = (e, t, n) => {
|
|
3160
3160
|
let r = e.createShader(t);
|
|
3161
3161
|
return r ? (e.shaderSource(r, n), e.compileShader(r), e.getShaderParameter(r, e.COMPILE_STATUS) ? r : (e.deleteShader(r), null)) : null;
|
|
3162
|
-
},
|
|
3163
|
-
let r =
|
|
3162
|
+
}, qt = (e, t, n) => {
|
|
3163
|
+
let r = Kt(e, e.VERTEX_SHADER, t), i = Kt(e, e.FRAGMENT_SHADER, n);
|
|
3164
3164
|
if (!r || !i) return null;
|
|
3165
3165
|
let a = e.createProgram();
|
|
3166
3166
|
return a ? (e.attachShader(a, r), e.attachShader(a, i), e.linkProgram(a), e.deleteShader(r), e.deleteShader(i), e.getProgramParameter(a, e.LINK_STATUS) ? a : (e.deleteProgram(a), null)) : null;
|
|
3167
|
-
},
|
|
3168
|
-
from:
|
|
3169
|
-
to:
|
|
3170
|
-
tint:
|
|
3167
|
+
}, J = 192, Jt = (e) => ({
|
|
3168
|
+
from: Gt(e.fromColor),
|
|
3169
|
+
to: Gt(e.toColor),
|
|
3170
|
+
tint: Gt(e.color),
|
|
3171
3171
|
waveAmplitude: e.waveAmplitude,
|
|
3172
3172
|
waveSpeed: e.waveSpeed,
|
|
3173
3173
|
shimmer: e.shimmer,
|
|
@@ -3177,8 +3177,8 @@ var L = {
|
|
|
3177
3177
|
damping: e.damping,
|
|
3178
3178
|
spread: e.spread,
|
|
3179
3179
|
interactive: e.interactive
|
|
3180
|
-
}),
|
|
3181
|
-
let C = o(null), w = o(0), T = o(null), E = o(
|
|
3180
|
+
}), Yt = ({ width: e = 800, height: r = 500, fromColor: i = "#52ade3", toColor: a = "#013565", color: s = "#a8d8f5", waveAmplitude: c = 1, waveSpeed: d = 1, shimmer: f = 1, reflection: p = .38, rippleStrength: m = 1, rippleRadius: h = 6, damping: g = .985, spread: _ = .5, interactive: b = !0, showHint: x = !0, hint: S = "点击水面产生涟漪" }) => {
|
|
3181
|
+
let C = o(null), w = o(0), T = o(null), E = o(Jt({
|
|
3182
3182
|
fromColor: i,
|
|
3183
3183
|
toColor: a,
|
|
3184
3184
|
color: s,
|
|
@@ -3193,7 +3193,7 @@ var L = {
|
|
|
3193
3193
|
interactive: b
|
|
3194
3194
|
}));
|
|
3195
3195
|
n(() => {
|
|
3196
|
-
E.current =
|
|
3196
|
+
E.current = Jt({
|
|
3197
3197
|
fromColor: i,
|
|
3198
3198
|
toColor: a,
|
|
3199
3199
|
color: s,
|
|
@@ -3252,7 +3252,7 @@ var L = {
|
|
|
3252
3252
|
premultipliedAlpha: !1
|
|
3253
3253
|
});
|
|
3254
3254
|
if (!i) return;
|
|
3255
|
-
let a =
|
|
3255
|
+
let a = qt(i, Ut, Wt);
|
|
3256
3256
|
if (!a) return;
|
|
3257
3257
|
let o = i.createBuffer();
|
|
3258
3258
|
i.bindBuffer(i.ARRAY_BUFFER, o), i.bufferData(i.ARRAY_BUFFER, new Float32Array([
|
|
@@ -3265,65 +3265,65 @@ var L = {
|
|
|
3265
3265
|
1,
|
|
3266
3266
|
1
|
|
3267
3267
|
]), i.STATIC_DRAW);
|
|
3268
|
-
let s = i.getAttribLocation(a, "a_pos"), c = i.getUniformLocation(a, "u_time"), l = i.getUniformLocation(a, "u_res"), u = i.getUniformLocation(a, "u_tint"), d = i.getUniformLocation(a, "u_from"), f = i.getUniformLocation(a, "u_to"), p = i.getUniformLocation(a, "u_height"), m = i.getUniformLocation(a, "u_sim"), h = i.getUniformLocation(a, "u_waveAmp"), g = i.getUniformLocation(a, "u_waveSpeed"), _ = i.getUniformLocation(a, "u_shimmer"), b = i.getUniformLocation(a, "u_reflection"), x =
|
|
3268
|
+
let s = i.getAttribLocation(a, "a_pos"), c = i.getUniformLocation(a, "u_time"), l = i.getUniformLocation(a, "u_res"), u = i.getUniformLocation(a, "u_tint"), d = i.getUniformLocation(a, "u_from"), f = i.getUniformLocation(a, "u_to"), p = i.getUniformLocation(a, "u_height"), m = i.getUniformLocation(a, "u_sim"), h = i.getUniformLocation(a, "u_waveAmp"), g = i.getUniformLocation(a, "u_waveSpeed"), _ = i.getUniformLocation(a, "u_shimmer"), b = i.getUniformLocation(a, "u_reflection"), x = J * J, S = new Float32Array(x), D = new Float32Array(x), O = new Float32Array(x), k = i.createTexture();
|
|
3269
3269
|
i.bindTexture(i.TEXTURE_2D, k), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_MIN_FILTER, i.LINEAR), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_MAG_FILTER, i.LINEAR), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_WRAP_S, i.CLAMP_TO_EDGE), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_WRAP_T, i.CLAMP_TO_EDGE);
|
|
3270
3270
|
let A = new Uint8Array(x * 4), j = () => {
|
|
3271
3271
|
for (let e = 0; e < x; e++) {
|
|
3272
3272
|
let t = Math.max(0, Math.min(255, Math.floor((D[e] * .5 + .5) * 255))), n = e * 4;
|
|
3273
3273
|
A[n] = t, A[n + 1] = t, A[n + 2] = t, A[n + 3] = 255;
|
|
3274
3274
|
}
|
|
3275
|
-
i.bindTexture(i.TEXTURE_2D, k), i.texImage2D(i.TEXTURE_2D, 0, i.RGBA,
|
|
3275
|
+
i.bindTexture(i.TEXTURE_2D, k), i.texImage2D(i.TEXTURE_2D, 0, i.RGBA, J, J, 0, i.RGBA, i.UNSIGNED_BYTE, A);
|
|
3276
3276
|
}, M = (e, t, n, r) => {
|
|
3277
|
-
let i = e * (
|
|
3277
|
+
let i = e * (J - 1), a = t * (J - 1), o = y(r, 2, 12);
|
|
3278
3278
|
for (let e = -o - 1; e <= o + 1; e++) for (let t = -o - 1; t <= o + 1; t++) {
|
|
3279
3279
|
let r = Math.round(i + t), s = Math.round(a + e);
|
|
3280
|
-
if (r <= 0 || r >=
|
|
3280
|
+
if (r <= 0 || r >= J - 1 || s <= 0 || s >= J - 1) continue;
|
|
3281
3281
|
let c = Math.sqrt(t * t + e * e), l = Math.exp(-c * c * .55) * -.35, u = Math.exp(-((c - o * .55) ** 2) * .9);
|
|
3282
|
-
D[s *
|
|
3282
|
+
D[s * J + r] += n * (l + u * 1.1);
|
|
3283
3283
|
}
|
|
3284
3284
|
}, N = (e, t) => {
|
|
3285
3285
|
let n = y(e, .9, .999), r = y(t, .3, .7);
|
|
3286
3286
|
for (let e = 0; e < 2; e++) {
|
|
3287
|
-
for (let e = 1; e <
|
|
3288
|
-
let t = e *
|
|
3289
|
-
for (let e = 1; e <
|
|
3290
|
-
let i = t + e, a = D[i - 1] + D[i + 1] + D[i -
|
|
3287
|
+
for (let e = 1; e < J - 1; e++) {
|
|
3288
|
+
let t = e * J;
|
|
3289
|
+
for (let e = 1; e < J - 1; e++) {
|
|
3290
|
+
let i = t + e, a = D[i - 1] + D[i + 1] + D[i - J] + D[i + J];
|
|
3291
3291
|
O[i] = (a * r - S[i]) * n, O[i] > 1.5 ? O[i] = 1.5 : O[i] < -1.5 && (O[i] = -1.5);
|
|
3292
3292
|
}
|
|
3293
3293
|
}
|
|
3294
3294
|
let e = S;
|
|
3295
3295
|
S = D, D = O, O = e, O.fill(0);
|
|
3296
3296
|
}
|
|
3297
|
-
},
|
|
3297
|
+
}, P = (e) => {
|
|
3298
3298
|
let n = E.current;
|
|
3299
|
-
i.viewport(0, 0, t.width, t.height), i.useProgram(a), i.bindBuffer(i.ARRAY_BUFFER, o), i.enableVertexAttribArray(s), i.vertexAttribPointer(s, 2, i.FLOAT, !1, 0, 0), i.activeTexture(i.TEXTURE0), i.bindTexture(i.TEXTURE_2D, k), i.uniform1i(p, 0), i.uniform1f(c, e), i.uniform2f(l, t.width, t.height), i.uniform3f(u, n.tint[0], n.tint[1], n.tint[2]), i.uniform3f(d, n.from[0], n.from[1], n.from[2]), i.uniform3f(f, n.to[0], n.to[1], n.to[2]), i.uniform2f(m,
|
|
3299
|
+
i.viewport(0, 0, t.width, t.height), i.useProgram(a), i.bindBuffer(i.ARRAY_BUFFER, o), i.enableVertexAttribArray(s), i.vertexAttribPointer(s, 2, i.FLOAT, !1, 0, 0), i.activeTexture(i.TEXTURE0), i.bindTexture(i.TEXTURE_2D, k), i.uniform1i(p, 0), i.uniform1f(c, e), i.uniform2f(l, t.width, t.height), i.uniform3f(u, n.tint[0], n.tint[1], n.tint[2]), i.uniform3f(d, n.from[0], n.from[1], n.from[2]), i.uniform3f(f, n.to[0], n.to[1], n.to[2]), i.uniform2f(m, J, J), i.uniform1f(h, y(n.waveAmplitude, 0, 2)), i.uniform1f(g, y(n.waveSpeed, 0, 3)), i.uniform1f(_, y(n.shimmer, 0, 2)), i.uniform1f(b, y(n.reflection, 0, 1)), i.drawArrays(i.TRIANGLE_STRIP, 0, 4);
|
|
3300
3300
|
};
|
|
3301
|
-
if (j(), typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return
|
|
3301
|
+
if (j(), typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return P(0), () => {
|
|
3302
3302
|
i.deleteTexture(k), i.deleteBuffer(o), i.deleteProgram(a);
|
|
3303
3303
|
};
|
|
3304
|
-
let
|
|
3305
|
-
|
|
3306
|
-
}),
|
|
3307
|
-
if (w.current = requestAnimationFrame(
|
|
3304
|
+
let F = document.hidden, I = v((e) => {
|
|
3305
|
+
F = e;
|
|
3306
|
+
}), L = performance.now(), R = (e) => {
|
|
3307
|
+
if (w.current = requestAnimationFrame(R), F) return;
|
|
3308
3308
|
let t = E.current;
|
|
3309
3309
|
if (T.current) {
|
|
3310
3310
|
let e = T.current, n = y(e.strength, 0, 3), r = t.rippleRadius;
|
|
3311
3311
|
M(e.x, e.y, n, r), M(e.x + .004, e.y - .003, n * .35, r), T.current = null;
|
|
3312
3312
|
}
|
|
3313
|
-
N(t.damping, t.spread), j(),
|
|
3313
|
+
N(t.damping, t.spread), j(), P((e - L) / 1e3);
|
|
3314
3314
|
};
|
|
3315
|
-
return w.current = requestAnimationFrame(
|
|
3316
|
-
cancelAnimationFrame(w.current),
|
|
3315
|
+
return w.current = requestAnimationFrame(R), () => {
|
|
3316
|
+
cancelAnimationFrame(w.current), I(), i.deleteTexture(k), i.deleteBuffer(o), i.deleteProgram(a);
|
|
3317
3317
|
};
|
|
3318
3318
|
}, [r, e]), /* @__PURE__ */ u("div", {
|
|
3319
|
-
className:
|
|
3319
|
+
className: Ht.rippleWater,
|
|
3320
3320
|
style: {
|
|
3321
3321
|
width: e,
|
|
3322
3322
|
height: r
|
|
3323
3323
|
},
|
|
3324
3324
|
children: [/* @__PURE__ */ l("canvas", {
|
|
3325
3325
|
ref: C,
|
|
3326
|
-
className:
|
|
3326
|
+
className: Ht.canvas,
|
|
3327
3327
|
style: {
|
|
3328
3328
|
width: e,
|
|
3329
3329
|
height: r,
|
|
@@ -3332,20 +3332,20 @@ var L = {
|
|
|
3332
3332
|
role: "img",
|
|
3333
3333
|
"aria-label": S || "涟漪水面"
|
|
3334
3334
|
}), x ? /* @__PURE__ */ l("span", {
|
|
3335
|
-
className:
|
|
3335
|
+
className: Ht.hint,
|
|
3336
3336
|
"aria-hidden": !0,
|
|
3337
3337
|
children: S
|
|
3338
3338
|
}) : null]
|
|
3339
3339
|
});
|
|
3340
|
-
},
|
|
3340
|
+
}, Xt = {
|
|
3341
3341
|
scrambleText: "cos-scrambleText-hN4Wm",
|
|
3342
3342
|
text: "cos-text-frsHs",
|
|
3343
3343
|
cursor: "cos-cursor-3zQOy",
|
|
3344
3344
|
blink: "cos-blink-OcKXu"
|
|
3345
|
-
},
|
|
3345
|
+
}, Zt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*", Qt = ({ text: e = "DECRYPTED", duration: t = 2e3, charset: r = Zt }) => {
|
|
3346
3346
|
let [i, a] = s(""), c = o(0), d = o(0);
|
|
3347
3347
|
return n(() => {
|
|
3348
|
-
let n = r.length > 0 ? r :
|
|
3348
|
+
let n = r.length > 0 ? r : Zt, i = e;
|
|
3349
3349
|
d.current = performance.now();
|
|
3350
3350
|
let o = (e) => {
|
|
3351
3351
|
let r = e - d.current, s = Math.min(r / t, 1), l = Math.floor(s * i.length);
|
|
@@ -3357,18 +3357,18 @@ var L = {
|
|
|
3357
3357
|
t,
|
|
3358
3358
|
r
|
|
3359
3359
|
]), /* @__PURE__ */ l("div", {
|
|
3360
|
-
className:
|
|
3360
|
+
className: Xt.scrambleText,
|
|
3361
3361
|
children: /* @__PURE__ */ u("p", {
|
|
3362
|
-
className:
|
|
3363
|
-
children: [i, /* @__PURE__ */ l("span", { className:
|
|
3362
|
+
className: Xt.text,
|
|
3363
|
+
children: [i, /* @__PURE__ */ l("span", { className: Xt.cursor })]
|
|
3364
3364
|
})
|
|
3365
3365
|
});
|
|
3366
|
-
},
|
|
3366
|
+
}, $t = {
|
|
3367
3367
|
scratchCard: "cos-scratchCard-McIEK",
|
|
3368
3368
|
prize: "cos-prize-X0z5V",
|
|
3369
3369
|
canvas: "cos-canvas-JqIlr",
|
|
3370
3370
|
hidden: "cos-hidden-Lsfbt"
|
|
3371
|
-
},
|
|
3371
|
+
}, en = ({ coverColor: e = "#94a3b8", prize: r = "🎉 恭喜中奖!", onReveal: i, width: a = 300, height: c = 180 }) => {
|
|
3372
3372
|
let d = o(null), f = o(!1), p = o(!1), m = o(i), [h, g] = s(!1);
|
|
3373
3373
|
n(() => {
|
|
3374
3374
|
m.current = i;
|
|
@@ -3431,17 +3431,17 @@ var L = {
|
|
|
3431
3431
|
f.current = !1;
|
|
3432
3432
|
};
|
|
3433
3433
|
return /* @__PURE__ */ u("div", {
|
|
3434
|
-
className:
|
|
3434
|
+
className: $t.scratchCard,
|
|
3435
3435
|
style: {
|
|
3436
3436
|
width: a,
|
|
3437
3437
|
height: c
|
|
3438
3438
|
},
|
|
3439
3439
|
children: [/* @__PURE__ */ l("div", {
|
|
3440
|
-
className:
|
|
3440
|
+
className: $t.prize,
|
|
3441
3441
|
children: r
|
|
3442
3442
|
}), /* @__PURE__ */ l("canvas", {
|
|
3443
3443
|
ref: d,
|
|
3444
|
-
className: `${
|
|
3444
|
+
className: `${$t.canvas} ${h ? $t.hidden : ""}`,
|
|
3445
3445
|
style: {
|
|
3446
3446
|
width: a,
|
|
3447
3447
|
height: c
|
|
@@ -3455,7 +3455,7 @@ var L = {
|
|
|
3455
3455
|
onTouchEnd: C
|
|
3456
3456
|
})]
|
|
3457
3457
|
});
|
|
3458
|
-
},
|
|
3458
|
+
}, Y = {
|
|
3459
3459
|
slotMachine: "cos-slotMachine-P6FyZ",
|
|
3460
3460
|
machine: "cos-machine-B066r",
|
|
3461
3461
|
reel: "cos-reel-eEpJ3",
|
|
@@ -3464,14 +3464,14 @@ var L = {
|
|
|
3464
3464
|
mask: "cos-mask-jdrj3",
|
|
3465
3465
|
spinBtn: "cos-spinBtn-DvDE7",
|
|
3466
3466
|
result: "cos-result-dLN5b"
|
|
3467
|
-
},
|
|
3467
|
+
}, tn = [
|
|
3468
3468
|
"🍒",
|
|
3469
3469
|
"🍋",
|
|
3470
3470
|
"🍊",
|
|
3471
3471
|
"🍇",
|
|
3472
3472
|
"⭐",
|
|
3473
3473
|
"7️⃣"
|
|
3474
|
-
],
|
|
3474
|
+
], nn = (e) => 1 - (1 - e) ** 3, rn = ({ symbols: e = tn, onSpinEnd: r }) => {
|
|
3475
3475
|
let [i, a] = s(!1), [c, d] = s([
|
|
3476
3476
|
0,
|
|
3477
3477
|
0,
|
|
@@ -3488,31 +3488,31 @@ var L = {
|
|
|
3488
3488
|
return n(() => () => {
|
|
3489
3489
|
g.current && (g.current.cancelled = !0), cancelAnimationFrame(m.current);
|
|
3490
3490
|
}, []), /* @__PURE__ */ u("div", {
|
|
3491
|
-
className:
|
|
3491
|
+
className: Y.slotMachine,
|
|
3492
3492
|
children: [
|
|
3493
3493
|
/* @__PURE__ */ l("div", {
|
|
3494
|
-
className:
|
|
3494
|
+
className: Y.machine,
|
|
3495
3495
|
children: [
|
|
3496
3496
|
0,
|
|
3497
3497
|
1,
|
|
3498
3498
|
2
|
|
3499
3499
|
].map((e) => /* @__PURE__ */ u("div", {
|
|
3500
|
-
className:
|
|
3500
|
+
className: Y.reel,
|
|
3501
3501
|
style: { height: 240 },
|
|
3502
3502
|
children: [/* @__PURE__ */ l("div", {
|
|
3503
|
-
className:
|
|
3503
|
+
className: Y.strip,
|
|
3504
3504
|
style: { transform: `translateY(${c[e]}px)` },
|
|
3505
3505
|
children: _.map((e, t) => /* @__PURE__ */ l("div", {
|
|
3506
|
-
className:
|
|
3506
|
+
className: Y.item,
|
|
3507
3507
|
style: { height: 80 },
|
|
3508
3508
|
children: e
|
|
3509
3509
|
}, t))
|
|
3510
|
-
}), /* @__PURE__ */ l("div", { className:
|
|
3510
|
+
}), /* @__PURE__ */ l("div", { className: Y.mask })]
|
|
3511
3511
|
}, e))
|
|
3512
3512
|
}),
|
|
3513
3513
|
/* @__PURE__ */ l("button", {
|
|
3514
3514
|
type: "button",
|
|
3515
|
-
className:
|
|
3515
|
+
className: Y.spinBtn,
|
|
3516
3516
|
onClick: () => {
|
|
3517
3517
|
if (i) return;
|
|
3518
3518
|
a(!0), p([]);
|
|
@@ -3531,7 +3531,7 @@ var L = {
|
|
|
3531
3531
|
if (d(r.map((e, t) => {
|
|
3532
3532
|
let r = i - l - s[t];
|
|
3533
3533
|
if (r < 0) return e;
|
|
3534
|
-
let a =
|
|
3534
|
+
let a = nn(Math.min(r / o, 1));
|
|
3535
3535
|
return e + (n[t] - e) * a;
|
|
3536
3536
|
})), !s.every((e) => i - l - e >= o)) m.current = requestAnimationFrame(f);
|
|
3537
3537
|
else if (!u.cancelled) {
|
|
@@ -3546,12 +3546,12 @@ var L = {
|
|
|
3546
3546
|
children: i ? "旋转中..." : "开始"
|
|
3547
3547
|
}),
|
|
3548
3548
|
f.length > 0 && !i && /* @__PURE__ */ l("p", {
|
|
3549
|
-
className:
|
|
3549
|
+
className: Y.result,
|
|
3550
3550
|
children: f[0] === f[1] && f[1] === f[2] ? "🎰 大奖!" : `结果: ${f.join(" ")}`
|
|
3551
3551
|
})
|
|
3552
3552
|
]
|
|
3553
3553
|
});
|
|
3554
|
-
},
|
|
3554
|
+
}, an = {
|
|
3555
3555
|
splitReveal: "cos-splitReveal-6W8-6",
|
|
3556
3556
|
text: "cos-text-miTsj",
|
|
3557
3557
|
char: "cos-char-0gPJV",
|
|
@@ -3560,27 +3560,27 @@ var L = {
|
|
|
3560
3560
|
fromBottom: "cos-fromBottom-24D6g",
|
|
3561
3561
|
fromLeft: "cos-fromLeft-OMiPY",
|
|
3562
3562
|
fromRight: "cos-fromRight-EcMOR"
|
|
3563
|
-
},
|
|
3563
|
+
}, on = [
|
|
3564
3564
|
"fromTop",
|
|
3565
3565
|
"fromBottom",
|
|
3566
3566
|
"fromLeft",
|
|
3567
3567
|
"fromRight"
|
|
3568
|
-
],
|
|
3569
|
-
className:
|
|
3568
|
+
], sn = ({ text: e = "REVEAL", delay: t = 80, color: n = "#f8fafc" }) => /* @__PURE__ */ l("div", {
|
|
3569
|
+
className: an.splitReveal,
|
|
3570
3570
|
children: /* @__PURE__ */ l("h1", {
|
|
3571
|
-
className:
|
|
3571
|
+
className: an.text,
|
|
3572
3572
|
style: { "--reveal-color": n },
|
|
3573
3573
|
children: e.split("").map((e, n) => /* @__PURE__ */ l("span", {
|
|
3574
|
-
className: `${
|
|
3574
|
+
className: `${an.char} ${an[on[n % on.length]]}`,
|
|
3575
3575
|
style: { animationDelay: `${n * t}ms` },
|
|
3576
3576
|
children: e === " " ? "\xA0" : e
|
|
3577
3577
|
}, `${e}-${n}`))
|
|
3578
3578
|
})
|
|
3579
|
-
}),
|
|
3579
|
+
}), cn = {
|
|
3580
3580
|
spotlight: "cos-spotlight-OddY1",
|
|
3581
3581
|
content: "cos-content-5I1Wy",
|
|
3582
3582
|
overlay: "cos-overlay-F6CJ5"
|
|
3583
|
-
},
|
|
3583
|
+
}, ln = ({ children: e, radius: n = 120, dimColor: r = "rgba(0, 0, 0, 0.85)" }) => {
|
|
3584
3584
|
let i = o(null), a = t((e) => {
|
|
3585
3585
|
let t = i.current;
|
|
3586
3586
|
if (!t) return;
|
|
@@ -3589,18 +3589,18 @@ var L = {
|
|
|
3589
3589
|
}, []);
|
|
3590
3590
|
return /* @__PURE__ */ u("div", {
|
|
3591
3591
|
ref: i,
|
|
3592
|
-
className:
|
|
3592
|
+
className: cn.spotlight,
|
|
3593
3593
|
style: {
|
|
3594
3594
|
"--spot-radius": `${n}px`,
|
|
3595
3595
|
"--dim-color": r
|
|
3596
3596
|
},
|
|
3597
3597
|
onMouseMove: a,
|
|
3598
3598
|
children: [/* @__PURE__ */ l("div", {
|
|
3599
|
-
className:
|
|
3599
|
+
className: cn.content,
|
|
3600
3600
|
children: e
|
|
3601
|
-
}), /* @__PURE__ */ l("div", { className:
|
|
3601
|
+
}), /* @__PURE__ */ l("div", { className: cn.overlay })]
|
|
3602
3602
|
});
|
|
3603
|
-
},
|
|
3603
|
+
}, X = {
|
|
3604
3604
|
turntable: "cos-turntable-dkc32",
|
|
3605
3605
|
wheelWrap: "cos-wheelWrap-n7lhc",
|
|
3606
3606
|
canvas: "cos-canvas-A1-4x",
|
|
@@ -3608,7 +3608,7 @@ var L = {
|
|
|
3608
3608
|
spinBtn: "cos-spinBtn-l9JIC",
|
|
3609
3609
|
result: "cos-result-H8q2c",
|
|
3610
3610
|
"fade-in": "cos-fade-in-U9bUC"
|
|
3611
|
-
},
|
|
3611
|
+
}, un = [
|
|
3612
3612
|
"#FF6B6B",
|
|
3613
3613
|
"#4ECDC4",
|
|
3614
3614
|
"#FFE66D",
|
|
@@ -3617,19 +3617,19 @@ var L = {
|
|
|
3617
3617
|
"#F472B6",
|
|
3618
3618
|
"#34D399",
|
|
3619
3619
|
"#FB923C"
|
|
3620
|
-
],
|
|
3620
|
+
], dn = [
|
|
3621
3621
|
{ label: "一等奖" },
|
|
3622
3622
|
{ label: "二等奖" },
|
|
3623
3623
|
{ label: "三等奖" },
|
|
3624
3624
|
{ label: "谢谢参与" },
|
|
3625
3625
|
{ label: "优惠券" },
|
|
3626
3626
|
{ label: "再来一次" }
|
|
3627
|
-
],
|
|
3627
|
+
], fn = (e) => 1 - (1 - e) ** 3, pn = ({ prizes: e = dn, size: r = 360, spinDuration: i = 4e3, spinRounds: a = 5, buttonText: c = "开始抽奖", onSpinEnd: d }) => {
|
|
3628
3628
|
let f = o(null), p = o(0), m = o(0), h = o(1), [g, _] = s(!1), [v, y] = s(null), b = o(d), x = o(null);
|
|
3629
3629
|
n(() => {
|
|
3630
3630
|
b.current = d;
|
|
3631
3631
|
}, [d]);
|
|
3632
|
-
let S = r + 48, C = (e, t) => t.color ??
|
|
3632
|
+
let S = r + 48, C = (e, t) => t.color ?? un[e % un.length], w = t((t) => {
|
|
3633
3633
|
let n = f.current;
|
|
3634
3634
|
if (!n) return;
|
|
3635
3635
|
let i = n.getContext("2d");
|
|
@@ -3664,22 +3664,22 @@ var L = {
|
|
|
3664
3664
|
return Math.floor((360 - r + n / 2) % 360 / n) % e.length;
|
|
3665
3665
|
};
|
|
3666
3666
|
return /* @__PURE__ */ u("div", {
|
|
3667
|
-
className:
|
|
3667
|
+
className: X.turntable,
|
|
3668
3668
|
style: {
|
|
3669
3669
|
width: S,
|
|
3670
3670
|
height: S + 80
|
|
3671
3671
|
},
|
|
3672
3672
|
children: [/* @__PURE__ */ u("div", {
|
|
3673
|
-
className:
|
|
3673
|
+
className: X.wheelWrap,
|
|
3674
3674
|
style: {
|
|
3675
3675
|
width: S,
|
|
3676
3676
|
height: S
|
|
3677
3677
|
},
|
|
3678
3678
|
children: [
|
|
3679
|
-
/* @__PURE__ */ l("div", { className:
|
|
3679
|
+
/* @__PURE__ */ l("div", { className: X.pointer }),
|
|
3680
3680
|
/* @__PURE__ */ l("canvas", {
|
|
3681
3681
|
ref: f,
|
|
3682
|
-
className:
|
|
3682
|
+
className: X.canvas,
|
|
3683
3683
|
style: {
|
|
3684
3684
|
width: S,
|
|
3685
3685
|
height: S
|
|
@@ -3687,7 +3687,7 @@ var L = {
|
|
|
3687
3687
|
}),
|
|
3688
3688
|
/* @__PURE__ */ l("button", {
|
|
3689
3689
|
type: "button",
|
|
3690
|
-
className:
|
|
3690
|
+
className: X.spinBtn,
|
|
3691
3691
|
onClick: () => {
|
|
3692
3692
|
if (g || e.length === 0) return;
|
|
3693
3693
|
_(!0), y(null);
|
|
@@ -3695,7 +3695,7 @@ var L = {
|
|
|
3695
3695
|
x.current = l;
|
|
3696
3696
|
let u = (t) => {
|
|
3697
3697
|
if (l.cancelled) return;
|
|
3698
|
-
let n = t - c, r = Math.min(n / i, 1), a =
|
|
3698
|
+
let n = t - c, r = Math.min(n / i, 1), a = fn(r), d = s + (o - s) * a;
|
|
3699
3699
|
if (p.current = d, w(d), r < 1) m.current = requestAnimationFrame(u);
|
|
3700
3700
|
else if (!l.cancelled) {
|
|
3701
3701
|
let t = T(d), n = e[t];
|
|
@@ -3709,11 +3709,11 @@ var L = {
|
|
|
3709
3709
|
})
|
|
3710
3710
|
]
|
|
3711
3711
|
}), v && !g && /* @__PURE__ */ u("p", {
|
|
3712
|
-
className:
|
|
3712
|
+
className: X.result,
|
|
3713
3713
|
children: ["恭喜获得:", /* @__PURE__ */ l("strong", { children: v.label })]
|
|
3714
3714
|
})]
|
|
3715
3715
|
});
|
|
3716
|
-
},
|
|
3716
|
+
}, mn = {
|
|
3717
3717
|
typewriter: "cos-typewriter-7UhOL",
|
|
3718
3718
|
terminal: "cos-terminal-NWNVN",
|
|
3719
3719
|
dots: "cos-dots-oulNg",
|
|
@@ -3721,11 +3721,11 @@ var L = {
|
|
|
3721
3721
|
prompt: "cos-prompt-Y4hVD",
|
|
3722
3722
|
cursor: "cos-cursor-m8hGi",
|
|
3723
3723
|
blink: "cos-blink-XykM7"
|
|
3724
|
-
},
|
|
3724
|
+
}, hn = [
|
|
3725
3725
|
"Hello, cos-design!",
|
|
3726
3726
|
"欢迎来到组件库 ✨",
|
|
3727
3727
|
"Build something fun 🚀"
|
|
3728
|
-
],
|
|
3728
|
+
], gn = ({ texts: e, speed: t, deleteSpeed: r, pause: i }) => {
|
|
3729
3729
|
let [a, o] = s(""), [c, d] = s(0), [f, p] = s(!1);
|
|
3730
3730
|
return n(() => {
|
|
3731
3731
|
let n = e[c % e.length], s;
|
|
@@ -3747,114 +3747,365 @@ var L = {
|
|
|
3747
3747
|
r,
|
|
3748
3748
|
i
|
|
3749
3749
|
]), /* @__PURE__ */ l("div", {
|
|
3750
|
-
className:
|
|
3750
|
+
className: mn.typewriter,
|
|
3751
3751
|
children: /* @__PURE__ */ u("div", {
|
|
3752
|
-
className:
|
|
3752
|
+
className: mn.terminal,
|
|
3753
3753
|
children: [/* @__PURE__ */ u("div", {
|
|
3754
|
-
className:
|
|
3754
|
+
className: mn.dots,
|
|
3755
3755
|
children: [
|
|
3756
3756
|
/* @__PURE__ */ l("span", {}),
|
|
3757
3757
|
/* @__PURE__ */ l("span", {}),
|
|
3758
3758
|
/* @__PURE__ */ l("span", {})
|
|
3759
3759
|
]
|
|
3760
3760
|
}), /* @__PURE__ */ u("p", {
|
|
3761
|
-
className:
|
|
3761
|
+
className: mn.text,
|
|
3762
3762
|
children: [
|
|
3763
3763
|
/* @__PURE__ */ l("span", {
|
|
3764
|
-
className:
|
|
3764
|
+
className: mn.prompt,
|
|
3765
3765
|
children: ">"
|
|
3766
3766
|
}),
|
|
3767
3767
|
a,
|
|
3768
3768
|
/* @__PURE__ */ l("span", {
|
|
3769
|
-
className:
|
|
3769
|
+
className: mn.cursor,
|
|
3770
3770
|
children: "|"
|
|
3771
3771
|
})
|
|
3772
3772
|
]
|
|
3773
3773
|
})]
|
|
3774
3774
|
})
|
|
3775
3775
|
});
|
|
3776
|
-
},
|
|
3777
|
-
let i = e.length > 0 ? e :
|
|
3778
|
-
return /* @__PURE__ */ l(
|
|
3776
|
+
}, _n = ({ texts: e = hn, speed: t = 100, deleteSpeed: n = 50, pause: r = 2e3 }) => {
|
|
3777
|
+
let i = e.length > 0 ? e : hn;
|
|
3778
|
+
return /* @__PURE__ */ l(gn, {
|
|
3779
3779
|
texts: i,
|
|
3780
3780
|
speed: t,
|
|
3781
3781
|
deleteSpeed: n,
|
|
3782
3782
|
pause: r
|
|
3783
3783
|
}, i.join("\0"));
|
|
3784
|
-
},
|
|
3784
|
+
}, vn = {
|
|
3785
3785
|
waveButton: "cos-waveButton-Aa7G-",
|
|
3786
3786
|
btn: "cos-btn-WJrEN",
|
|
3787
3787
|
label: "cos-label-9BHOU",
|
|
3788
3788
|
wave: "cos-wave-GycLU",
|
|
3789
3789
|
ripple: "cos-ripple-5ZFpr"
|
|
3790
|
-
},
|
|
3791
|
-
className:
|
|
3790
|
+
}, yn = ({ text: e = "点我试试", color: t = "#38bdf8", className: n, style: r, ...i }) => /* @__PURE__ */ l("div", {
|
|
3791
|
+
className: vn.waveButton,
|
|
3792
3792
|
children: /* @__PURE__ */ u("button", {
|
|
3793
3793
|
type: "button",
|
|
3794
|
-
className: `${
|
|
3794
|
+
className: `${vn.btn} ${n ?? ""}`,
|
|
3795
3795
|
style: {
|
|
3796
3796
|
"--wave-color": t,
|
|
3797
3797
|
...r
|
|
3798
3798
|
},
|
|
3799
3799
|
...i,
|
|
3800
3800
|
children: [
|
|
3801
|
-
/* @__PURE__ */ l("span", { className:
|
|
3802
|
-
/* @__PURE__ */ l("span", { className:
|
|
3801
|
+
/* @__PURE__ */ l("span", { className: vn.wave }),
|
|
3802
|
+
/* @__PURE__ */ l("span", { className: vn.wave }),
|
|
3803
3803
|
/* @__PURE__ */ l("span", {
|
|
3804
|
-
className:
|
|
3804
|
+
className: vn.label,
|
|
3805
3805
|
children: e
|
|
3806
3806
|
})
|
|
3807
3807
|
]
|
|
3808
3808
|
})
|
|
3809
|
-
}),
|
|
3809
|
+
}), Z = (e) => Math.min(1, Math.max(0, e)), bn = (e) => {
|
|
3810
|
+
let t = e.replace("#", "").trim(), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t;
|
|
3811
|
+
if (n.length !== 6) return [
|
|
3812
|
+
80,
|
|
3813
|
+
140,
|
|
3814
|
+
200
|
|
3815
|
+
];
|
|
3816
|
+
let r = Number.parseInt(n, 16);
|
|
3817
|
+
return Number.isNaN(r) ? [
|
|
3818
|
+
80,
|
|
3819
|
+
140,
|
|
3820
|
+
200
|
|
3821
|
+
] : [
|
|
3822
|
+
r >> 16 & 255,
|
|
3823
|
+
r >> 8 & 255,
|
|
3824
|
+
r & 255
|
|
3825
|
+
];
|
|
3826
|
+
}, xn = ([e, t, n]) => {
|
|
3827
|
+
let r = (e) => Math.min(255, Math.max(0, Math.round(e))).toString(16).padStart(2, "0");
|
|
3828
|
+
return `#${r(e)}${r(t)}${r(n)}`;
|
|
3829
|
+
}, Sn = (e, t, n) => e + (t - e) * n, Cn = (e, t, n) => [
|
|
3830
|
+
Sn(e[0], t[0], n),
|
|
3831
|
+
Sn(e[1], t[1], n),
|
|
3832
|
+
Sn(e[2], t[2], n)
|
|
3833
|
+
], Q = (e, t, n) => xn(Cn(bn(e), bn(t), Z(n))), wn = (e) => {
|
|
3834
|
+
let t = Z(e);
|
|
3835
|
+
return t * t * (3 - 2 * t);
|
|
3836
|
+
}, Tn = (e = Date.now()) => {
|
|
3837
|
+
let t = new Date(e), n = new Date(t);
|
|
3838
|
+
n.setHours(6, 0, 0, 0);
|
|
3839
|
+
let r = new Date(t);
|
|
3840
|
+
return r.setHours(18, 0, 0, 0), {
|
|
3841
|
+
sunrise: n.getTime(),
|
|
3842
|
+
sunset: r.getTime()
|
|
3843
|
+
};
|
|
3844
|
+
}, En = (e, t = /* @__PURE__ */ new Date()) => {
|
|
3845
|
+
let n = e.trim().match(/^(\d{1,2}):(\d{2})$/);
|
|
3846
|
+
if (!n) return null;
|
|
3847
|
+
let r = Number(n[1]), i = Number(n[2]);
|
|
3848
|
+
if (r < 0 || r > 23 || i < 0 || i > 59) return null;
|
|
3849
|
+
let a = new Date(t);
|
|
3850
|
+
return a.setHours(r, i, 0, 0), a.getTime();
|
|
3851
|
+
}, Dn = (e, t = /* @__PURE__ */ new Date()) => En(e ?? "14:00", t) ?? En("14:00", t), On = (e, t) => {
|
|
3852
|
+
let { sunrise: n, sunset: r } = t;
|
|
3853
|
+
if (!(r > n)) {
|
|
3854
|
+
let t = Tn(e);
|
|
3855
|
+
n = t.sunrise, r = t.sunset;
|
|
3856
|
+
}
|
|
3857
|
+
let i = Math.max(1, r - n), a = n + 1440 * 60 * 1e3, o = r - 1440 * 60 * 1e3, s = e >= n && e < r, c;
|
|
3858
|
+
if (s) c = Z((e - n) / i);
|
|
3859
|
+
else if (e >= r) {
|
|
3860
|
+
let t = Math.max(1, a - r);
|
|
3861
|
+
c = Z((e - r) / t);
|
|
3862
|
+
} else {
|
|
3863
|
+
let t = Math.max(1, n - o);
|
|
3864
|
+
c = Z((e - o) / t);
|
|
3865
|
+
}
|
|
3866
|
+
let l = s ? Math.sin(Math.PI * c) : 0, u = Math.abs(e - n), d = Math.abs(e - r), f = Z(1 - Math.min(u, d) / 45e5);
|
|
3867
|
+
return {
|
|
3868
|
+
isDay: s,
|
|
3869
|
+
arcProgress: c,
|
|
3870
|
+
elevation: l,
|
|
3871
|
+
twilight: f
|
|
3872
|
+
};
|
|
3873
|
+
}, kn = (e, t, n) => {
|
|
3874
|
+
let r = Z(n), i = Math.sin(Math.PI * r);
|
|
3875
|
+
return {
|
|
3876
|
+
x: e * (.1 + .8 * r),
|
|
3877
|
+
y: t * (.58 - .4 * i)
|
|
3878
|
+
};
|
|
3879
|
+
}, An = "#e8895c", jn = "#f3c98a", Mn = "#2a1f4a", Nn = "#c4784a", Pn = (e, t, n) => {
|
|
3880
|
+
if (n.isDay) {
|
|
3881
|
+
let t = wn(n.elevation), r = (1 - t) * .72;
|
|
3882
|
+
return [Q(Q(e[0], An, r), "#1a2438", (1 - t) * .12), Q(Q(e[1], jn, r * .85), "#3a4558", (1 - t) * .08)];
|
|
3883
|
+
}
|
|
3884
|
+
let r = n.twilight;
|
|
3885
|
+
return [Q(t[0], Q(Mn, An, .35), r * .55), Q(t[1], Q(Nn, jn, .4), r * .7)];
|
|
3886
|
+
}, Fn = (e, t, n) => {
|
|
3887
|
+
let r = e.createLinearGradient(0, 0, 0, t);
|
|
3888
|
+
return r.addColorStop(0, n[0]), r.addColorStop(1, n[1]), r;
|
|
3889
|
+
}, In = (e) => {
|
|
3890
|
+
if (!e.isDay) return {
|
|
3891
|
+
scale: .92 + e.twilight * .06,
|
|
3892
|
+
alpha: .75 + e.twilight * .2
|
|
3893
|
+
};
|
|
3894
|
+
let t = e.elevation;
|
|
3895
|
+
return {
|
|
3896
|
+
scale: .82 + t * .22,
|
|
3897
|
+
alpha: .65 + t * .35
|
|
3898
|
+
};
|
|
3899
|
+
}, Ln = 2, Rn = [
|
|
3900
|
+
"",
|
|
3901
|
+
"薄雾",
|
|
3902
|
+
"中雾",
|
|
3903
|
+
"浓雾"
|
|
3904
|
+
], zn = (e) => Math.min(3, Math.max(1, Math.round(e))), Bn = (e) => {
|
|
3905
|
+
let t = zn(e);
|
|
3906
|
+
return `${t} · ${Rn[t]}`;
|
|
3907
|
+
}, Vn = (e) => e === "fog", Hn = (e, t) => {
|
|
3908
|
+
let n = zn(t);
|
|
3909
|
+
return n === 1 ? {
|
|
3910
|
+
...e,
|
|
3911
|
+
fogBanks: 3,
|
|
3912
|
+
haze: .06,
|
|
3913
|
+
cloudAlpha: Math.min(e.cloudAlpha, .28),
|
|
3914
|
+
sun: "soft"
|
|
3915
|
+
} : n === 3 ? {
|
|
3916
|
+
...e,
|
|
3917
|
+
fogBanks: 12,
|
|
3918
|
+
haze: .3,
|
|
3919
|
+
cloudAlpha: .42,
|
|
3920
|
+
sun: "dim"
|
|
3921
|
+
} : {
|
|
3922
|
+
...e,
|
|
3923
|
+
fogBanks: 5,
|
|
3924
|
+
haze: .11,
|
|
3925
|
+
cloudAlpha: .32,
|
|
3926
|
+
sun: "dim"
|
|
3927
|
+
};
|
|
3928
|
+
}, Un = (e) => {
|
|
3929
|
+
let t = zn(e);
|
|
3930
|
+
return t === 1 ? .45 : t === 3 ? .95 : .65;
|
|
3931
|
+
}, Wn = (e) => e === 45 ? 2 : e === 48 ? 3 : null, Gn = (e) => e == null || !Number.isFinite(e) ? null : e >= 5e3 ? 1 : e >= 1e3 ? 2 : 3, Kn = 2, qn = [
|
|
3932
|
+
"",
|
|
3933
|
+
"细雹",
|
|
3934
|
+
"密雹",
|
|
3935
|
+
"巨雹"
|
|
3936
|
+
], Jn = (e) => Math.min(3, Math.max(1, Math.round(e))), Yn = (e) => {
|
|
3937
|
+
let t = Jn(e);
|
|
3938
|
+
return `${t} · ${qn[t]}`;
|
|
3939
|
+
}, Xn = (e) => e === "hail", Zn = (e) => {
|
|
3940
|
+
let t = Jn(e);
|
|
3941
|
+
return t === 1 ? {
|
|
3942
|
+
count: 75,
|
|
3943
|
+
sizeMin: .85,
|
|
3944
|
+
sizeMax: 2.1,
|
|
3945
|
+
speedMul: .88
|
|
3946
|
+
} : t === 3 ? {
|
|
3947
|
+
count: 210,
|
|
3948
|
+
sizeMin: 2.4,
|
|
3949
|
+
sizeMax: 5.6,
|
|
3950
|
+
speedMul: 1.22
|
|
3951
|
+
} : {
|
|
3952
|
+
count: 145,
|
|
3953
|
+
sizeMin: 1.4,
|
|
3954
|
+
sizeMax: 3.8,
|
|
3955
|
+
speedMul: 1
|
|
3956
|
+
};
|
|
3957
|
+
}, Qn = (e) => e === 96 ? 2 : e === 99 ? 3 : null, $n = 1, er = 10, tr = 5, nr = 5, $ = (e) => Math.min(10, Math.max(1, Math.round(e))), rr = (e, t, n) => e + (t - e) * n, ir = (e) => {
|
|
3958
|
+
let t = $(e);
|
|
3959
|
+
return t <= 2 ? 1 : t <= 4 ? 2 : t <= 6 ? 3 : t <= 8 ? 4 : 5;
|
|
3960
|
+
}, ar = [
|
|
3961
|
+
"毛毛雨",
|
|
3962
|
+
"小雨",
|
|
3963
|
+
"中雨",
|
|
3964
|
+
"暴雨",
|
|
3965
|
+
"特大暴雨"
|
|
3966
|
+
], or = [
|
|
3967
|
+
"毛毛雪",
|
|
3968
|
+
"小雪",
|
|
3969
|
+
"中雪",
|
|
3970
|
+
"暴雪",
|
|
3971
|
+
"特大暴雪"
|
|
3972
|
+
], sr = (e, t) => {
|
|
3973
|
+
let n = ir(e);
|
|
3974
|
+
return (t === "rain" ? ar : or)[n - 1];
|
|
3975
|
+
}, cr = (e, t) => `${$(e)} · ${sr(e, t)}`, lr = ["", ...ar], ur = ["", ...or], dr = (e) => e === "lightRain" || e === "moderateRain" || e === "heavyRain" ? "rain" : e === "lightSnow" || e === "moderateSnow" || e === "heavySnow" ? "snow" : e, fr = (e) => e === "rain" || e === "lightRain" || e === "moderateRain" || e === "heavyRain", pr = (e) => e === "snow" || e === "lightSnow" || e === "moderateSnow" || e === "heavySnow", mr = (e) => fr(e) || e === "thunderstorm" || e === "sleet", hr = (e) => pr(e) || e === "sleet", gr = (e, t = 5) => e === "lightRain" ? 3 : e === "moderateRain" ? 5 : e === "heavyRain" ? 8 : $(t), _r = (e, t = 5) => e === "lightSnow" ? 3 : e === "moderateSnow" ? 5 : e === "heavySnow" ? 8 : $(t), vr = (e, t) => t === "rain" ? e <= 2 ? "lightRain" : e === 3 ? "moderateRain" : "heavyRain" : e <= 2 ? "lightSnow" : e === 3 ? "moderateSnow" : "heavySnow", yr = (e, t = 5, n = 5) => e === "rain" ? vr(ir(t), "rain") : e === "lightRain" || e === "moderateRain" || e === "heavyRain" ? vr(ir(gr(e)), "rain") : e === "snow" ? vr(ir(n), "snow") : e === "lightSnow" || e === "moderateSnow" || e === "heavySnow" ? vr(ir(_r(e)), "snow") : e, br = (e, t) => {
|
|
3976
|
+
let n = ($(t) - 1) / 9;
|
|
3977
|
+
return {
|
|
3978
|
+
count: Math.round(rr(35, 340, n)),
|
|
3979
|
+
speed: rr(5.5, 16, n),
|
|
3980
|
+
wind: rr(-.4, -3.2, n),
|
|
3981
|
+
alpha: rr(.28, .62, n),
|
|
3982
|
+
splash: $(t) >= 5
|
|
3983
|
+
};
|
|
3984
|
+
}, xr = (e) => {
|
|
3985
|
+
let t = ($(e) - 1) / 9;
|
|
3986
|
+
return Math.round(rr(30, 360, t));
|
|
3987
|
+
}, Sr = (e) => [51, 56].includes(e) ? 2 : [
|
|
3988
|
+
61,
|
|
3989
|
+
66,
|
|
3990
|
+
80
|
|
3991
|
+
].includes(e) ? 3 : [
|
|
3992
|
+
53,
|
|
3993
|
+
55,
|
|
3994
|
+
57,
|
|
3995
|
+
63,
|
|
3996
|
+
81
|
|
3997
|
+
].includes(e) ? 5 : [65, 67].includes(e) ? 8 : [82].includes(e) ? 10 : [95].includes(e) ? 7 : null, Cr = (e) => [77].includes(e) ? 2 : [71, 85].includes(e) ? 3 : [73].includes(e) ? 5 : [75].includes(e) ? 8 : [86].includes(e) ? 10 : null, wr = 2, Tr = [
|
|
3998
|
+
"",
|
|
3999
|
+
"轻霾",
|
|
4000
|
+
"中霾",
|
|
4001
|
+
"重霾"
|
|
4002
|
+
], Er = (e) => Math.min(3, Math.max(1, Math.round(e))), Dr = (e) => {
|
|
4003
|
+
let t = Er(e);
|
|
4004
|
+
return `${t} · ${Tr[t]}`;
|
|
4005
|
+
}, Or = (e) => e === "smog", kr = (e, t) => {
|
|
4006
|
+
let n = Er(t);
|
|
4007
|
+
return n === 1 ? {
|
|
4008
|
+
...e,
|
|
4009
|
+
fogBanks: 5,
|
|
4010
|
+
haze: .16,
|
|
4011
|
+
cloudAlpha: Math.min(e.cloudAlpha, .28),
|
|
4012
|
+
sun: "soft"
|
|
4013
|
+
} : n === 3 ? {
|
|
4014
|
+
...e,
|
|
4015
|
+
fogBanks: 16,
|
|
4016
|
+
haze: .48,
|
|
4017
|
+
cloudAlpha: .42,
|
|
4018
|
+
sun: "dim"
|
|
4019
|
+
} : {
|
|
4020
|
+
...e,
|
|
4021
|
+
fogBanks: 12,
|
|
4022
|
+
haze: .34,
|
|
4023
|
+
cloudAlpha: .35,
|
|
4024
|
+
sun: "dim"
|
|
4025
|
+
};
|
|
4026
|
+
}, Ar = (e) => {
|
|
4027
|
+
let t = Er(e);
|
|
4028
|
+
return t === 1 ? .55 : t === 3 ? 1.05 : .85;
|
|
4029
|
+
}, jr = (e) => e == null || !Number.isFinite(e) ? null : e >= 5e3 ? 1 : e >= 1e3 ? 2 : 3, Mr = {
|
|
3810
4030
|
0: "sunny",
|
|
3811
4031
|
1: "sunny",
|
|
3812
4032
|
2: "partlyCloudy",
|
|
3813
4033
|
3: "overcast",
|
|
3814
4034
|
45: "fog",
|
|
3815
4035
|
48: "fog",
|
|
3816
|
-
51: "
|
|
3817
|
-
53: "
|
|
3818
|
-
55: "
|
|
3819
|
-
56: "
|
|
3820
|
-
57: "
|
|
3821
|
-
61: "
|
|
3822
|
-
63: "
|
|
3823
|
-
65: "
|
|
3824
|
-
66: "
|
|
3825
|
-
67: "
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
85: "
|
|
3834
|
-
86: "
|
|
4036
|
+
51: "rain",
|
|
4037
|
+
53: "rain",
|
|
4038
|
+
55: "rain",
|
|
4039
|
+
56: "rain",
|
|
4040
|
+
57: "rain",
|
|
4041
|
+
61: "rain",
|
|
4042
|
+
63: "rain",
|
|
4043
|
+
65: "rain",
|
|
4044
|
+
66: "rain",
|
|
4045
|
+
67: "rain",
|
|
4046
|
+
80: "rain",
|
|
4047
|
+
81: "rain",
|
|
4048
|
+
82: "rain",
|
|
4049
|
+
71: "snow",
|
|
4050
|
+
73: "snow",
|
|
4051
|
+
75: "snow",
|
|
4052
|
+
77: "snow",
|
|
4053
|
+
85: "snow",
|
|
4054
|
+
86: "snow",
|
|
3835
4055
|
95: "thunderstorm",
|
|
3836
4056
|
96: "hail",
|
|
3837
4057
|
99: "hail"
|
|
3838
|
-
},
|
|
3839
|
-
let n = vn[e] ?? "overcast";
|
|
3840
|
-
return (n === "sunny" || n === "partlyCloudy" || n === "overcast") && t >= _n ? "gale" : n;
|
|
3841
|
-
}, bn = {
|
|
4058
|
+
}, Nr = (e) => dr(Mr[e] ?? "overcast"), Pr = {
|
|
3842
4059
|
weather: null,
|
|
4060
|
+
rainLevel: null,
|
|
4061
|
+
snowLevel: null,
|
|
4062
|
+
fogLevel: null,
|
|
4063
|
+
hailLevel: null,
|
|
4064
|
+
smogLevel: null,
|
|
3843
4065
|
status: "idle",
|
|
3844
4066
|
error: null,
|
|
3845
4067
|
current: null
|
|
3846
|
-
},
|
|
4068
|
+
}, Fr = {
|
|
3847
4069
|
weather: null,
|
|
4070
|
+
rainLevel: null,
|
|
4071
|
+
snowLevel: null,
|
|
4072
|
+
fogLevel: null,
|
|
4073
|
+
hailLevel: null,
|
|
4074
|
+
smogLevel: null,
|
|
3848
4075
|
status: "locating",
|
|
3849
4076
|
error: null,
|
|
3850
4077
|
current: null
|
|
3851
|
-
},
|
|
4078
|
+
}, Ir = {
|
|
3852
4079
|
weather: null,
|
|
4080
|
+
rainLevel: null,
|
|
4081
|
+
snowLevel: null,
|
|
4082
|
+
fogLevel: null,
|
|
4083
|
+
hailLevel: null,
|
|
4084
|
+
smogLevel: null,
|
|
3853
4085
|
status: "fetching",
|
|
3854
4086
|
error: null,
|
|
3855
4087
|
current: null
|
|
3856
|
-
},
|
|
3857
|
-
|
|
4088
|
+
}, Lr = (e) => e != null && Number.isFinite(e.latitude) && Number.isFinite(e.longitude), Rr = (e) => {
|
|
4089
|
+
if (typeof e != "string" || !e) return null;
|
|
4090
|
+
let t = Date.parse(e);
|
|
4091
|
+
return Number.isFinite(t) ? t : null;
|
|
4092
|
+
}, zr = (e) => {
|
|
4093
|
+
if (typeof e != "string" || !e) return null;
|
|
4094
|
+
let t = e.match(/T(\d{2}):(\d{2})/);
|
|
4095
|
+
return t ? `${t[1]}:${t[2]}` : null;
|
|
4096
|
+
}, Br = (e, t) => {
|
|
4097
|
+
if (e) try {
|
|
4098
|
+
let t = new Intl.DateTimeFormat("en-GB", {
|
|
4099
|
+
timeZone: e,
|
|
4100
|
+
hour: "2-digit",
|
|
4101
|
+
minute: "2-digit",
|
|
4102
|
+
hour12: !1
|
|
4103
|
+
}).formatToParts(/* @__PURE__ */ new Date()), n = t.find((e) => e.type === "hour")?.value, r = t.find((e) => e.type === "minute")?.value;
|
|
4104
|
+
if (n != null && r != null) return `${n.padStart(2, "0")}:${r.padStart(2, "0")}`;
|
|
4105
|
+
} catch {}
|
|
4106
|
+
return t ?? null;
|
|
4107
|
+
}, Vr = (e = !0, t) => {
|
|
4108
|
+
let r = Lr(t), i = r ? t.latitude : null, a = r ? t.longitude : null, o = e ? r ? Ir : Fr : Pr, c = `${e}:${i},${a}`, [l, u] = s(o), [d, f] = s(c);
|
|
3858
4109
|
return d !== c && (f(c), u((t) => e && t.weather ? {
|
|
3859
4110
|
...o,
|
|
3860
4111
|
weather: t.weather,
|
|
@@ -3866,15 +4117,23 @@ var L = {
|
|
|
3866
4117
|
let i = new URLSearchParams({
|
|
3867
4118
|
latitude: String(e),
|
|
3868
4119
|
longitude: String(r),
|
|
3869
|
-
current: "weather_code,wind_speed_10m,is_day"
|
|
4120
|
+
current: "weather_code,wind_speed_10m,is_day,visibility",
|
|
4121
|
+
daily: "sunrise,sunset",
|
|
4122
|
+
timezone: "auto",
|
|
4123
|
+
forecast_days: "1"
|
|
3870
4124
|
}), a = await fetch(`https://api.open-meteo.com/v1/forecast?${i}`, { signal: n.signal });
|
|
3871
4125
|
if (!a.ok) throw Error(`Open-Meteo 请求失败(HTTP ${a.status})`);
|
|
3872
4126
|
let o = await a.json(), s = Number(o?.current?.weather_code);
|
|
3873
4127
|
if (Number.isNaN(s)) throw Error("Open-Meteo 返回数据缺少 weather_code");
|
|
3874
|
-
let c = Number(o?.current?.wind_speed_10m ?? 0);
|
|
4128
|
+
let c = Number(o?.current?.wind_speed_10m ?? 0), l = Rr(o?.daily?.sunrise?.[0]), d = Rr(o?.daily?.sunset?.[0]), f = typeof o?.timezone == "string" ? o.timezone : null, p = zr(o?.current?.time) ?? Br(f), m = Nr(s), h = Sr(s), g = Cr(s), _ = o?.current?.visibility, v = _ != null && Number.isFinite(Number(_)) ? Number(_) : null, y = m === "fog" ? Gn(v) ?? Wn(s) ?? 2 : null, b = m === "hail" ? Qn(s) ?? 2 : null, x = m === "smog" ? jr(v) ?? 2 : null;
|
|
3875
4129
|
if (t) return;
|
|
3876
4130
|
u({
|
|
3877
|
-
weather:
|
|
4131
|
+
weather: m,
|
|
4132
|
+
rainLevel: h,
|
|
4133
|
+
snowLevel: g,
|
|
4134
|
+
fogLevel: y,
|
|
4135
|
+
hailLevel: b,
|
|
4136
|
+
smogLevel: x,
|
|
3878
4137
|
status: "success",
|
|
3879
4138
|
error: null,
|
|
3880
4139
|
current: {
|
|
@@ -3882,13 +4141,28 @@ var L = {
|
|
|
3882
4141
|
windSpeed: c,
|
|
3883
4142
|
isDay: o?.current?.is_day === 1,
|
|
3884
4143
|
latitude: e,
|
|
3885
|
-
longitude: r
|
|
4144
|
+
longitude: r,
|
|
4145
|
+
timezone: f,
|
|
4146
|
+
localTime: p,
|
|
4147
|
+
visibility: v,
|
|
4148
|
+
rainLevel: h,
|
|
4149
|
+
snowLevel: g,
|
|
4150
|
+
fogLevel: y,
|
|
4151
|
+
hailLevel: b,
|
|
4152
|
+
smogLevel: x,
|
|
4153
|
+
sunrise: l,
|
|
4154
|
+
sunset: d
|
|
3886
4155
|
}
|
|
3887
4156
|
});
|
|
3888
4157
|
} catch (e) {
|
|
3889
4158
|
if (t || e instanceof DOMException && e.name === "AbortError") return;
|
|
3890
4159
|
u({
|
|
3891
4160
|
weather: null,
|
|
4161
|
+
rainLevel: null,
|
|
4162
|
+
snowLevel: null,
|
|
4163
|
+
fogLevel: null,
|
|
4164
|
+
hailLevel: null,
|
|
4165
|
+
smogLevel: null,
|
|
3892
4166
|
status: "error",
|
|
3893
4167
|
error: e instanceof Error ? e.message : "天气获取失败",
|
|
3894
4168
|
current: null
|
|
@@ -3900,6 +4174,11 @@ var L = {
|
|
|
3900
4174
|
}) : typeof navigator > "u" || !navigator.geolocation ? (Promise.resolve().then(() => {
|
|
3901
4175
|
t || u({
|
|
3902
4176
|
weather: null,
|
|
4177
|
+
rainLevel: null,
|
|
4178
|
+
snowLevel: null,
|
|
4179
|
+
fogLevel: null,
|
|
4180
|
+
hailLevel: null,
|
|
4181
|
+
smogLevel: null,
|
|
3903
4182
|
status: "error",
|
|
3904
4183
|
error: "当前环境不支持定位",
|
|
3905
4184
|
current: null
|
|
@@ -3914,6 +4193,11 @@ var L = {
|
|
|
3914
4193
|
}, (e) => {
|
|
3915
4194
|
t || u({
|
|
3916
4195
|
weather: null,
|
|
4196
|
+
rainLevel: null,
|
|
4197
|
+
snowLevel: null,
|
|
4198
|
+
fogLevel: null,
|
|
4199
|
+
hailLevel: null,
|
|
4200
|
+
smogLevel: null,
|
|
3917
4201
|
status: "error",
|
|
3918
4202
|
error: e.message || "定位失败",
|
|
3919
4203
|
current: null
|
|
@@ -3929,49 +4213,157 @@ var L = {
|
|
|
3929
4213
|
i,
|
|
3930
4214
|
a
|
|
3931
4215
|
]), l;
|
|
3932
|
-
}
|
|
4216
|
+
}, Hr = async (e, t, n) => {
|
|
4217
|
+
let r = new URLSearchParams({
|
|
4218
|
+
latitude: String(e),
|
|
4219
|
+
longitude: String(t),
|
|
4220
|
+
daily: "sunrise,sunset",
|
|
4221
|
+
timezone: "auto",
|
|
4222
|
+
forecast_days: "1"
|
|
4223
|
+
}), i = await fetch(`https://api.open-meteo.com/v1/forecast?${r}`, { signal: n });
|
|
4224
|
+
if (!i.ok) return null;
|
|
4225
|
+
let a = await i.json(), o = Rr(a?.daily?.sunrise?.[0]), s = Rr(a?.daily?.sunset?.[0]);
|
|
4226
|
+
return o == null || s == null ? null : {
|
|
4227
|
+
sunrise: o,
|
|
4228
|
+
sunset: s
|
|
4229
|
+
};
|
|
4230
|
+
}, Ur = (e) => {
|
|
4231
|
+
let t = Lr(e), r = t ? e.latitude : null, i = t ? e.longitude : null, a = `${r},${i}`, [o, c] = s(null), [l, u] = s(a);
|
|
4232
|
+
return l !== a && (u(a), c(null)), n(() => {
|
|
4233
|
+
if (r == null || i == null) return;
|
|
4234
|
+
let e = !1, t = new AbortController();
|
|
4235
|
+
return Hr(r, i, t.signal).then((t) => {
|
|
4236
|
+
e || c(t);
|
|
4237
|
+
}).catch(() => {
|
|
4238
|
+
e || c(null);
|
|
4239
|
+
}), () => {
|
|
4240
|
+
e = !0, t.abort();
|
|
4241
|
+
};
|
|
4242
|
+
}, [r, i]), t ? o : null;
|
|
4243
|
+
}, Wr = 3, Gr = (e) => Math.min(12, Math.max(0, Math.round(e))), Kr = (e) => Math.max(0, Gr(e) - 2), qr = .55, Jr = [
|
|
4244
|
+
0,
|
|
4245
|
+
3,
|
|
4246
|
+
8,
|
|
4247
|
+
16,
|
|
4248
|
+
24,
|
|
4249
|
+
33,
|
|
4250
|
+
44,
|
|
4251
|
+
55,
|
|
4252
|
+
68,
|
|
4253
|
+
81,
|
|
4254
|
+
95,
|
|
4255
|
+
110,
|
|
4256
|
+
125
|
|
4257
|
+
], Yr = [
|
|
4258
|
+
1,
|
|
4259
|
+
5,
|
|
4260
|
+
11,
|
|
4261
|
+
19,
|
|
4262
|
+
28,
|
|
4263
|
+
38,
|
|
4264
|
+
49,
|
|
4265
|
+
61,
|
|
4266
|
+
74,
|
|
4267
|
+
88,
|
|
4268
|
+
102,
|
|
4269
|
+
117,
|
|
4270
|
+
Infinity
|
|
4271
|
+
], Xr = (e, t, n = 0, r = 0) => {
|
|
4272
|
+
let i = t.gustiness, a = t.wander, o = n * .0017 + r * .0024, s = e * qr, c = Math.sin(s * .007 + o), l = Math.sin(s * .021 + 1.37 + o * 1.4), u = Math.sin(s * .055 + 2.8 + o * .6), d = 1 + (.5 * c + .35 * l + .15 * u) * (.25 + i * .75), f = Math.sin(s * .012 + o * .8);
|
|
4273
|
+
f > .72 && (d += (f - .72) * (.8 + i * 2.4)), Math.sin(s * .0095 + .6 + o) < -.55 && (d *= .45 + i * .2), d = Math.max(.12, Math.min(2.25, d));
|
|
4274
|
+
let p = a * (.55 * Math.sin(s * .0088 + o) + .3 * Math.sin(s * .026 + 1.9 + o * 1.1) + .15 * Math.sin(s * .063 + .4));
|
|
4275
|
+
return {
|
|
4276
|
+
intensity: d,
|
|
4277
|
+
angle: p,
|
|
4278
|
+
ux: Math.cos(p),
|
|
4279
|
+
uy: Math.sin(p)
|
|
4280
|
+
};
|
|
4281
|
+
}, Zr = (e) => {
|
|
4282
|
+
let t = Gr(e);
|
|
4283
|
+
if (t <= 0) return {
|
|
4284
|
+
count: 0,
|
|
4285
|
+
alphaMul: 0
|
|
4286
|
+
};
|
|
4287
|
+
let n = Math.min(1, (t / 9) ** 1.15);
|
|
4288
|
+
return {
|
|
4289
|
+
count: Math.floor(3 + n * n * 50),
|
|
4290
|
+
alphaMul: .1 + n * .9
|
|
4291
|
+
};
|
|
4292
|
+
}, Qr = (e) => Jr[Gr(e)] ?? 16, $r = (e) => {
|
|
4293
|
+
let t = Math.max(0, e);
|
|
4294
|
+
for (let e = 0; e < Yr.length; e++) if (t <= Yr[e]) return e;
|
|
4295
|
+
return 12;
|
|
4296
|
+
}, ei = (e) => {
|
|
4297
|
+
let t = $r(e), n = Kr(t), r = Qr(n), i = Math.max(.04, Math.min(r / 16, 4.2)), { alphaMul: a } = Zr(n), o = i ** .82, s = Math.min(1, (n / 8) ** 1.1), c = (.04 + s * .32) * Math.PI;
|
|
4298
|
+
return {
|
|
4299
|
+
speedKmh: e,
|
|
4300
|
+
level: t,
|
|
4301
|
+
visualLevel: n,
|
|
4302
|
+
scale: i,
|
|
4303
|
+
cloud: .28 + i * .72,
|
|
4304
|
+
rain: o,
|
|
4305
|
+
snowDrift: -(.04 + o * .28),
|
|
4306
|
+
hail: .4 + o * .85,
|
|
4307
|
+
fog: .32 + o * .58,
|
|
4308
|
+
streak: .55 + o * .95,
|
|
4309
|
+
streakVisibility: a,
|
|
4310
|
+
gustiness: s,
|
|
4311
|
+
wander: c
|
|
4312
|
+
};
|
|
4313
|
+
}, ti = (e) => e.live && e.liveWindKmh != null && Number.isFinite(e.liveWindKmh) ? Math.max(0, e.liveWindKmh) : Qr(e.windLevel);
|
|
3933
4314
|
//#endregion
|
|
3934
4315
|
//#region src/components/weatherBackground/scene/draw-atmosphere.ts
|
|
3935
|
-
function
|
|
3936
|
-
let t = e.
|
|
3937
|
-
for (let
|
|
4316
|
+
function ni(e) {
|
|
4317
|
+
let t = e.windMotion.cloud, { intensity: n, angle: r, uy: i } = e.windField, a = -Math.cos(r);
|
|
4318
|
+
for (let r of e.state.clouds) {
|
|
4319
|
+
let o = Math.abs(r.speed) * t * n;
|
|
4320
|
+
r.x += o * a, r.y += o * i * .12, r.y < -80 && (r.y = -80), r.y > e.height * .55 && (r.y = e.height * .55), r.x - 140 * r.scale > e.width && (r.x = -160 * r.scale), r.x + 180 * r.scale < 0 && (r.x = e.width + 40 * r.scale), e.ctx.drawImage(r.sprite, r.x + r.ox, r.y + r.oy);
|
|
4321
|
+
}
|
|
3938
4322
|
}
|
|
3939
|
-
function
|
|
4323
|
+
function ri(e) {
|
|
3940
4324
|
let t = e.fogSprite;
|
|
3941
4325
|
if (!t || e.state.fogBanks.length === 0) return;
|
|
3942
|
-
let { canvas: n, baseR: r } = t;
|
|
3943
|
-
for (let t of e.state.fogBanks)
|
|
4326
|
+
let { canvas: n, baseR: r } = t, i = e.windMotion.fog, { intensity: a, angle: o, uy: s } = e.windField, c = -Math.cos(o);
|
|
4327
|
+
for (let t of e.state.fogBanks) {
|
|
4328
|
+
let o = Math.abs(t.speed) * i * a;
|
|
4329
|
+
t.x += o * c, t.y += o * s * .1, t.y < e.height * .02 && (t.y = e.height * .02), t.y > e.height * .95 && (t.y = e.height * .95), c < 0 && t.x + t.rw < 0 && (t.x = e.width + t.rw), c > 0 && t.x - t.rw > e.width && (t.x = -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();
|
|
4330
|
+
}
|
|
3944
4331
|
}
|
|
3945
|
-
function
|
|
4332
|
+
function ii(e) {
|
|
3946
4333
|
if (e.cfg.haze <= 0) return;
|
|
3947
4334
|
let t = e.activeWeather === "smog" ? "177, 164, 135" : "220, 226, 232";
|
|
3948
4335
|
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);
|
|
3949
4336
|
}
|
|
3950
4337
|
//#endregion
|
|
3951
4338
|
//#region src/components/weatherBackground/lightning.ts
|
|
3952
|
-
function
|
|
4339
|
+
function ai(e, t, n, r, i, a) {
|
|
3953
4340
|
if (a <= 0) return [[e, t], [n, r]];
|
|
3954
|
-
let o = (e + n) / 2 + (Math.random() - .5) * i, s = (t + r) / 2, c =
|
|
4341
|
+
let o = (e + n) / 2 + (Math.random() - .5) * i, s = (t + r) / 2, c = ai(e, t, o, s, i * .55, a - 1), l = ai(o, s, n, r, i * .55, a - 1);
|
|
3955
4342
|
return [...c.slice(0, -1), ...l];
|
|
3956
4343
|
}
|
|
3957
4344
|
//#endregion
|
|
3958
4345
|
//#region src/components/weatherBackground/scene/draw-effects.ts
|
|
3959
|
-
function
|
|
3960
|
-
if (e.state.windStreaks.length
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
4346
|
+
function oi(e) {
|
|
4347
|
+
if (e.state.windStreaks.length === 0) return;
|
|
4348
|
+
let t = e.windMotion.streak, n = e.windMotion.streakVisibility;
|
|
4349
|
+
if (n <= .02) return;
|
|
4350
|
+
let r = e.state.t;
|
|
4351
|
+
for (let i of e.state.windStreaks) {
|
|
4352
|
+
let a = Xr(r + i.phase * 18, e.windMotion, i.x, i.y), o = a.intensity * (.55 + .45 * e.windField.intensity), s = a.angle * .65 + e.windField.angle * .35, c = -1 * Math.cos(s), l = Math.sin(s), u = i.speed * t * o;
|
|
4353
|
+
i.x += u * c, i.y += u * l * .45, i.wave += .03 + o * .025, (i.x < -i.length - 40 || i.x > e.width + i.length + 40) && (i.x = c < 0 ? e.width + i.length + Math.random() * e.width * .25 : -i.length - Math.random() * e.width * .25, i.y = Math.random() * e.height), i.y < -20 && (i.y = e.height + 10), i.y > e.height + 20 && (i.y = -10);
|
|
4354
|
+
let d = 5 + o * 5, f = Math.sin(i.wave) * d, p = i.length * (.85 + o * .2), m = i.x + c * p, h = i.y + l * p * .45, g = i.alpha * n * Math.min(1.35, .55 + o * .55);
|
|
4355
|
+
if (e.ctx.beginPath(), e.ctx.moveTo(i.x, i.y), e.ctx.bezierCurveTo(i.x + c * p * .3, i.y + l * p * .3 * .45 + f, i.x + c * p * .7, i.y + l * p * .7 * .45 - f, m, h), e.ctx.strokeStyle = `rgba(235, 244, 250, ${g})`, e.ctx.lineWidth = i.width * (.85 + o * .2), e.ctx.lineCap = "round", e.ctx.stroke(), i.length > 70 && n > .45 && o > .7) {
|
|
4356
|
+
let t = i.x + c * p * .58, n = i.y + l * p * .58 * .45 - f * .4;
|
|
4357
|
+
e.ctx.save(), e.ctx.translate(t, n), e.ctx.rotate(s + i.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, ${g * 1.4})`, e.ctx.fill(), e.ctx.restore();
|
|
3966
4358
|
}
|
|
3967
4359
|
}
|
|
3968
4360
|
}
|
|
3969
|
-
function
|
|
4361
|
+
function si(e) {
|
|
3970
4362
|
if (e.cfg.lightning) {
|
|
3971
4363
|
if (e.state.t >= e.state.nextStrike) {
|
|
3972
4364
|
e.state.nextStrike = e.state.t + 150 + Math.random() * 300, e.state.flashAlpha = .5, e.state.boltLife = 9;
|
|
3973
4365
|
let t = e.width * (.15 + Math.random() * .7);
|
|
3974
|
-
e.state.boltPoints =
|
|
4366
|
+
e.state.boltPoints = ai(t, e.height * .12, t + (Math.random() - .5) * e.width * .2, e.height * .92, 60, 6);
|
|
3975
4367
|
}
|
|
3976
4368
|
if (e.state.boltLife > 0) {
|
|
3977
4369
|
--e.state.boltLife;
|
|
@@ -3983,7 +4375,7 @@ function An(e) {
|
|
|
3983
4375
|
}
|
|
3984
4376
|
//#endregion
|
|
3985
4377
|
//#region src/components/weatherBackground/sprites/hail.ts
|
|
3986
|
-
var
|
|
4378
|
+
var ci = 3.2, li = (e) => {
|
|
3987
4379
|
let t = Math.ceil(e * 2.8 + 4), n = document.createElement("canvas");
|
|
3988
4380
|
n.width = t, n.height = t;
|
|
3989
4381
|
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) => {
|
|
@@ -4016,10 +4408,11 @@ var jn = 3.2, Mn = (e) => {
|
|
|
4016
4408
|
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();
|
|
4017
4409
|
}
|
|
4018
4410
|
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;
|
|
4019
|
-
},
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4411
|
+
}, ui = (e = 16) => Array.from({ length: e }, () => li(ci)), di = (e) => e[Math.floor(Math.random() * e.length)], fi = (e, t, n, r, i = !0, a, o = 1) => {
|
|
4412
|
+
let s = a?.min ?? 1.4, c = a?.max ?? 4.8;
|
|
4413
|
+
e.r = s + Math.random() ** 1.35 * (c - s), 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) * o, e.vy = (5.5 + Math.random() * 11) * o, e.bounces = 0, e.opacity = .45 + Math.random() * .55, e.delay = Math.floor(Math.random() * (i ? 110 : 45)), e.gravity = (.11 + Math.random() * .14) * (.9 + o * .1), e.phase = Math.random() * Math.PI * 2, e.gust = (Math.random() - .5) * 1.4, e.maxBounces = +(Math.random() < .62), e.sprite = di(r), e.drawSize = e.r * 2.8 + 4, e.rotation = Math.random() * Math.PI * 2, e.rotationSpeed = (Math.random() - .5) * .06;
|
|
4414
|
+
}, pi = (e, t, n, r, i = 1) => {
|
|
4415
|
+
let a = {
|
|
4023
4416
|
x: 0,
|
|
4024
4417
|
y: 0,
|
|
4025
4418
|
r: 2,
|
|
@@ -4037,21 +4430,21 @@ var jn = 3.2, Mn = (e) => {
|
|
|
4037
4430
|
rotation: 0,
|
|
4038
4431
|
rotationSpeed: 0
|
|
4039
4432
|
};
|
|
4040
|
-
return
|
|
4433
|
+
return fi(a, e, t, n, Math.random() < .72, r, i), a;
|
|
4041
4434
|
};
|
|
4042
4435
|
//#endregion
|
|
4043
4436
|
//#region src/components/weatherBackground/scene/draw-precipitation.ts
|
|
4044
|
-
function
|
|
4437
|
+
function mi(e) {
|
|
4045
4438
|
if (!e.cfg.rain) return;
|
|
4046
|
-
let {
|
|
4047
|
-
e.ctx.strokeStyle = `rgba(214, 228, 240, ${
|
|
4048
|
-
for (let
|
|
4049
|
-
let i = Math.hypot(
|
|
4050
|
-
e.ctx.moveTo(
|
|
4051
|
-
x:
|
|
4439
|
+
let { alpha: t, splash: n } = e.cfg.rain, r = e.cfg.rain.wind * e.windMotion.rain, { intensity: i, angle: a, uy: o } = e.windField, s = r * i * Math.cos(a), c = Math.abs(r) * i * o * .35;
|
|
4440
|
+
e.ctx.strokeStyle = `rgba(214, 228, 240, ${t})`, e.ctx.lineWidth = 1.2, e.ctx.beginPath();
|
|
4441
|
+
for (let t of e.state.drops) {
|
|
4442
|
+
let r = t.speed + c, i = Math.hypot(s, r) || 1, a = s / i, o = r / i;
|
|
4443
|
+
e.ctx.moveTo(t.x, t.y), e.ctx.lineTo(t.x + a * t.len, t.y + o * t.len), t.x += s, t.y += r, t.y > e.height && (n && Math.random() < .3 && e.state.splashes.length < 60 && e.state.splashes.push({
|
|
4444
|
+
x: t.x,
|
|
4052
4445
|
r: 1,
|
|
4053
4446
|
alpha: .5
|
|
4054
|
-
}),
|
|
4447
|
+
}), t.y = -t.len, t.x = Math.random() * (e.width + 160) - 80);
|
|
4055
4448
|
}
|
|
4056
4449
|
e.ctx.stroke();
|
|
4057
4450
|
for (let t = e.state.splashes.length - 1; t >= 0; t--) {
|
|
@@ -4063,58 +4456,71 @@ function Ln(e) {
|
|
|
4063
4456
|
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();
|
|
4064
4457
|
}
|
|
4065
4458
|
}
|
|
4066
|
-
function
|
|
4459
|
+
function hi(e) {
|
|
4460
|
+
let t = e.windMotion.snowDrift, { intensity: n, angle: r, uy: i } = e.windField, a = t * n * Math.cos(r), o = Math.abs(t) * n * i * .4;
|
|
4067
4461
|
for (let t of e.state.flakes) {
|
|
4068
|
-
t.y += t.speed, t.x += Math.sin(e.state.t * .02 + t.phase) * (.3 + t.size * .08) + t.drift, t.rotation += t.rotationSpeed, t.y - t.drawSize > e.height && (t.y = -t.drawSize, t.x = Math.random() * e.width, t.phase = Math.random() * Math.PI * 2, t.drift = (Math.random() - .5) * .4, t.opacity = .55 + Math.random() * .45), t.x > e.width + 20 && (t.x = -20), t.x < -20 && (t.x = e.width + 20);
|
|
4462
|
+
t.y += t.speed + o, t.x += Math.sin(e.state.t * .02 + t.phase) * (.3 + t.size * .08) + t.drift + a, 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);
|
|
4069
4463
|
let n = t.drawSize / 2;
|
|
4070
4464
|
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();
|
|
4071
4465
|
}
|
|
4072
4466
|
}
|
|
4073
|
-
function
|
|
4467
|
+
function gi(e) {
|
|
4074
4468
|
if (e.state.hailstones.length === 0) return;
|
|
4075
|
-
let t = e.state.hailPool;
|
|
4076
|
-
for (let
|
|
4077
|
-
if (
|
|
4078
|
-
--
|
|
4469
|
+
let t = e.state.hailPool, n = e.windMotion.hail, r = e.state.t, i = e.windField;
|
|
4470
|
+
for (let a of e.state.hailstones) {
|
|
4471
|
+
if (a.delay > 0) {
|
|
4472
|
+
--a.delay;
|
|
4079
4473
|
continue;
|
|
4080
4474
|
}
|
|
4081
|
-
let
|
|
4082
|
-
if (
|
|
4475
|
+
let o = Xr(r + a.phase * 12, e.windMotion, a.x, a.y), s = o.intensity * (.4 + .6 * i.intensity), c = o.angle * .5 + i.angle * .5, l = e.windMotion.snowDrift * .45 * s * Math.cos(c), u = Math.abs(e.windMotion.snowDrift) * s * Math.sin(c) * .2, d = a.x, f = a.y;
|
|
4476
|
+
if (a.vy += a.gravity + u * .02, a.vx += a.gust * .004 * n * s + l + (Math.random() - .5) * .08 * n * s, a.x += a.vx + Math.sin(r * .028 + a.phase) * .35, a.y += a.vy, e.ctx.beginPath(), e.ctx.moveTo(d, f), e.ctx.lineTo(a.x, a.y), e.ctx.strokeStyle = `rgba(225, 239, 250, ${a.opacity * .18})`, e.ctx.lineWidth = a.r * .35, e.ctx.stroke(), a.y + a.r >= e.height) if (a.bounces < a.maxBounces) a.y = e.height - a.r, a.vy *= -(.22 + Math.random() * .28), a.vx = a.vx * (.55 + Math.random() * .25) + (Math.random() - .5) * 1.6, a.bounces += 1;
|
|
4083
4477
|
else {
|
|
4084
|
-
|
|
4478
|
+
fi(a, e.width, e.height, t, !0, e.hailSpec ? {
|
|
4479
|
+
min: e.hailSpec.sizeMin,
|
|
4480
|
+
max: e.hailSpec.sizeMax
|
|
4481
|
+
} : void 0, e.hailSpec?.speedMul ?? 1);
|
|
4085
4482
|
continue;
|
|
4086
4483
|
}
|
|
4087
|
-
let
|
|
4088
|
-
|
|
4484
|
+
let p = a.drawSize / 2;
|
|
4485
|
+
a.rotation += a.rotationSpeed, e.ctx.save(), e.ctx.globalAlpha = a.opacity, e.ctx.translate(a.x, a.y), e.ctx.rotate(a.rotation), e.ctx.drawImage(a.sprite, -p, -p, a.drawSize, a.drawSize), e.ctx.restore();
|
|
4089
4486
|
}
|
|
4090
4487
|
}
|
|
4091
4488
|
//#endregion
|
|
4092
4489
|
//#region src/components/weatherBackground/scene/draw-sky.ts
|
|
4093
|
-
function
|
|
4490
|
+
function _i(e) {
|
|
4094
4491
|
e.ctx.fillStyle = e.skyGradient, e.ctx.fillRect(0, 0, e.width, e.height);
|
|
4095
4492
|
}
|
|
4096
|
-
function
|
|
4097
|
-
if (e.state.stars.length
|
|
4098
|
-
|
|
4099
|
-
|
|
4493
|
+
function vi(e) {
|
|
4494
|
+
if (e.state.stars.length === 0) return;
|
|
4495
|
+
let t = 1;
|
|
4496
|
+
if (e.dayCycle) {
|
|
4497
|
+
if (e.dayCycle.isDay) return;
|
|
4498
|
+
t = .35 + (1 - e.dayCycle.twilight) * .65;
|
|
4499
|
+
} else if (!e.activeNight) return;
|
|
4500
|
+
for (let n of e.state.stars) {
|
|
4501
|
+
let r = .35 + (Math.sin(e.state.t * n.speed + n.phase) + 1) * .325;
|
|
4502
|
+
e.ctx.beginPath(), e.ctx.arc(n.x, n.y, n.r, 0, Math.PI * 2), e.ctx.fillStyle = `rgba(226, 235, 255, ${r * t})`, e.ctx.fill();
|
|
4100
4503
|
}
|
|
4101
4504
|
}
|
|
4102
|
-
function
|
|
4505
|
+
function yi(e) {
|
|
4103
4506
|
let t = e.celestial;
|
|
4104
4507
|
if (!t) return;
|
|
4105
|
-
let { ctx: n, sunX: r, sunY: i, state: a } = e, o = 1 + Math.sin(a.t * t.breathSpeed) * t.breathAmp, s =
|
|
4106
|
-
|
|
4508
|
+
let { ctx: n, sunX: r, sunY: i, state: a } = e, o = 1 + Math.sin(a.t * t.breathSpeed) * t.breathAmp, s = e.dayCycle ? In(e.dayCycle) : {
|
|
4509
|
+
scale: 1,
|
|
4510
|
+
alpha: 1
|
|
4511
|
+
}, c = t.half * o * s.scale, l = c * 2;
|
|
4512
|
+
n.save(), n.globalAlpha = s.alpha, n.drawImage(t.canvas, r - c, i - c, l, l), n.restore();
|
|
4107
4513
|
}
|
|
4108
|
-
function
|
|
4514
|
+
function bi(e) {
|
|
4109
4515
|
if (e.activeNight) {
|
|
4110
|
-
|
|
4516
|
+
vi(e), yi(e);
|
|
4111
4517
|
return;
|
|
4112
4518
|
}
|
|
4113
|
-
|
|
4519
|
+
yi(e);
|
|
4114
4520
|
}
|
|
4115
4521
|
//#endregion
|
|
4116
4522
|
//#region src/components/weatherBackground/configs.ts
|
|
4117
|
-
var
|
|
4523
|
+
var xi = {
|
|
4118
4524
|
sunny: {
|
|
4119
4525
|
sky: ["#4a9fe0", "#c8e8fb"],
|
|
4120
4526
|
sun: "full",
|
|
@@ -4166,6 +4572,29 @@ var Wn = {
|
|
|
4166
4572
|
snowCount: 0,
|
|
4167
4573
|
lightning: !1
|
|
4168
4574
|
},
|
|
4575
|
+
rain: {
|
|
4576
|
+
sky: ["#55637a", "#7e8ba0"],
|
|
4577
|
+
sun: "none",
|
|
4578
|
+
cloudCount: 8,
|
|
4579
|
+
cloudColor: [
|
|
4580
|
+
51,
|
|
4581
|
+
65,
|
|
4582
|
+
85
|
|
4583
|
+
],
|
|
4584
|
+
cloudAlpha: .65,
|
|
4585
|
+
cloudSpread: .26,
|
|
4586
|
+
rain: {
|
|
4587
|
+
count: 150,
|
|
4588
|
+
speed: 10,
|
|
4589
|
+
wind: -1.5,
|
|
4590
|
+
alpha: .5,
|
|
4591
|
+
splash: !0
|
|
4592
|
+
},
|
|
4593
|
+
fogBanks: 0,
|
|
4594
|
+
haze: .06,
|
|
4595
|
+
snowCount: 0,
|
|
4596
|
+
lightning: !1
|
|
4597
|
+
},
|
|
4169
4598
|
lightRain: {
|
|
4170
4599
|
sky: ["#6b7a8f", "#9aa7b8"],
|
|
4171
4600
|
sun: "none",
|
|
@@ -4423,9 +4852,7 @@ var Wn = {
|
|
|
4423
4852
|
snowCount: 160,
|
|
4424
4853
|
lightning: !1
|
|
4425
4854
|
}
|
|
4426
|
-
}
|
|
4427
|
-
Wn.snow = Wn.moderateSnow;
|
|
4428
|
-
var Gn = {
|
|
4855
|
+
}, Si = {
|
|
4429
4856
|
sunny: {
|
|
4430
4857
|
sky: ["#0b1a33", "#27476e"],
|
|
4431
4858
|
stars: 110
|
|
@@ -4438,6 +4865,10 @@ var Gn = {
|
|
|
4438
4865
|
sky: ["#181f2a", "#333e4e"],
|
|
4439
4866
|
stars: 0
|
|
4440
4867
|
},
|
|
4868
|
+
rain: {
|
|
4869
|
+
sky: ["#11161f", "#242c3a"],
|
|
4870
|
+
stars: 0
|
|
4871
|
+
},
|
|
4441
4872
|
lightRain: {
|
|
4442
4873
|
sky: ["#151b26", "#2b3442"],
|
|
4443
4874
|
stars: 0
|
|
@@ -4458,6 +4889,10 @@ var Gn = {
|
|
|
4458
4889
|
sky: ["#1c222b", "#3a434e"],
|
|
4459
4890
|
stars: 0
|
|
4460
4891
|
},
|
|
4892
|
+
snow: {
|
|
4893
|
+
sky: ["#131a26", "#333f4f"],
|
|
4894
|
+
stars: 8
|
|
4895
|
+
},
|
|
4461
4896
|
lightSnow: {
|
|
4462
4897
|
sky: ["#161e2b", "#3a4656"],
|
|
4463
4898
|
stars: 20
|
|
@@ -4485,21 +4920,15 @@ var Gn = {
|
|
|
4485
4920
|
gale: {
|
|
4486
4921
|
sky: ["#101a26", "#2e3d4d"],
|
|
4487
4922
|
stars: 30
|
|
4488
|
-
},
|
|
4489
|
-
snow: {
|
|
4490
|
-
sky: ["#131a26", "#333f4f"],
|
|
4491
|
-
stars: 8
|
|
4492
4923
|
}
|
|
4493
|
-
}
|
|
4494
|
-
Gn.snow = Gn.moderateSnow;
|
|
4495
|
-
var Kn = ([e, t, n]) => [
|
|
4924
|
+
}, Ci = ([e, t, n]) => [
|
|
4496
4925
|
Math.round(e * .3 + 18),
|
|
4497
4926
|
Math.round(t * .3 + 24),
|
|
4498
4927
|
Math.round(n * .3 + 42)
|
|
4499
4928
|
];
|
|
4500
4929
|
//#endregion
|
|
4501
4930
|
//#region src/components/weatherBackground/sprites/cloud.ts
|
|
4502
|
-
function
|
|
4931
|
+
function wi(e, t, n, r) {
|
|
4503
4932
|
let [i, a, o] = n, s = Infinity, c = Infinity, l = -Infinity, u = -Infinity;
|
|
4504
4933
|
for (let n of t) {
|
|
4505
4934
|
let t = n.dx * e, r = n.dy * e, i = n.r * e;
|
|
@@ -4518,12 +4947,12 @@ function qn(e, t, n, r) {
|
|
|
4518
4947
|
oy: f
|
|
4519
4948
|
};
|
|
4520
4949
|
}
|
|
4521
|
-
function
|
|
4950
|
+
function Ti(e, t, n, r, i) {
|
|
4522
4951
|
let a = .7 + Math.random() * .9, o = 4 + Math.floor(Math.random() * 3), s = Array.from({ length: o }, (e, t) => ({
|
|
4523
4952
|
dx: (t - o / 2) * 26 + (Math.random() - .5) * 14,
|
|
4524
4953
|
dy: (Math.random() - .5) * 14,
|
|
4525
4954
|
r: 22 + Math.random() * 20
|
|
4526
|
-
})), { sprite: c, ox: l, oy: u } =
|
|
4955
|
+
})), { sprite: c, ox: l, oy: u } = wi(a, s, r, i);
|
|
4527
4956
|
return {
|
|
4528
4957
|
x: Math.random() * (e + 240) - 120,
|
|
4529
4958
|
y: t * .06 + Math.random() * t * n,
|
|
@@ -4535,7 +4964,7 @@ function Jn(e, t, n, r, i) {
|
|
|
4535
4964
|
oy: u
|
|
4536
4965
|
};
|
|
4537
4966
|
}
|
|
4538
|
-
function
|
|
4967
|
+
function Ei(e, t = 120) {
|
|
4539
4968
|
let n = t * 2, r = document.createElement("canvas");
|
|
4540
4969
|
r.width = n, r.height = n;
|
|
4541
4970
|
let i = r.getContext("2d"), a = i.createRadialGradient(t, t, 0, t, t, t);
|
|
@@ -4546,7 +4975,7 @@ function Yn(e, t = 120) {
|
|
|
4546
4975
|
}
|
|
4547
4976
|
//#endregion
|
|
4548
4977
|
//#region src/components/weatherBackground/sprites/celestial.ts
|
|
4549
|
-
function
|
|
4978
|
+
function Di(e, t) {
|
|
4550
4979
|
let n = e.sun;
|
|
4551
4980
|
if (n === "none") return null;
|
|
4552
4981
|
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;
|
|
@@ -4574,7 +5003,7 @@ function Xn(e, t) {
|
|
|
4574
5003
|
breathAmp: .018
|
|
4575
5004
|
};
|
|
4576
5005
|
}
|
|
4577
|
-
function
|
|
5006
|
+
function Oi(e, t, n) {
|
|
4578
5007
|
if (e.sun === "none") return null;
|
|
4579
5008
|
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");
|
|
4580
5009
|
l.width = c, l.height = c;
|
|
@@ -4628,12 +5057,12 @@ function Zn(e, t, n) {
|
|
|
4628
5057
|
}
|
|
4629
5058
|
//#endregion
|
|
4630
5059
|
//#region src/components/weatherBackground/sprites/snow.ts
|
|
4631
|
-
var
|
|
5060
|
+
var ki = (e) => {
|
|
4632
5061
|
let t = Math.ceil(e * 2 + 4), n = document.createElement("canvas");
|
|
4633
5062
|
n.width = t, n.height = t;
|
|
4634
5063
|
let r = n.getContext("2d"), i = r.createRadialGradient(t / 2, t / 2, 0, t / 2, t / 2, e + 1);
|
|
4635
5064
|
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;
|
|
4636
|
-
},
|
|
5065
|
+
}, Ai = (e) => {
|
|
4637
5066
|
let t = Math.ceil(e * 2 + 6), n = document.createElement("canvas");
|
|
4638
5067
|
n.width = t, n.height = t;
|
|
4639
5068
|
let r = n.getContext("2d");
|
|
@@ -4660,22 +5089,22 @@ var Qn = (e) => {
|
|
|
4660
5089
|
r.closePath(), r.stroke();
|
|
4661
5090
|
}
|
|
4662
5091
|
return n;
|
|
4663
|
-
},
|
|
5092
|
+
}, ji = () => ({
|
|
4664
5093
|
dots: [
|
|
4665
5094
|
1.2,
|
|
4666
5095
|
1.6,
|
|
4667
5096
|
2,
|
|
4668
5097
|
2.3
|
|
4669
|
-
].map((e) =>
|
|
5098
|
+
].map((e) => ki(e)),
|
|
4670
5099
|
crystals: [
|
|
4671
5100
|
2.6,
|
|
4672
5101
|
3.2,
|
|
4673
5102
|
3.8,
|
|
4674
5103
|
4.4,
|
|
4675
5104
|
5
|
|
4676
|
-
].map((e) =>
|
|
4677
|
-
}),
|
|
4678
|
-
let i = 1 + Math.random() ** 1.6 * 4.2, a = i >= 2.4, o =
|
|
5105
|
+
].map((e) => Ai(e * 2.4))
|
|
5106
|
+
}), Mi = (e) => e[Math.floor(Math.random() * e.length)], Ni = (e, t, n, r) => {
|
|
5107
|
+
let i = 1 + Math.random() ** 1.6 * 4.2, a = i >= 2.4, o = Mi(a ? n.crystals : n.dots), s = a ? i * 4.8 + 6 : i * 2 + 4;
|
|
4679
5108
|
return {
|
|
4680
5109
|
x: Math.random() * e,
|
|
4681
5110
|
y: r ?? Math.random() * t,
|
|
@@ -4689,17 +5118,25 @@ var Qn = (e) => {
|
|
|
4689
5118
|
sprite: o,
|
|
4690
5119
|
drawSize: s
|
|
4691
5120
|
};
|
|
4692
|
-
},
|
|
4693
|
-
function
|
|
4694
|
-
let { ctx: t, width: n, height: r, activeWeather: i,
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
5121
|
+
}, Pi = (e, t) => t ? e === "smog" ? "96, 88, 66" : "138, 150, 168" : e === "smog" ? "168, 155, 126" : "226, 232, 238";
|
|
5122
|
+
function Fi(e) {
|
|
5123
|
+
let { ctx: t, width: n, height: r, activeWeather: i, dayCycleTimes: a = null, sceneTimeMs: o, liveClock: s = !1, windMotion: c, rainLevel: l = 5, snowLevel: u = 5, hailLevel: d = 2, fogLevel: f = 2, smogLevel: p = 2 } = e, m = xi[i], h = (() => {
|
|
5124
|
+
let e = m;
|
|
5125
|
+
return mr(i) && e.rain && (e = {
|
|
5126
|
+
...e,
|
|
5127
|
+
rain: br(e.rain, l)
|
|
5128
|
+
}), hr(i) && (e = {
|
|
5129
|
+
...e,
|
|
5130
|
+
snowCount: xr(u),
|
|
5131
|
+
fogBanks: u >= 7 ? Math.max(e.fogBanks, 3) : e.fogBanks,
|
|
5132
|
+
haze: u >= 7 ? Math.max(e.haze, .12) : e.haze
|
|
5133
|
+
}), Vn(i) && (e = Hn(e, f)), Or(i) && (e = kr(e, p)), e;
|
|
5134
|
+
})(), g = Si[i], _ = a ?? null, v = _ ? On(s ? Date.now() : o, _) : null, y = v ? !v.isDay : !1, b = v ? Pn(h.sky, g.sky, v) : y ? g.sky : h.sky, x = y ? Ci(h.cloudColor) : h.cloudColor, S = Math.min(n, r) * .09, C = n * .72, w = r * .26;
|
|
5135
|
+
if (v) {
|
|
5136
|
+
let e = kn(n, r, v.arcProgress);
|
|
5137
|
+
C = e.x, w = e.y;
|
|
5138
|
+
}
|
|
5139
|
+
let T = Fn(t, r, b), E = [
|
|
4703
5140
|
{
|
|
4704
5141
|
dx: -.32,
|
|
4705
5142
|
dy: .08,
|
|
@@ -4720,158 +5157,215 @@ function ir(e) {
|
|
|
4720
5157
|
dy: .24,
|
|
4721
5158
|
r: .07
|
|
4722
5159
|
}
|
|
4723
|
-
],
|
|
5160
|
+
], D = Di(h, S), O = Oi(h, S, E), k = y ? O : D, A = y || _ != null ? Array.from({ length: g.stars }, () => ({
|
|
5161
|
+
x: Math.random() * n,
|
|
5162
|
+
y: Math.random() * r * .72,
|
|
5163
|
+
r: .4 + Math.random() * 1.1,
|
|
5164
|
+
phase: Math.random() * Math.PI * 2,
|
|
5165
|
+
speed: .015 + Math.random() * .035
|
|
5166
|
+
})) : [], j = Array.from({ length: h.cloudCount }, () => Ti(n, r, h.cloudSpread, x, h.cloudAlpha)), M = h.rain ? Array.from({ length: h.rain.count }, () => ({
|
|
4724
5167
|
x: Math.random() * (n + 160) - 80,
|
|
4725
5168
|
y: Math.random() * r,
|
|
4726
5169
|
len: 8 + Math.random() * 10,
|
|
4727
|
-
speed:
|
|
4728
|
-
})) : [],
|
|
5170
|
+
speed: h.rain.speed * (.75 + Math.random() * .5)
|
|
5171
|
+
})) : [], N = [], P = Array.from({ length: h.fogBanks }, (e, t) => ({
|
|
4729
5172
|
x: Math.random() * n,
|
|
4730
|
-
y: t / Math.max(
|
|
5173
|
+
y: t / Math.max(h.fogBanks - 1, 1) * r * .9 + r * .05,
|
|
4731
5174
|
rw: n * (.25 + Math.random() * .3),
|
|
4732
5175
|
rh: r * (.08 + Math.random() * .08),
|
|
4733
5176
|
speed: (.1 + Math.random() * .25) * (t % 2 == 0 ? 1 : -1),
|
|
4734
|
-
alpha: .
|
|
4735
|
-
})),
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
5177
|
+
alpha: (.1 + Math.random() * .1) * (Vn(i) ? Un(f) : Or(i) ? Ar(p) : 1)
|
|
5178
|
+
})), F = h.fogBanks > 0 ? Ei(Pi(i, y)) : null, I = h.snowCount > 0 ? ji() : null, L = I == null ? [] : Array.from({ length: h.snowCount }, () => Ni(n, r, I)), R = Xn(i) ? Zn(d) : null, ee = R == null ? null : ui(), te = ee != null && R != null ? Array.from({ length: R.count }, () => pi(n, r, ee, {
|
|
5179
|
+
min: R.sizeMin,
|
|
5180
|
+
max: R.sizeMax
|
|
5181
|
+
}, R.speedMul)) : [], ne = (() => {
|
|
5182
|
+
let { count: e } = Zr(c.visualLevel);
|
|
5183
|
+
return e <= 0 ? [] : Array.from({ length: e }, () => ({
|
|
5184
|
+
x: Math.random() * n,
|
|
5185
|
+
y: Math.random() * r,
|
|
5186
|
+
length: 35 + Math.random() * 120,
|
|
5187
|
+
speed: 6 + Math.random() * 10,
|
|
5188
|
+
wave: Math.random() * Math.PI * 2,
|
|
5189
|
+
alpha: .1 + Math.random() * .28,
|
|
5190
|
+
width: .5 + Math.random() * 1.1,
|
|
5191
|
+
phase: Math.random() * Math.PI * 2
|
|
5192
|
+
}));
|
|
5193
|
+
})(), re = [], ie = 120 + Math.random() * 240;
|
|
4744
5194
|
return {
|
|
4745
|
-
sky:
|
|
4746
|
-
cloudRgb:
|
|
4747
|
-
cfg:
|
|
4748
|
-
sunX:
|
|
4749
|
-
sunY:
|
|
4750
|
-
sunR:
|
|
4751
|
-
skyGradient:
|
|
4752
|
-
celestial:
|
|
4753
|
-
|
|
5195
|
+
sky: b,
|
|
5196
|
+
cloudRgb: x,
|
|
5197
|
+
cfg: h,
|
|
5198
|
+
sunX: C,
|
|
5199
|
+
sunY: w,
|
|
5200
|
+
sunR: S,
|
|
5201
|
+
skyGradient: T,
|
|
5202
|
+
celestial: k,
|
|
5203
|
+
sunSprite: D,
|
|
5204
|
+
moonSprite: O,
|
|
5205
|
+
fogSprite: F,
|
|
5206
|
+
dayCycleTimes: _,
|
|
5207
|
+
dayCycle: v,
|
|
5208
|
+
sceneTimeMs: o,
|
|
5209
|
+
liveClock: s,
|
|
5210
|
+
hailSpec: R,
|
|
4754
5211
|
state: {
|
|
4755
|
-
stars:
|
|
4756
|
-
moonCraters:
|
|
4757
|
-
clouds:
|
|
4758
|
-
drops:
|
|
4759
|
-
splashes:
|
|
4760
|
-
fogBanks:
|
|
4761
|
-
flakes:
|
|
4762
|
-
hailstones:
|
|
4763
|
-
hailPool:
|
|
4764
|
-
windStreaks:
|
|
5212
|
+
stars: A,
|
|
5213
|
+
moonCraters: E,
|
|
5214
|
+
clouds: j,
|
|
5215
|
+
drops: M,
|
|
5216
|
+
splashes: N,
|
|
5217
|
+
fogBanks: P,
|
|
5218
|
+
flakes: L,
|
|
5219
|
+
hailstones: te,
|
|
5220
|
+
hailPool: ee ?? [],
|
|
5221
|
+
windStreaks: ne,
|
|
4765
5222
|
t: 0,
|
|
4766
5223
|
flashAlpha: 0,
|
|
4767
5224
|
boltLife: 0,
|
|
4768
|
-
boltPoints:
|
|
4769
|
-
nextStrike:
|
|
5225
|
+
boltPoints: re,
|
|
5226
|
+
nextStrike: ie
|
|
4770
5227
|
}
|
|
4771
5228
|
};
|
|
4772
5229
|
}
|
|
5230
|
+
function Ii(e, t) {
|
|
5231
|
+
if (!e.dayCycleTimes) return;
|
|
5232
|
+
let n = On(e.liveClock ? t ?? Date.now() : e.sceneTimeMs, e.dayCycleTimes), r = Si[e.activeWeather], i = Pn(e.cfg.sky, r.sky, n), a = kn(e.width, e.height, n.arcProgress);
|
|
5233
|
+
e.dayCycle = n, e.activeNight = !n.isDay, e.sky = i, e.skyGradient = Fn(e.ctx, e.height, i), e.sunX = a.x, e.sunY = a.y, e.celestial = n.isDay ? e.sunSprite : e.moonSprite;
|
|
5234
|
+
}
|
|
4773
5235
|
//#endregion
|
|
4774
5236
|
//#region src/components/weatherBackground/scene/create-weather-scene.ts
|
|
4775
|
-
function
|
|
4776
|
-
t && (e.state.t += 1),
|
|
5237
|
+
function Li(e, t) {
|
|
5238
|
+
t && (e.state.t += 1), e.windField = Xr(e.state.t, e.windMotion), e.dayCycleTimes && Ii(e, e.liveClock ? Date.now() : e.sceneTimeMs), _i(e), bi(e), ni(e), ri(e), ii(e), mi(e), hi(e), gi(e), oi(e), si(e);
|
|
4777
5239
|
}
|
|
4778
|
-
function
|
|
4779
|
-
let { ctx: t, width: n, height: r, activeWeather: i, activeNight: a } = e,
|
|
5240
|
+
function Ri(e) {
|
|
5241
|
+
let { ctx: t, width: n, height: r, activeWeather: i, activeNight: a, windMotion: o } = e, s = Fi(e), c = {
|
|
4780
5242
|
ctx: t,
|
|
4781
5243
|
width: n,
|
|
4782
5244
|
height: r,
|
|
4783
5245
|
activeWeather: i,
|
|
4784
|
-
activeNight: a,
|
|
4785
|
-
|
|
5246
|
+
activeNight: s.dayCycle ? !s.dayCycle.isDay : a,
|
|
5247
|
+
windMotion: o,
|
|
5248
|
+
windField: Xr(0, o),
|
|
5249
|
+
...s
|
|
4786
5250
|
};
|
|
4787
|
-
if (typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return
|
|
4788
|
-
let
|
|
4789
|
-
|
|
4790
|
-
}),
|
|
4791
|
-
|
|
5251
|
+
if (c.dayCycleTimes && Ii(c, c.liveClock ? Date.now() : c.sceneTimeMs), typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return Li(c, !1), () => void 0;
|
|
5252
|
+
let l = 0, u = document.hidden, d = v((e) => {
|
|
5253
|
+
u = e;
|
|
5254
|
+
}), f = () => {
|
|
5255
|
+
l = requestAnimationFrame(f), !u && Li(c, !0);
|
|
4792
5256
|
};
|
|
4793
|
-
return
|
|
4794
|
-
cancelAnimationFrame(
|
|
5257
|
+
return f(), () => {
|
|
5258
|
+
cancelAnimationFrame(l), d();
|
|
4795
5259
|
};
|
|
4796
5260
|
}
|
|
4797
|
-
var
|
|
5261
|
+
var zi = {
|
|
4798
5262
|
weatherBackground: "cos-weatherBackground-Mnm22",
|
|
4799
5263
|
canvas: "cos-canvas-nvqMt",
|
|
4800
5264
|
loadingOverlay: "cos-loadingOverlay-O58B7",
|
|
4801
5265
|
loadingSpinner: "cos-loadingSpinner-NQ9yG",
|
|
4802
5266
|
"weather-loading-spin": "cos-weather-loading-spin-IPFWZ"
|
|
4803
|
-
},
|
|
4804
|
-
let
|
|
4805
|
-
latitude:
|
|
4806
|
-
longitude:
|
|
4807
|
-
} : void 0),
|
|
5267
|
+
}, Bi = ({ width: e = 800, height: t = 450, weather: r = "partlyCloudy", time: i = "14:00", live: s = !1, latitude: c, longitude: d, windLevel: f = 3, rainLevel: p = 5, snowLevel: m = 5, hailLevel: h = 2, fogLevel: g = 2, smogLevel: _ = 2, onLiveWeather: v, loading: y = !1 }) => {
|
|
5268
|
+
let b = o(null), x = Vr(s, c != null && d != null ? {
|
|
5269
|
+
latitude: c,
|
|
5270
|
+
longitude: d
|
|
5271
|
+
} : void 0), S = dr(s && x.weather ? x.weather : r), C = s && x.rainLevel != null ? x.rainLevel : p, w = s && x.snowLevel != null ? x.snowLevel : m, T = s && x.fogLevel != null ? x.fogLevel : g, E = s && x.hailLevel != null ? x.hailLevel : h, D = s && x.smogLevel != null ? x.smogLevel : _, O = yr(S, C, w), k = Dn(i), A = x.current?.sunrise ?? null, j = x.current?.sunset ?? null, M = x.current?.windSpeed ?? null, N = a(() => s && A != null && j != null ? {
|
|
5272
|
+
sunrise: A,
|
|
5273
|
+
sunset: j
|
|
5274
|
+
} : Tn(k), [
|
|
5275
|
+
s,
|
|
5276
|
+
A,
|
|
5277
|
+
j,
|
|
5278
|
+
k
|
|
5279
|
+
]), P = ti({
|
|
5280
|
+
live: s,
|
|
5281
|
+
windLevel: f,
|
|
5282
|
+
liveWindKmh: M
|
|
5283
|
+
}), F = a(() => ei(P), [P]), I = s && x.current ? !x.current.isDay : !On(k, N).isDay, L = y || s && (x.status === "locating" || x.status === "fetching"), R = o(v);
|
|
4808
5284
|
return n(() => {
|
|
4809
|
-
|
|
5285
|
+
R.current = v;
|
|
4810
5286
|
}), n(() => {
|
|
4811
|
-
|
|
4812
|
-
}, [
|
|
4813
|
-
let n =
|
|
5287
|
+
x.weather && R.current?.(dr(x.weather));
|
|
5288
|
+
}, [x.weather]), n(() => {
|
|
5289
|
+
let n = b.current;
|
|
4814
5290
|
if (!n) return;
|
|
4815
5291
|
let r = window.devicePixelRatio || 1;
|
|
4816
5292
|
n.width = e * r, n.height = t * r;
|
|
4817
5293
|
let i = n.getContext("2d");
|
|
4818
|
-
if (i) return i.setTransform(r, 0, 0, r, 0, 0),
|
|
5294
|
+
if (i) return i.setTransform(r, 0, 0, r, 0, 0), Ri({
|
|
4819
5295
|
ctx: i,
|
|
4820
5296
|
width: e,
|
|
4821
5297
|
height: t,
|
|
4822
|
-
activeWeather:
|
|
4823
|
-
activeNight:
|
|
5298
|
+
activeWeather: O,
|
|
5299
|
+
activeNight: I,
|
|
5300
|
+
dayCycleTimes: N,
|
|
5301
|
+
sceneTimeMs: k,
|
|
5302
|
+
liveClock: s,
|
|
5303
|
+
windMotion: F,
|
|
5304
|
+
rainLevel: C,
|
|
5305
|
+
snowLevel: w,
|
|
5306
|
+
fogLevel: T,
|
|
5307
|
+
hailLevel: E,
|
|
5308
|
+
smogLevel: D
|
|
4824
5309
|
});
|
|
4825
5310
|
}, [
|
|
4826
|
-
|
|
4827
|
-
|
|
5311
|
+
I,
|
|
5312
|
+
O,
|
|
5313
|
+
N,
|
|
5314
|
+
C,
|
|
5315
|
+
w,
|
|
5316
|
+
T,
|
|
5317
|
+
E,
|
|
5318
|
+
D,
|
|
4828
5319
|
t,
|
|
4829
|
-
|
|
5320
|
+
s,
|
|
5321
|
+
k,
|
|
5322
|
+
e,
|
|
5323
|
+
F
|
|
4830
5324
|
]), /* @__PURE__ */ u("div", {
|
|
4831
|
-
className:
|
|
5325
|
+
className: zi.weatherBackground,
|
|
4832
5326
|
style: {
|
|
4833
5327
|
width: e,
|
|
4834
5328
|
height: t
|
|
4835
5329
|
},
|
|
4836
5330
|
children: [/* @__PURE__ */ l("canvas", {
|
|
4837
|
-
ref:
|
|
4838
|
-
className:
|
|
5331
|
+
ref: b,
|
|
5332
|
+
className: zi.canvas,
|
|
4839
5333
|
style: {
|
|
4840
5334
|
width: e,
|
|
4841
5335
|
height: t
|
|
4842
5336
|
},
|
|
4843
5337
|
role: "img",
|
|
4844
|
-
"aria-label": `天气背景:${
|
|
4845
|
-
}),
|
|
4846
|
-
className:
|
|
5338
|
+
"aria-label": `天气背景:${S}${I ? "(夜间)" : ""},${F.level}级风`
|
|
5339
|
+
}), L && /* @__PURE__ */ u("div", {
|
|
5340
|
+
className: zi.loadingOverlay,
|
|
4847
5341
|
role: "status",
|
|
4848
5342
|
"aria-live": "polite",
|
|
4849
5343
|
children: [/* @__PURE__ */ l("div", {
|
|
4850
|
-
className:
|
|
5344
|
+
className: zi.loadingSpinner,
|
|
4851
5345
|
"aria-hidden": !0
|
|
4852
5346
|
}), /* @__PURE__ */ l("span", { children: "天气加载中…" })]
|
|
4853
5347
|
})]
|
|
4854
5348
|
});
|
|
4855
|
-
},
|
|
5349
|
+
}, Vi = {
|
|
4856
5350
|
waveText: "cos-waveText-Zy2Tp",
|
|
4857
5351
|
text: "cos-text-el-KR",
|
|
4858
5352
|
char: "cos-char-Y9-mV",
|
|
4859
5353
|
wave: "cos-wave-jVRCz"
|
|
4860
|
-
},
|
|
4861
|
-
className:
|
|
5354
|
+
}, Hi = ({ text: e = "WAVE", amplitude: t = 12, color: n = "#38bdf8", fontSize: r = 56 }) => /* @__PURE__ */ l("div", {
|
|
5355
|
+
className: Vi.waveText,
|
|
4862
5356
|
children: /* @__PURE__ */ l("h1", {
|
|
4863
|
-
className:
|
|
5357
|
+
className: Vi.text,
|
|
4864
5358
|
style: {
|
|
4865
5359
|
fontSize: r,
|
|
4866
5360
|
"--wave-color": n,
|
|
4867
5361
|
"--wave-amp": `${t}px`
|
|
4868
5362
|
},
|
|
4869
5363
|
children: e.split("").map((e, t) => /* @__PURE__ */ l("span", {
|
|
4870
|
-
className:
|
|
5364
|
+
className: Vi.char,
|
|
4871
5365
|
style: { animationDelay: `${t * .1}s` },
|
|
4872
5366
|
children: e === " " ? "\xA0" : e
|
|
4873
5367
|
}, `${e}-${t}`))
|
|
4874
5368
|
})
|
|
4875
5369
|
});
|
|
4876
5370
|
//#endregion
|
|
4877
|
-
export { x as AudioVisualizer, _ as Aurora, f as BarcodeScan, m as BurnAway, C as CanvasClock, D as Charge, k as ClickSpark,
|
|
5371
|
+
export { x as AudioVisualizer, _ as Aurora, f as BarcodeScan, m as BurnAway, C as CanvasClock, D as Charge, k as ClickSpark, P as Confetti, ne as Countdown, le as CursorTrail, I as CyberGrid, Ln as DEFAULT_FOG_LEVEL, Kn as DEFAULT_HAIL_LEVEL, tr as DEFAULT_RAIN_LEVEL, wr as DEFAULT_SMOG_LEVEL, nr as DEFAULT_SNOW_LEVEL, Wr as DEFAULT_WIND_LEVEL, de as DiceRoll, ie as DnaHelix, pe as DoublePendulum, se as ElectricArc, Rn as FOG_LEVEL_LABELS, be as Fireworks, Ce as FlipCounter, Oe as GlitchText, Ee as GradientFlow, je as GravityBalls, qn as HAIL_LEVEL_LABELS, Me as HolographicCard, Le as LiquidGlass, Ne as LiquidProgress, Fe as LorenzAttractor, er as MAX_PRECIP_LEVEL, $n as MIN_PRECIP_LEVEL, ze as MagneticButton, He as MatrixRain, Ke as MazeGenerator, We as MetaballPool, Je as MeteorRain, Xe as NeonText, Qe as NewtonCradle, tt as OrbitalChart, rt as ParticleNetwork, at as PlasmaBall, jt as ProgressChest, lr as RAIN_LEVEL_LABELS, Nt as RadarScan, Ft as RedPacketRain, Lt as ReturnCity, Yt as RippleWater, zt as RopeChain, Tr as SMOG_LEVEL_LABELS, ur as SNOW_LEVEL_LABELS, Qt as ScrambleText, en as ScratchCard, rn as SlotMachine, Ct as SmokeFog, Ot as Snowfall, Et as SolarSystem, Bt as Speedometer, sn as SplitReveal, ln as Spotlight, At as Starfield, Vt as TimelinePulse, pn as Turntable, _n as Typewriter, yn as WaveButton, Hi as WaveText, Bi as WeatherBackground, ei as buildWindMotion, zn as clampFogLevel, Jn as clampHailLevel, $ as clampPrecipLevel, Er as clampSmogLevel, Un as fogBankAlphaScale, Gn as fogLevelFromVisibility, Wn as fogLevelFromWmo, Bn as formatFogLevel, Yn as formatHailLevel, Br as formatLocalHm, cr as formatPrecipLevel, Dr as formatSmogLevel, Qn as hailLevelFromWmo, Zn as hailSpec, Hn as intensifyFogConfig, br as intensifyRainConfig, kr as intensifySmogConfig, xr as intensifySnowCount, fr as isRainWeather, pr as isSnowWeather, $r as kmhToWindLevel, Nr as mapWmoCodeToWeatherType, dr as normalizeWeatherType, ir as precipBand, sr as precipLabel, gr as rainLevelFromWeather, Sr as rainLevelFromWmo, yr as resolveSceneWeather, Xr as sampleWindField, Ar as smogBankAlphaScale, jr as smogLevelFromVisibility, _r as snowLevelFromWeather, Cr as snowLevelFromWmo, Vn as supportsFogLevel, Xn as supportsHailLevel, mr as supportsRainLevel, Or as supportsSmogLevel, hr as supportsSnowLevel, Vr as useLiveWeather, Ur as useSunTimes, Kr as visualWindLevel, Qr as windLevelToKmh, Zr as windStreakSpec };
|