cos-design 3.5.4 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/dist/index.cjs +3 -3
- package/dist/index.css +1 -1
- package/dist/index.js +2220 -534
- package/dist/src/components/bubbleField/background.d.ts +3 -0
- package/dist/src/components/bubbleField/constants.d.ts +10 -0
- package/dist/src/components/bubbleField/index.d.ts +5 -0
- package/dist/src/components/bubbleField/merge.d.ts +5 -0
- package/dist/src/components/bubbleField/physics.d.ts +12 -0
- package/dist/src/components/bubbleField/render.d.ts +3 -0
- package/dist/src/components/bubbleField/types.d.ts +81 -0
- package/dist/src/components/bubbleField/utils.d.ts +6 -0
- package/dist/src/components/countUp/index.d.ts +19 -0
- package/dist/src/components/gameOfLife/index.d.ts +17 -0
- package/dist/src/components/index.d.ts +27 -1
- package/dist/src/components/networkGraph/index.d.ts +24 -0
- package/dist/src/components/sandFall/index.d.ts +13 -0
- package/dist/src/components/splitText/index.d.ts +21 -0
- package/dist/src/components/springMass/index.d.ts +17 -0
- package/dist/src/components/textMorph/index.d.ts +15 -0
- 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,28 +601,78 @@ 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
|
+
}, z = {
|
|
627
|
+
countUp: "cos-countUp-PKMgo",
|
|
628
|
+
glow: "cos-glow-oAz5z",
|
|
629
|
+
value: "cos-value-WDAyV",
|
|
630
|
+
valueWrap: "cos-valueWrap-AQoM4",
|
|
631
|
+
measure: "cos-measure-ZGRt4",
|
|
632
|
+
display: "cos-display-JHXA2"
|
|
633
|
+
}, re = (e) => 1 - (1 - e) ** 3, ie = (e, t) => e.toLocaleString("en-US", {
|
|
634
|
+
minimumFractionDigits: t,
|
|
635
|
+
maximumFractionDigits: t
|
|
636
|
+
}), ae = ({ value: e, start: t = 0, duration: r = 1400, decimals: i = 0, prefix: c = "", suffix: d = "", color: f = "#34d399" }) => {
|
|
637
|
+
let [p, m] = s(t), h = o(0), g = o(t);
|
|
638
|
+
n(() => {
|
|
639
|
+
let t = g.current, n = e, i = performance.now();
|
|
640
|
+
cancelAnimationFrame(h.current);
|
|
641
|
+
let a = (e) => {
|
|
642
|
+
let o = Math.min(1, (e - i) / Math.max(r, 16)), s = re(o);
|
|
643
|
+
m(t + (n - t) * s), o < 1 ? h.current = requestAnimationFrame(a) : g.current = n;
|
|
644
|
+
};
|
|
645
|
+
return h.current = requestAnimationFrame(a), () => cancelAnimationFrame(h.current);
|
|
646
|
+
}, [r, e]);
|
|
647
|
+
let _ = a(() => `${c}${ie(p, i)}${d}`, [
|
|
648
|
+
i,
|
|
649
|
+
p,
|
|
650
|
+
c,
|
|
651
|
+
d
|
|
652
|
+
]), v = a(() => {
|
|
653
|
+
let n = [t, e].map((e) => `${c}${ie(e, i)}${d}`);
|
|
654
|
+
return n.reduce((e, t) => t.length > e.length ? t : e, n[0]);
|
|
655
|
+
}, [
|
|
656
|
+
i,
|
|
657
|
+
c,
|
|
658
|
+
t,
|
|
659
|
+
d,
|
|
660
|
+
e
|
|
661
|
+
]);
|
|
662
|
+
return /* @__PURE__ */ u("div", {
|
|
663
|
+
className: z.countUp,
|
|
664
|
+
style: { "--count-up-color": f },
|
|
665
|
+
children: [/* @__PURE__ */ l("div", { className: z.glow }), /* @__PURE__ */ u("div", {
|
|
666
|
+
className: z.valueWrap,
|
|
667
|
+
children: [/* @__PURE__ */ l("span", {
|
|
668
|
+
className: `${z.value} ${z.measure}`,
|
|
669
|
+
children: v
|
|
670
|
+
}), /* @__PURE__ */ l("span", {
|
|
671
|
+
className: `${z.value} ${z.display}`,
|
|
672
|
+
children: _
|
|
673
|
+
})]
|
|
674
|
+
})]
|
|
675
|
+
});
|
|
626
676
|
}, oe = {
|
|
627
677
|
dnaHelix: "cos-dnaHelix-nEQLW",
|
|
628
678
|
canvas: "cos-canvas-uEV8B"
|
|
@@ -786,7 +836,7 @@ var P = {
|
|
|
786
836
|
children: "移动鼠标查看粒子轨迹"
|
|
787
837
|
})]
|
|
788
838
|
});
|
|
789
|
-
},
|
|
839
|
+
}, B = {
|
|
790
840
|
diceRoll: "cos-diceRoll-GDwjV",
|
|
791
841
|
scene: "cos-scene-tmnKM",
|
|
792
842
|
cube: "cos-cube-RklEa",
|
|
@@ -876,19 +926,19 @@ var P = {
|
|
|
876
926
|
[75, 75]
|
|
877
927
|
]
|
|
878
928
|
}[e] ?? []).map(([e, t], n) => /* @__PURE__ */ l("span", {
|
|
879
|
-
className:
|
|
929
|
+
className: B.dot,
|
|
880
930
|
style: {
|
|
881
931
|
left: `${e}%`,
|
|
882
932
|
top: `${t}%`
|
|
883
933
|
}
|
|
884
934
|
}, n));
|
|
885
935
|
return /* @__PURE__ */ u("div", {
|
|
886
|
-
className:
|
|
936
|
+
className: B.diceRoll,
|
|
887
937
|
children: [
|
|
888
938
|
/* @__PURE__ */ l("div", {
|
|
889
|
-
className:
|
|
939
|
+
className: B.scene,
|
|
890
940
|
children: /* @__PURE__ */ l("div", {
|
|
891
|
-
className: `${
|
|
941
|
+
className: `${B.cube} ${r ? B.rolling : ""}`,
|
|
892
942
|
style: { transform: `rotateX(${d.x}deg) rotateY(${d.y}deg) rotateZ(${d.z}deg)` },
|
|
893
943
|
children: [
|
|
894
944
|
1,
|
|
@@ -898,20 +948,20 @@ var P = {
|
|
|
898
948
|
5,
|
|
899
949
|
6
|
|
900
950
|
].map((e) => /* @__PURE__ */ l("div", {
|
|
901
|
-
className: `${
|
|
951
|
+
className: `${B.face} ${B[`face${e}`]}`,
|
|
902
952
|
children: g(e)
|
|
903
953
|
}, e))
|
|
904
954
|
})
|
|
905
955
|
}),
|
|
906
956
|
/* @__PURE__ */ l("button", {
|
|
907
957
|
type: "button",
|
|
908
|
-
className:
|
|
958
|
+
className: B.rollBtn,
|
|
909
959
|
onClick: h,
|
|
910
960
|
disabled: r,
|
|
911
961
|
children: r ? "掷骰中..." : "掷骰子"
|
|
912
962
|
}),
|
|
913
963
|
!r && /* @__PURE__ */ u("p", {
|
|
914
|
-
className:
|
|
964
|
+
className: B.result,
|
|
915
965
|
children: ["点数: ", a]
|
|
916
966
|
})
|
|
917
967
|
]
|
|
@@ -1061,7 +1111,7 @@ var P = {
|
|
|
1061
1111
|
});
|
|
1062
1112
|
});
|
|
1063
1113
|
Ce.displayName = "Fireworks";
|
|
1064
|
-
var
|
|
1114
|
+
var V = {
|
|
1065
1115
|
flipCounter: "cos-flipCounter-3LuI0",
|
|
1066
1116
|
digit: "cos-digit-yJRPy",
|
|
1067
1117
|
digitCard: "cos-digitCard-zZUzt",
|
|
@@ -1083,27 +1133,27 @@ var L = {
|
|
|
1083
1133
|
}, [e, r]);
|
|
1084
1134
|
let m = a ? f : e;
|
|
1085
1135
|
return /* @__PURE__ */ l("div", {
|
|
1086
|
-
className:
|
|
1136
|
+
className: V.digit,
|
|
1087
1137
|
style: {
|
|
1088
1138
|
"--flip-color": t,
|
|
1089
1139
|
"--flip-duration": `${r}ms`
|
|
1090
1140
|
},
|
|
1091
1141
|
children: /* @__PURE__ */ u("div", {
|
|
1092
|
-
className: `${
|
|
1142
|
+
className: `${V.digitCard} ${a ? V.isFlipping : ""}`,
|
|
1093
1143
|
children: [
|
|
1094
1144
|
/* @__PURE__ */ l("div", {
|
|
1095
|
-
className:
|
|
1145
|
+
className: V.staticTop,
|
|
1096
1146
|
children: /* @__PURE__ */ l("span", { children: m })
|
|
1097
1147
|
}),
|
|
1098
1148
|
/* @__PURE__ */ l("div", {
|
|
1099
|
-
className:
|
|
1149
|
+
className: V.staticBottom,
|
|
1100
1150
|
children: /* @__PURE__ */ l("span", { children: m })
|
|
1101
1151
|
}),
|
|
1102
1152
|
a && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("div", {
|
|
1103
|
-
className: `${
|
|
1153
|
+
className: `${V.flap} ${V.flapTop}`,
|
|
1104
1154
|
children: /* @__PURE__ */ l("span", { children: f })
|
|
1105
1155
|
}), /* @__PURE__ */ l("div", {
|
|
1106
|
-
className: `${
|
|
1156
|
+
className: `${V.flap} ${V.flapBottom}`,
|
|
1107
1157
|
children: /* @__PURE__ */ l("span", { children: e })
|
|
1108
1158
|
})] })
|
|
1109
1159
|
]
|
|
@@ -1112,7 +1162,7 @@ var L = {
|
|
|
1112
1162
|
}, Ee = ({ value: e, digits: t = 4, color: n = "#38bdf8", duration: r = 600 }) => {
|
|
1113
1163
|
let i = we(e, t).split("");
|
|
1114
1164
|
return /* @__PURE__ */ l("div", {
|
|
1115
|
-
className:
|
|
1165
|
+
className: V.flipCounter,
|
|
1116
1166
|
children: i.map((e, t) => /* @__PURE__ */ l(Te, {
|
|
1117
1167
|
digit: e,
|
|
1118
1168
|
color: n,
|
|
@@ -1143,14 +1193,125 @@ var L = {
|
|
|
1143
1193
|
})
|
|
1144
1194
|
});
|
|
1145
1195
|
}, Ae = {
|
|
1196
|
+
gameOfLife: "cos-gameOfLife-1i2nu",
|
|
1197
|
+
canvas: "cos-canvas-urOjh",
|
|
1198
|
+
toolbar: "cos-toolbar-GmcD1",
|
|
1199
|
+
meta: "cos-meta-KLxCp",
|
|
1200
|
+
actions: "cos-actions-l3sAu",
|
|
1201
|
+
button: "cos-button-g0tCm"
|
|
1202
|
+
}, je = (e, t, n) => Math.min(n, Math.max(t, e)), Me = (e, t, n) => Array.from({ length: e }, () => Array.from({ length: t }, () => +(Math.random() < n))), Ne = (e) => {
|
|
1203
|
+
let t = e.length, n = e[0]?.length || 0, r = Array.from({ length: t }, () => Array(n).fill(0));
|
|
1204
|
+
for (let i = 0; i < t; i++) for (let a = 0; a < n; a++) {
|
|
1205
|
+
let o = 0;
|
|
1206
|
+
for (let r = -1; r <= 1; r++) for (let s = -1; s <= 1; s++) {
|
|
1207
|
+
if (s === 0 && r === 0) continue;
|
|
1208
|
+
let c = i + r, l = a + s;
|
|
1209
|
+
c < 0 || c >= t || l < 0 || l >= n || (o += e[c][l]);
|
|
1210
|
+
}
|
|
1211
|
+
e[i][a] ? r[i][a] = +(o === 2 || o === 3) : o === 3 && (r[i][a] = 1);
|
|
1212
|
+
}
|
|
1213
|
+
return r;
|
|
1214
|
+
}, Pe = ({ width: e = 560, height: t = 420, cellSize: r = 14, speed: i = 120, density: c = .28, aliveColor: d = "#a3e635", gridColor: f = "rgb(148 163 184 / 14%)" }) => {
|
|
1215
|
+
let p = o(null), m = Math.max(6, Math.floor(t / r)), h = Math.max(6, Math.floor(e / r)), g = je(c, .05, .7), [_, y] = s(!0), [b, x] = s(0), S = o(document.hidden), [C, w] = s(() => Me(m, h, g)), [T, E] = s({
|
|
1216
|
+
rows: m,
|
|
1217
|
+
cols: h,
|
|
1218
|
+
density: g
|
|
1219
|
+
});
|
|
1220
|
+
(T.rows !== m || T.cols !== h || T.density !== g) && (E({
|
|
1221
|
+
rows: m,
|
|
1222
|
+
cols: h,
|
|
1223
|
+
density: g
|
|
1224
|
+
}), w(Me(m, h, g)), x(0)), n(() => {
|
|
1225
|
+
let n = p.current;
|
|
1226
|
+
if (!n) return;
|
|
1227
|
+
let i = window.devicePixelRatio || 1;
|
|
1228
|
+
n.width = e * i, n.height = t * i;
|
|
1229
|
+
let a = n.getContext("2d");
|
|
1230
|
+
if (!a) return;
|
|
1231
|
+
a.setTransform(i, 0, 0, i, 0, 0);
|
|
1232
|
+
let o = 0, s = v((e) => {
|
|
1233
|
+
S.current = e;
|
|
1234
|
+
}), c = () => {
|
|
1235
|
+
a.fillStyle = "#020617", a.fillRect(0, 0, e, t);
|
|
1236
|
+
for (let e = 0; e < m; e++) for (let t = 0; t < h; t++) {
|
|
1237
|
+
if (!C[e][t]) continue;
|
|
1238
|
+
let n = t * r, i = e * r;
|
|
1239
|
+
a.fillStyle = d, a.fillRect(n + 1, i + 1, r - 2, r - 2);
|
|
1240
|
+
let o = a.createRadialGradient(n + r / 2, i + r / 2, 0, n + r / 2, i + r / 2, r * .8);
|
|
1241
|
+
o.addColorStop(0, "rgb(255 255 255 / 28%)"), o.addColorStop(1, "transparent"), a.fillStyle = o, a.fillRect(n, i, r, r);
|
|
1242
|
+
}
|
|
1243
|
+
a.strokeStyle = f, a.lineWidth = 1;
|
|
1244
|
+
for (let e = 0; e <= h; e++) a.beginPath(), a.moveTo(e * r + .5, 0), a.lineTo(e * r + .5, t), a.stroke();
|
|
1245
|
+
for (let t = 0; t <= m; t++) a.beginPath(), a.moveTo(0, t * r + .5), a.lineTo(e, t * r + .5), a.stroke();
|
|
1246
|
+
}, l = () => {
|
|
1247
|
+
o = requestAnimationFrame(l), c();
|
|
1248
|
+
};
|
|
1249
|
+
return o = requestAnimationFrame(l), () => {
|
|
1250
|
+
cancelAnimationFrame(o), s();
|
|
1251
|
+
};
|
|
1252
|
+
}, [
|
|
1253
|
+
d,
|
|
1254
|
+
r,
|
|
1255
|
+
h,
|
|
1256
|
+
C,
|
|
1257
|
+
f,
|
|
1258
|
+
t,
|
|
1259
|
+
m,
|
|
1260
|
+
e
|
|
1261
|
+
]), n(() => {
|
|
1262
|
+
if (!_) return;
|
|
1263
|
+
let e = window.setInterval(() => {
|
|
1264
|
+
S.current || (w((e) => Ne(e)), x((e) => e + 1));
|
|
1265
|
+
}, i);
|
|
1266
|
+
return () => clearInterval(e);
|
|
1267
|
+
}, [_, i]);
|
|
1268
|
+
let D = a(() => C.reduce((e, t) => e + t.reduce((e, t) => e + t, 0), 0), [C]), O = () => {
|
|
1269
|
+
w(Me(m, h, g)), x(0);
|
|
1270
|
+
}, k = (e, t, n) => {
|
|
1271
|
+
let i = Math.floor((e - n.left) / r), a = Math.floor((t - n.top) / r);
|
|
1272
|
+
a < 0 || a >= m || i < 0 || i >= h || (w((e) => e.map((e, t) => t === a ? e.map((e, t) => t === i ? +!e : e) : e)), x((e) => e + 1));
|
|
1273
|
+
};
|
|
1274
|
+
return /* @__PURE__ */ u("div", {
|
|
1275
|
+
className: Ae.gameOfLife,
|
|
1276
|
+
style: { width: e },
|
|
1277
|
+
children: [/* @__PURE__ */ l("canvas", {
|
|
1278
|
+
ref: p,
|
|
1279
|
+
className: Ae.canvas,
|
|
1280
|
+
style: {
|
|
1281
|
+
width: e,
|
|
1282
|
+
height: t
|
|
1283
|
+
},
|
|
1284
|
+
onClick: (e) => k(e.clientX, e.clientY, e.currentTarget.getBoundingClientRect())
|
|
1285
|
+
}), /* @__PURE__ */ u("div", {
|
|
1286
|
+
className: Ae.toolbar,
|
|
1287
|
+
children: [/* @__PURE__ */ u("div", {
|
|
1288
|
+
className: Ae.meta,
|
|
1289
|
+
children: [/* @__PURE__ */ u("span", { children: ["Generation ", b] }), /* @__PURE__ */ u("span", { children: [D, " alive"] })]
|
|
1290
|
+
}), /* @__PURE__ */ u("div", {
|
|
1291
|
+
className: Ae.actions,
|
|
1292
|
+
children: [/* @__PURE__ */ l("button", {
|
|
1293
|
+
type: "button",
|
|
1294
|
+
className: Ae.button,
|
|
1295
|
+
onClick: () => y((e) => !e),
|
|
1296
|
+
children: _ ? "Pause" : "Play"
|
|
1297
|
+
}), /* @__PURE__ */ l("button", {
|
|
1298
|
+
type: "button",
|
|
1299
|
+
className: Ae.button,
|
|
1300
|
+
onClick: O,
|
|
1301
|
+
children: "Randomize"
|
|
1302
|
+
})]
|
|
1303
|
+
})]
|
|
1304
|
+
})]
|
|
1305
|
+
});
|
|
1306
|
+
}, Fe = {
|
|
1146
1307
|
glitchText: "cos-glitchText-dZ-sR",
|
|
1147
1308
|
text: "cos-text-JsPHN",
|
|
1148
1309
|
"glitch-1": "cos-glitch-1-s9pqH",
|
|
1149
1310
|
"glitch-2": "cos-glitch-2-GhFB-"
|
|
1150
|
-
},
|
|
1151
|
-
className:
|
|
1311
|
+
}, Ie = ({ text: e = "GLITCH", color: t = "#f8fafc", glitchColor1: n = "#ff00de", glitchColor2: r = "#00f0ff", fontSize: i = 64 }) => /* @__PURE__ */ l("div", {
|
|
1312
|
+
className: Fe.glitchText,
|
|
1152
1313
|
children: /* @__PURE__ */ l("h1", {
|
|
1153
|
-
className:
|
|
1314
|
+
className: Fe.text,
|
|
1154
1315
|
"data-text": e,
|
|
1155
1316
|
style: {
|
|
1156
1317
|
fontSize: i,
|
|
@@ -1160,16 +1321,16 @@ var L = {
|
|
|
1160
1321
|
},
|
|
1161
1322
|
children: e
|
|
1162
1323
|
})
|
|
1163
|
-
}),
|
|
1324
|
+
}), Le = {
|
|
1164
1325
|
gravityBalls: "cos-gravityBalls-LdwFo",
|
|
1165
1326
|
canvas: "cos-canvas-n7esd"
|
|
1166
|
-
},
|
|
1327
|
+
}, Re = [
|
|
1167
1328
|
"#38bdf8",
|
|
1168
1329
|
"#a78bfa",
|
|
1169
1330
|
"#f472b6",
|
|
1170
1331
|
"#4ade80",
|
|
1171
1332
|
"#fbbf24"
|
|
1172
|
-
],
|
|
1333
|
+
], ze = ({ width: e = 400, height: t = 300, ballCount: r = 12 }) => {
|
|
1173
1334
|
let i = o(null), a = o([]);
|
|
1174
1335
|
return n(() => {
|
|
1175
1336
|
a.current = Array.from({ length: r }, () => ({
|
|
@@ -1178,7 +1339,7 @@ var L = {
|
|
|
1178
1339
|
vx: (Math.random() - .5) * 4,
|
|
1179
1340
|
vy: Math.random() * 2,
|
|
1180
1341
|
r: Math.random() * 10 + 8,
|
|
1181
|
-
color:
|
|
1342
|
+
color: Re[Math.floor(Math.random() * Re.length)]
|
|
1182
1343
|
}));
|
|
1183
1344
|
}, [
|
|
1184
1345
|
r,
|
|
@@ -1218,34 +1379,34 @@ var L = {
|
|
|
1218
1379
|
cancelAnimationFrame(s), l();
|
|
1219
1380
|
};
|
|
1220
1381
|
}, [t, e]), /* @__PURE__ */ l("div", {
|
|
1221
|
-
className:
|
|
1382
|
+
className: Le.gravityBalls,
|
|
1222
1383
|
style: {
|
|
1223
1384
|
width: e,
|
|
1224
1385
|
height: t
|
|
1225
1386
|
},
|
|
1226
1387
|
children: /* @__PURE__ */ l("canvas", {
|
|
1227
1388
|
ref: i,
|
|
1228
|
-
className:
|
|
1389
|
+
className: Le.canvas,
|
|
1229
1390
|
style: {
|
|
1230
1391
|
width: e,
|
|
1231
1392
|
height: t
|
|
1232
1393
|
}
|
|
1233
1394
|
})
|
|
1234
1395
|
});
|
|
1235
|
-
},
|
|
1396
|
+
}, Be = {
|
|
1236
1397
|
wrap: "cos-wrap-r1gGL",
|
|
1237
1398
|
card: "cos-card-3W10s",
|
|
1238
1399
|
shine: "cos-shine-0xjID",
|
|
1239
1400
|
image: "cos-image-AV2XG",
|
|
1240
1401
|
placeholder: "cos-placeholder-wuuL3",
|
|
1241
1402
|
info: "cos-info-CNR0r"
|
|
1242
|
-
},
|
|
1403
|
+
}, Ve = ({ title: e = "全息卡片", subtitle: t = "移动鼠标体验 3D 效果", image: n }) => {
|
|
1243
1404
|
let r = o(null);
|
|
1244
1405
|
return /* @__PURE__ */ l("div", {
|
|
1245
|
-
className:
|
|
1406
|
+
className: Be.wrap,
|
|
1246
1407
|
children: /* @__PURE__ */ u("div", {
|
|
1247
1408
|
ref: r,
|
|
1248
|
-
className:
|
|
1409
|
+
className: Be.card,
|
|
1249
1410
|
onMouseMove: (e) => {
|
|
1250
1411
|
let t = r.current;
|
|
1251
1412
|
if (!t) return;
|
|
@@ -1257,23 +1418,23 @@ var L = {
|
|
|
1257
1418
|
e && (e.style.setProperty("--rx", "0deg"), e.style.setProperty("--ry", "0deg"), e.style.setProperty("--gx", "50%"), e.style.setProperty("--gy", "50%"));
|
|
1258
1419
|
},
|
|
1259
1420
|
children: [
|
|
1260
|
-
/* @__PURE__ */ l("div", { className:
|
|
1421
|
+
/* @__PURE__ */ l("div", { className: Be.shine }),
|
|
1261
1422
|
n ? /* @__PURE__ */ l("img", {
|
|
1262
1423
|
src: n,
|
|
1263
1424
|
alt: e,
|
|
1264
|
-
className:
|
|
1425
|
+
className: Be.image
|
|
1265
1426
|
}) : /* @__PURE__ */ l("div", {
|
|
1266
|
-
className:
|
|
1427
|
+
className: Be.placeholder,
|
|
1267
1428
|
children: /* @__PURE__ */ l("span", { children: "✦" })
|
|
1268
1429
|
}),
|
|
1269
1430
|
/* @__PURE__ */ u("div", {
|
|
1270
|
-
className:
|
|
1431
|
+
className: Be.info,
|
|
1271
1432
|
children: [/* @__PURE__ */ l("h3", { children: e }), /* @__PURE__ */ l("p", { children: t })]
|
|
1272
1433
|
})
|
|
1273
1434
|
]
|
|
1274
1435
|
})
|
|
1275
1436
|
});
|
|
1276
|
-
},
|
|
1437
|
+
}, H = {
|
|
1277
1438
|
liquidProgress: "cos-liquidProgress-ABZZA",
|
|
1278
1439
|
svg: "cos-svg-YdTvy",
|
|
1279
1440
|
track: "cos-track-IhMjO",
|
|
@@ -1281,7 +1442,7 @@ var L = {
|
|
|
1281
1442
|
fillBg: "cos-fillBg-pwLI1",
|
|
1282
1443
|
wave: "cos-wave-CBwgG",
|
|
1283
1444
|
label: "cos-label-WYDqS"
|
|
1284
|
-
},
|
|
1445
|
+
}, He = ({ value: e = 0, max: t = 100, size: i = 160, color: a = "#38bdf8" }) => {
|
|
1285
1446
|
let s = o(null), c = r().replace(/:/g, ""), d = y(t > 0 ? e / t * 100 : 0, 0, 100), f = 100 - d;
|
|
1286
1447
|
return n(() => {
|
|
1287
1448
|
let e = 0, t = 0, n = document.hidden, r = v((e) => {
|
|
@@ -1301,7 +1462,7 @@ var L = {
|
|
|
1301
1462
|
cancelAnimationFrame(e), r();
|
|
1302
1463
|
};
|
|
1303
1464
|
}, [f]), /* @__PURE__ */ u("div", {
|
|
1304
|
-
className:
|
|
1465
|
+
className: H.liquidProgress,
|
|
1305
1466
|
style: {
|
|
1306
1467
|
width: i,
|
|
1307
1468
|
height: i,
|
|
@@ -1309,7 +1470,7 @@ var L = {
|
|
|
1309
1470
|
},
|
|
1310
1471
|
children: [/* @__PURE__ */ u("svg", {
|
|
1311
1472
|
viewBox: "0 0 100 100",
|
|
1312
|
-
className:
|
|
1473
|
+
className: H.svg,
|
|
1313
1474
|
children: [
|
|
1314
1475
|
/* @__PURE__ */ l("defs", { children: /* @__PURE__ */ l("clipPath", {
|
|
1315
1476
|
id: `clip-${c}`,
|
|
@@ -1323,7 +1484,7 @@ var L = {
|
|
|
1323
1484
|
cx: "50",
|
|
1324
1485
|
cy: "50",
|
|
1325
1486
|
r: 45,
|
|
1326
|
-
className:
|
|
1487
|
+
className: H.track,
|
|
1327
1488
|
strokeWidth: 10,
|
|
1328
1489
|
fill: "none"
|
|
1329
1490
|
}),
|
|
@@ -1334,10 +1495,10 @@ var L = {
|
|
|
1334
1495
|
y: "0",
|
|
1335
1496
|
width: "100",
|
|
1336
1497
|
height: "100",
|
|
1337
|
-
className:
|
|
1498
|
+
className: H.fillBg
|
|
1338
1499
|
}), /* @__PURE__ */ l("path", {
|
|
1339
1500
|
ref: s,
|
|
1340
|
-
className:
|
|
1501
|
+
className: H.wave,
|
|
1341
1502
|
d: `M0,${f} Q25,${f - 4} 50,${f} T100,${f} V100 H0 Z`
|
|
1342
1503
|
})]
|
|
1343
1504
|
}),
|
|
@@ -1345,20 +1506,20 @@ var L = {
|
|
|
1345
1506
|
cx: "50",
|
|
1346
1507
|
cy: "50",
|
|
1347
1508
|
r: 45,
|
|
1348
|
-
className:
|
|
1509
|
+
className: H.ring,
|
|
1349
1510
|
strokeWidth: 10,
|
|
1350
1511
|
fill: "none"
|
|
1351
1512
|
})
|
|
1352
1513
|
]
|
|
1353
1514
|
}), /* @__PURE__ */ u("span", {
|
|
1354
|
-
className:
|
|
1515
|
+
className: H.label,
|
|
1355
1516
|
children: [Math.round(d), "%"]
|
|
1356
1517
|
})]
|
|
1357
1518
|
});
|
|
1358
|
-
},
|
|
1519
|
+
}, Ue = {
|
|
1359
1520
|
lorenzAttractor: "cos-lorenzAttractor--UAI7",
|
|
1360
1521
|
canvas: "cos-canvas-oeXce"
|
|
1361
|
-
},
|
|
1522
|
+
}, We = ({ width: e = 400, height: t = 360, speed: r = 1, color: i = "#f472b6", pointCount: a = 2e3 }) => {
|
|
1362
1523
|
let s = o(null), c = o(0);
|
|
1363
1524
|
return n(() => {
|
|
1364
1525
|
let n = s.current;
|
|
@@ -1408,45 +1569,45 @@ var L = {
|
|
|
1408
1569
|
r,
|
|
1409
1570
|
e
|
|
1410
1571
|
]), /* @__PURE__ */ l("div", {
|
|
1411
|
-
className:
|
|
1572
|
+
className: Ue.lorenzAttractor,
|
|
1412
1573
|
style: {
|
|
1413
1574
|
width: e,
|
|
1414
1575
|
height: t
|
|
1415
1576
|
},
|
|
1416
1577
|
children: /* @__PURE__ */ l("canvas", {
|
|
1417
1578
|
ref: s,
|
|
1418
|
-
className:
|
|
1579
|
+
className: Ue.canvas,
|
|
1419
1580
|
style: {
|
|
1420
1581
|
width: e,
|
|
1421
1582
|
height: t
|
|
1422
1583
|
}
|
|
1423
1584
|
})
|
|
1424
1585
|
});
|
|
1425
|
-
},
|
|
1586
|
+
}, Ge = {
|
|
1426
1587
|
liquidGlass: "cos-liquidGlass-Z3bQg",
|
|
1427
1588
|
panel: "cos-panel-XYboD",
|
|
1428
1589
|
content: "cos-content-MHfkS"
|
|
1429
|
-
},
|
|
1430
|
-
className:
|
|
1590
|
+
}, Ke = ({ children: e = "液态玻璃面板", blur: t = 16, borderRadius: n = 20 }) => /* @__PURE__ */ l("div", {
|
|
1591
|
+
className: Ge.liquidGlass,
|
|
1431
1592
|
children: /* @__PURE__ */ l("div", {
|
|
1432
|
-
className:
|
|
1593
|
+
className: Ge.panel,
|
|
1433
1594
|
style: {
|
|
1434
1595
|
"--glass-blur": `${t}px`,
|
|
1435
1596
|
"--glass-radius": `${n}px`
|
|
1436
1597
|
},
|
|
1437
1598
|
children: /* @__PURE__ */ l("div", {
|
|
1438
|
-
className:
|
|
1599
|
+
className: Ge.content,
|
|
1439
1600
|
children: e
|
|
1440
1601
|
})
|
|
1441
1602
|
})
|
|
1442
|
-
}),
|
|
1603
|
+
}), qe = {
|
|
1443
1604
|
magneticButton: "cos-magneticButton-GbRkE",
|
|
1444
1605
|
btn: "cos-btn--b2BJ"
|
|
1445
|
-
},
|
|
1606
|
+
}, Je = ({ children: e = "磁吸按钮", strength: t = .4, color: n = "#6366f1" }) => {
|
|
1446
1607
|
let r = o(null), i = o(null);
|
|
1447
1608
|
return /* @__PURE__ */ l("div", {
|
|
1448
1609
|
ref: r,
|
|
1449
|
-
className:
|
|
1610
|
+
className: qe.magneticButton,
|
|
1450
1611
|
onMouseMove: (e) => {
|
|
1451
1612
|
let n = r.current, a = i.current;
|
|
1452
1613
|
if (!n || !a) return;
|
|
@@ -1460,19 +1621,19 @@ var L = {
|
|
|
1460
1621
|
children: /* @__PURE__ */ l("button", {
|
|
1461
1622
|
ref: i,
|
|
1462
1623
|
type: "button",
|
|
1463
|
-
className:
|
|
1624
|
+
className: qe.btn,
|
|
1464
1625
|
style: { "--btn-color": n },
|
|
1465
1626
|
children: e
|
|
1466
1627
|
})
|
|
1467
1628
|
});
|
|
1468
|
-
},
|
|
1629
|
+
}, Ye = {
|
|
1469
1630
|
matrixRain: "cos-matrixRain-qg9HC",
|
|
1470
1631
|
canvas: "cos-canvas--AvpG",
|
|
1471
1632
|
overlay: "cos-overlay-knj3b",
|
|
1472
1633
|
title: "cos-title-sDfhs",
|
|
1473
1634
|
flicker: "cos-flicker-smHxl",
|
|
1474
1635
|
subtitle: "cos-subtitle-CWheW"
|
|
1475
|
-
},
|
|
1636
|
+
}, Xe = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*アイウエオカキクケコ", Ze = ({ width: e = 800, height: t = 500, density: r = .6, color: i = "#00ff41", showOverlay: a = !0, title: s = "MATRIX", subtitle: c = "数字雨效果" }) => {
|
|
1476
1637
|
let d = o(null);
|
|
1477
1638
|
return n(() => {
|
|
1478
1639
|
let n = d.current;
|
|
@@ -1486,7 +1647,7 @@ var L = {
|
|
|
1486
1647
|
u = e;
|
|
1487
1648
|
}), p = () => {
|
|
1488
1649
|
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 =
|
|
1650
|
+
let a = Xe[Math.floor(Math.random() * 53)], s = n / r * 16;
|
|
1490
1651
|
o.fillStyle = i, o.fillText(a, s, e * 16), e * 16 > t && Math.random() > .975 && (c[n] = 0), c[n] += 1;
|
|
1491
1652
|
}));
|
|
1492
1653
|
};
|
|
@@ -1499,33 +1660,33 @@ var L = {
|
|
|
1499
1660
|
t,
|
|
1500
1661
|
e
|
|
1501
1662
|
]), /* @__PURE__ */ u("div", {
|
|
1502
|
-
className:
|
|
1663
|
+
className: Ye.matrixRain,
|
|
1503
1664
|
style: {
|
|
1504
1665
|
width: e,
|
|
1505
1666
|
height: t
|
|
1506
1667
|
},
|
|
1507
1668
|
children: [/* @__PURE__ */ l("canvas", {
|
|
1508
1669
|
ref: d,
|
|
1509
|
-
className:
|
|
1670
|
+
className: Ye.canvas,
|
|
1510
1671
|
style: {
|
|
1511
1672
|
width: e,
|
|
1512
1673
|
height: t
|
|
1513
1674
|
}
|
|
1514
1675
|
}), a && /* @__PURE__ */ u("div", {
|
|
1515
|
-
className:
|
|
1676
|
+
className: Ye.overlay,
|
|
1516
1677
|
children: [/* @__PURE__ */ l("h2", {
|
|
1517
|
-
className:
|
|
1678
|
+
className: Ye.title,
|
|
1518
1679
|
children: s
|
|
1519
1680
|
}), /* @__PURE__ */ l("p", {
|
|
1520
|
-
className:
|
|
1681
|
+
className: Ye.subtitle,
|
|
1521
1682
|
children: c
|
|
1522
1683
|
})]
|
|
1523
1684
|
})]
|
|
1524
1685
|
});
|
|
1525
|
-
},
|
|
1686
|
+
}, Qe = {
|
|
1526
1687
|
metaballPool: "cos-metaballPool-JJaI9",
|
|
1527
1688
|
canvas: "cos-canvas-S7fDD"
|
|
1528
|
-
},
|
|
1689
|
+
}, $e = ({ width: e = 400, height: t = 300, ballCount: r = 5, color: i = "#38bdf8" }) => {
|
|
1529
1690
|
let a = o(null), s = o([]), c = o({
|
|
1530
1691
|
x: -999,
|
|
1531
1692
|
y: -999,
|
|
@@ -1615,7 +1776,7 @@ var L = {
|
|
|
1615
1776
|
t,
|
|
1616
1777
|
e
|
|
1617
1778
|
]), /* @__PURE__ */ l("div", {
|
|
1618
|
-
className:
|
|
1779
|
+
className: Qe.metaballPool,
|
|
1619
1780
|
style: {
|
|
1620
1781
|
width: e,
|
|
1621
1782
|
height: t,
|
|
@@ -1623,17 +1784,17 @@ var L = {
|
|
|
1623
1784
|
},
|
|
1624
1785
|
children: /* @__PURE__ */ l("canvas", {
|
|
1625
1786
|
ref: a,
|
|
1626
|
-
className:
|
|
1787
|
+
className: Qe.canvas,
|
|
1627
1788
|
style: {
|
|
1628
1789
|
width: e,
|
|
1629
1790
|
height: t
|
|
1630
1791
|
}
|
|
1631
1792
|
})
|
|
1632
1793
|
});
|
|
1633
|
-
},
|
|
1794
|
+
}, et = {
|
|
1634
1795
|
mazeGenerator: "cos-mazeGenerator-QEa0s",
|
|
1635
1796
|
canvas: "cos-canvas-emhxb"
|
|
1636
|
-
},
|
|
1797
|
+
}, tt = ({ width: e = 400, height: t = 300, cellSize: r = 20, onGenerated: i }) => {
|
|
1637
1798
|
let a = o(null), s = o(i);
|
|
1638
1799
|
return n(() => {
|
|
1639
1800
|
s.current = i;
|
|
@@ -1720,24 +1881,24 @@ var L = {
|
|
|
1720
1881
|
t,
|
|
1721
1882
|
e
|
|
1722
1883
|
]), /* @__PURE__ */ l("div", {
|
|
1723
|
-
className:
|
|
1884
|
+
className: et.mazeGenerator,
|
|
1724
1885
|
style: {
|
|
1725
1886
|
width: e,
|
|
1726
1887
|
height: t
|
|
1727
1888
|
},
|
|
1728
1889
|
children: /* @__PURE__ */ l("canvas", {
|
|
1729
1890
|
ref: a,
|
|
1730
|
-
className:
|
|
1891
|
+
className: et.canvas,
|
|
1731
1892
|
style: {
|
|
1732
1893
|
width: e,
|
|
1733
1894
|
height: t
|
|
1734
1895
|
}
|
|
1735
1896
|
})
|
|
1736
1897
|
});
|
|
1737
|
-
},
|
|
1898
|
+
}, nt = {
|
|
1738
1899
|
meteorRain: "cos-meteorRain-v8RNI",
|
|
1739
1900
|
canvas: "cos-canvas-hyFMr"
|
|
1740
|
-
},
|
|
1901
|
+
}, rt = ({ width: e = 800, height: t = 500, meteorCount: r = 8 }) => {
|
|
1741
1902
|
let i = o(null), a = o([]), s = o(0);
|
|
1742
1903
|
return n(() => {
|
|
1743
1904
|
a.current = Array.from({ length: r }, () => ({
|
|
@@ -1772,47 +1933,239 @@ var L = {
|
|
|
1772
1933
|
cancelAnimationFrame(s.current), l();
|
|
1773
1934
|
};
|
|
1774
1935
|
}, [t, e]), /* @__PURE__ */ l("div", {
|
|
1775
|
-
className:
|
|
1936
|
+
className: nt.meteorRain,
|
|
1776
1937
|
style: {
|
|
1777
1938
|
width: e,
|
|
1778
1939
|
height: t
|
|
1779
1940
|
},
|
|
1780
1941
|
children: /* @__PURE__ */ l("canvas", {
|
|
1781
1942
|
ref: i,
|
|
1782
|
-
className:
|
|
1943
|
+
className: nt.canvas,
|
|
1783
1944
|
style: {
|
|
1784
1945
|
width: e,
|
|
1785
1946
|
height: t
|
|
1786
1947
|
}
|
|
1787
1948
|
})
|
|
1788
1949
|
});
|
|
1789
|
-
},
|
|
1950
|
+
}, it = {
|
|
1951
|
+
networkGraph: "cos-networkGraph-4jjqg",
|
|
1952
|
+
canvas: "cos-canvas-F17fx",
|
|
1953
|
+
hint: "cos-hint-19aNc"
|
|
1954
|
+
}, at = [
|
|
1955
|
+
{
|
|
1956
|
+
id: "react",
|
|
1957
|
+
label: "React",
|
|
1958
|
+
color: "#61dafb"
|
|
1959
|
+
},
|
|
1960
|
+
{
|
|
1961
|
+
id: "vue",
|
|
1962
|
+
label: "Vue",
|
|
1963
|
+
color: "#42b883"
|
|
1964
|
+
},
|
|
1965
|
+
{
|
|
1966
|
+
id: "angular",
|
|
1967
|
+
label: "Angular",
|
|
1968
|
+
color: "#dd0031"
|
|
1969
|
+
},
|
|
1970
|
+
{
|
|
1971
|
+
id: "svelte",
|
|
1972
|
+
label: "Svelte",
|
|
1973
|
+
color: "#ff3e00"
|
|
1974
|
+
},
|
|
1975
|
+
{
|
|
1976
|
+
id: "ts",
|
|
1977
|
+
label: "TypeScript",
|
|
1978
|
+
color: "#3178c6"
|
|
1979
|
+
},
|
|
1980
|
+
{
|
|
1981
|
+
id: "vite",
|
|
1982
|
+
label: "Vite",
|
|
1983
|
+
color: "#bd34fe"
|
|
1984
|
+
},
|
|
1985
|
+
{
|
|
1986
|
+
id: "next",
|
|
1987
|
+
label: "Next.js",
|
|
1988
|
+
color: "#f8fafc"
|
|
1989
|
+
}
|
|
1990
|
+
], ot = [
|
|
1991
|
+
{
|
|
1992
|
+
source: "react",
|
|
1993
|
+
target: "ts"
|
|
1994
|
+
},
|
|
1995
|
+
{
|
|
1996
|
+
source: "react",
|
|
1997
|
+
target: "next"
|
|
1998
|
+
},
|
|
1999
|
+
{
|
|
2000
|
+
source: "react",
|
|
2001
|
+
target: "vite"
|
|
2002
|
+
},
|
|
2003
|
+
{
|
|
2004
|
+
source: "vue",
|
|
2005
|
+
target: "ts"
|
|
2006
|
+
},
|
|
2007
|
+
{
|
|
2008
|
+
source: "vue",
|
|
2009
|
+
target: "vite"
|
|
2010
|
+
},
|
|
2011
|
+
{
|
|
2012
|
+
source: "angular",
|
|
2013
|
+
target: "ts"
|
|
2014
|
+
},
|
|
2015
|
+
{
|
|
2016
|
+
source: "svelte",
|
|
2017
|
+
target: "vite"
|
|
2018
|
+
},
|
|
2019
|
+
{
|
|
2020
|
+
source: "ts",
|
|
2021
|
+
target: "vite"
|
|
2022
|
+
}
|
|
2023
|
+
], st = ({ width: e = 600, height: t = 420, nodes: r = at, edges: i = ot, linkColor: a = "rgb(148 163 184 / 35%)", nodeRadius: s = 20 }) => {
|
|
2024
|
+
let c = o(null), d = o([]), f = o(null);
|
|
2025
|
+
n(() => {
|
|
2026
|
+
if (!r.length) {
|
|
2027
|
+
d.current = [];
|
|
2028
|
+
return;
|
|
2029
|
+
}
|
|
2030
|
+
d.current = r.map((n, i) => ({
|
|
2031
|
+
id: n.id,
|
|
2032
|
+
label: n.label || n.id,
|
|
2033
|
+
color: n.color || "#38bdf8",
|
|
2034
|
+
x: e / 2 + Math.cos(i / r.length * Math.PI * 2) * 140,
|
|
2035
|
+
y: t / 2 + Math.sin(i / r.length * Math.PI * 2) * 120,
|
|
2036
|
+
vx: 0,
|
|
2037
|
+
vy: 0
|
|
2038
|
+
}));
|
|
2039
|
+
}, [
|
|
2040
|
+
t,
|
|
2041
|
+
r,
|
|
2042
|
+
e
|
|
2043
|
+
]), n(() => {
|
|
2044
|
+
let n = c.current;
|
|
2045
|
+
if (!n) return;
|
|
2046
|
+
let r = window.devicePixelRatio || 1;
|
|
2047
|
+
n.width = e * r, n.height = t * r;
|
|
2048
|
+
let o = n.getContext("2d");
|
|
2049
|
+
if (!o) return;
|
|
2050
|
+
o.setTransform(r, 0, 0, r, 0, 0);
|
|
2051
|
+
let l = 0, u = document.hidden, p = v((e) => {
|
|
2052
|
+
u = e;
|
|
2053
|
+
}), m = () => {
|
|
2054
|
+
let e = /* @__PURE__ */ new Map();
|
|
2055
|
+
return d.current.forEach((t) => e.set(t.id, t)), e;
|
|
2056
|
+
}, h = () => {
|
|
2057
|
+
let n = d.current, r = m(), a = .92, o = .003;
|
|
2058
|
+
for (let e = 0; e < n.length; e++) {
|
|
2059
|
+
let t = n[e];
|
|
2060
|
+
for (let r = e + 1; r < n.length; r++) {
|
|
2061
|
+
let e = n[r], i = t.x - e.x, a = t.y - e.y, o = i * i + a * a || 1, s = 2400 / o, c = Math.sqrt(o);
|
|
2062
|
+
i /= c, a /= c, t.vx += i * s, t.vy += a * s, e.vx -= i * s, e.vy -= a * s;
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2065
|
+
for (let e of i) {
|
|
2066
|
+
let t = r.get(e.source), n = r.get(e.target);
|
|
2067
|
+
if (!t || !n) continue;
|
|
2068
|
+
let i = n.x - t.x, a = n.y - t.y, o = Math.sqrt(i * i + a * a) || 1, s = .012 * (o - 120), c = i / o * s, l = a / o * s;
|
|
2069
|
+
t.vx += c, t.vy += l, n.vx -= c, n.vy -= l;
|
|
2070
|
+
}
|
|
2071
|
+
for (let r of n) r.vx += (e / 2 - r.x) * o, r.vy += (t / 2 - r.y) * o, r.vx *= a, r.vy *= a, f.current?.node !== r && (r.x += r.vx, r.y += r.vy, r.x = Math.max(s, Math.min(e - s, r.x)), r.y = Math.max(s, Math.min(t - s, r.y)));
|
|
2072
|
+
}, g = () => {
|
|
2073
|
+
o.fillStyle = "#0f172a", o.fillRect(0, 0, e, t);
|
|
2074
|
+
let n = m();
|
|
2075
|
+
o.lineWidth = 1.5, o.strokeStyle = a;
|
|
2076
|
+
for (let e of i) {
|
|
2077
|
+
let t = n.get(e.source), r = n.get(e.target);
|
|
2078
|
+
!t || !r || (o.beginPath(), o.moveTo(t.x, t.y), o.lineTo(r.x, r.y), o.stroke());
|
|
2079
|
+
}
|
|
2080
|
+
for (let e of d.current) o.beginPath(), o.arc(e.x, e.y, s, 0, Math.PI * 2), o.fillStyle = e.color, o.globalAlpha = .88, o.fill(), o.globalAlpha = 1, o.strokeStyle = "rgb(255 255 255 / 30%)", o.lineWidth = 1, o.stroke(), o.fillStyle = "#f8fafc", o.font = "11px system-ui, sans-serif", o.textAlign = "center", o.textBaseline = "middle", o.fillText(e.label, e.x, Math.min(t - 8, e.y + s + 14));
|
|
2081
|
+
}, _ = () => {
|
|
2082
|
+
l = requestAnimationFrame(_), !u && (h(), g());
|
|
2083
|
+
};
|
|
2084
|
+
return l = requestAnimationFrame(_), () => {
|
|
2085
|
+
cancelAnimationFrame(l), p();
|
|
2086
|
+
};
|
|
2087
|
+
}, [
|
|
2088
|
+
i,
|
|
2089
|
+
t,
|
|
2090
|
+
a,
|
|
2091
|
+
s,
|
|
2092
|
+
e
|
|
2093
|
+
]);
|
|
2094
|
+
let p = (e, t, n) => {
|
|
2095
|
+
let r = e - n.left, i = t - n.top;
|
|
2096
|
+
return d.current.find((e) => (e.x - r) ** 2 + (e.y - i) ** 2 < s ** 2) || null;
|
|
2097
|
+
}, m = (e, t, n) => {
|
|
2098
|
+
let r = p(e, t, n);
|
|
2099
|
+
r && (f.current = {
|
|
2100
|
+
node: r,
|
|
2101
|
+
offsetX: r.x - (e - n.left),
|
|
2102
|
+
offsetY: r.y - (t - n.top)
|
|
2103
|
+
});
|
|
2104
|
+
}, h = (e, t, n) => {
|
|
2105
|
+
if (!f.current) return;
|
|
2106
|
+
let { node: r, offsetX: i, offsetY: a } = f.current;
|
|
2107
|
+
r.x = e - n.left + i, r.y = t - n.top + a, r.vx = 0, r.vy = 0;
|
|
2108
|
+
}, g = () => {
|
|
2109
|
+
f.current = null;
|
|
2110
|
+
};
|
|
2111
|
+
return /* @__PURE__ */ u("div", {
|
|
2112
|
+
className: it.networkGraph,
|
|
2113
|
+
style: {
|
|
2114
|
+
width: e,
|
|
2115
|
+
height: t
|
|
2116
|
+
},
|
|
2117
|
+
children: [/* @__PURE__ */ l("canvas", {
|
|
2118
|
+
ref: c,
|
|
2119
|
+
className: it.canvas,
|
|
2120
|
+
style: {
|
|
2121
|
+
width: e,
|
|
2122
|
+
height: t
|
|
2123
|
+
},
|
|
2124
|
+
onMouseDown: (e) => m(e.clientX, e.clientY, e.currentTarget.getBoundingClientRect()),
|
|
2125
|
+
onMouseMove: (e) => h(e.clientX, e.clientY, e.currentTarget.getBoundingClientRect()),
|
|
2126
|
+
onMouseUp: g,
|
|
2127
|
+
onMouseLeave: g,
|
|
2128
|
+
onTouchStart: (e) => {
|
|
2129
|
+
let t = e.touches[0];
|
|
2130
|
+
t && m(t.clientX, t.clientY, e.currentTarget.getBoundingClientRect());
|
|
2131
|
+
},
|
|
2132
|
+
onTouchMove: (e) => {
|
|
2133
|
+
let t = e.touches[0];
|
|
2134
|
+
t && h(t.clientX, t.clientY, e.currentTarget.getBoundingClientRect());
|
|
2135
|
+
},
|
|
2136
|
+
onTouchEnd: g
|
|
2137
|
+
}), /* @__PURE__ */ l("div", {
|
|
2138
|
+
className: it.hint,
|
|
2139
|
+
children: "拖拽节点调整布局"
|
|
2140
|
+
})]
|
|
2141
|
+
});
|
|
2142
|
+
}, ct = {
|
|
1790
2143
|
neonText: "cos-neonText-JMP7i",
|
|
1791
2144
|
text: "cos-text-GTO-0",
|
|
1792
2145
|
flicker: "cos-flicker-nXceV",
|
|
1793
2146
|
"neon-flicker": "cos-neon-flicker-uDkmM",
|
|
1794
2147
|
reflection: "cos-reflection-aEYj6"
|
|
1795
|
-
},
|
|
1796
|
-
className:
|
|
2148
|
+
}, lt = ({ text: e = "NEON", color: t = "#ff00de", fontSize: n = 72, flicker: r = !0 }) => /* @__PURE__ */ u("div", {
|
|
2149
|
+
className: ct.neonText,
|
|
1797
2150
|
children: [/* @__PURE__ */ l("h1", {
|
|
1798
|
-
className: `${
|
|
2151
|
+
className: `${ct.text} ${r ? ct.flicker : ""}`,
|
|
1799
2152
|
style: {
|
|
1800
2153
|
fontSize: n,
|
|
1801
2154
|
"--neon-color": t
|
|
1802
2155
|
},
|
|
1803
2156
|
children: e
|
|
1804
2157
|
}), /* @__PURE__ */ l("p", {
|
|
1805
|
-
className:
|
|
2158
|
+
className: ct.reflection,
|
|
1806
2159
|
style: {
|
|
1807
2160
|
fontSize: n * .35,
|
|
1808
2161
|
color: t
|
|
1809
2162
|
},
|
|
1810
2163
|
children: e
|
|
1811
2164
|
})]
|
|
1812
|
-
}),
|
|
2165
|
+
}), ut = {
|
|
1813
2166
|
newtonCradle: "cos-newtonCradle-mFl-b",
|
|
1814
2167
|
canvas: "cos-canvas-TWKl5"
|
|
1815
|
-
},
|
|
2168
|
+
}, dt = ({ ballCount: e = 5, color: t = "#38bdf8", width: r = 280, height: i = 200 }) => {
|
|
1816
2169
|
let a = o(null), s = Math.max(2, Math.min(e, 7));
|
|
1817
2170
|
return n(() => {
|
|
1818
2171
|
let e = a.current;
|
|
@@ -1875,7 +2228,7 @@ var L = {
|
|
|
1875
2228
|
i,
|
|
1876
2229
|
r
|
|
1877
2230
|
]), /* @__PURE__ */ l("div", {
|
|
1878
|
-
className:
|
|
2231
|
+
className: ut.newtonCradle,
|
|
1879
2232
|
style: {
|
|
1880
2233
|
width: r,
|
|
1881
2234
|
height: i,
|
|
@@ -1883,19 +2236,19 @@ var L = {
|
|
|
1883
2236
|
},
|
|
1884
2237
|
children: /* @__PURE__ */ l("canvas", {
|
|
1885
2238
|
ref: a,
|
|
1886
|
-
className:
|
|
2239
|
+
className: ut.canvas,
|
|
1887
2240
|
style: {
|
|
1888
2241
|
width: r,
|
|
1889
2242
|
height: i
|
|
1890
2243
|
}
|
|
1891
2244
|
})
|
|
1892
2245
|
});
|
|
1893
|
-
},
|
|
2246
|
+
}, ft = {
|
|
1894
2247
|
orbitalChart: "cos-orbitalChart-XLORB",
|
|
1895
2248
|
canvas: "cos-canvas-hGVud",
|
|
1896
2249
|
legend: "cos-legend-Np9Mm",
|
|
1897
2250
|
swatch: "cos-swatch-xEKvA"
|
|
1898
|
-
},
|
|
2251
|
+
}, pt = [
|
|
1899
2252
|
{
|
|
1900
2253
|
label: "A",
|
|
1901
2254
|
value: 30,
|
|
@@ -1916,7 +2269,7 @@ var L = {
|
|
|
1916
2269
|
value: 25,
|
|
1917
2270
|
color: "#4ade80"
|
|
1918
2271
|
}
|
|
1919
|
-
],
|
|
2272
|
+
], mt = ({ data: e = pt, size: t = 240 }) => {
|
|
1920
2273
|
let r = o(null);
|
|
1921
2274
|
return n(() => {
|
|
1922
2275
|
let n = r.current;
|
|
@@ -1945,23 +2298,23 @@ var L = {
|
|
|
1945
2298
|
cancelAnimationFrame(u), p();
|
|
1946
2299
|
};
|
|
1947
2300
|
}, [e, t]), /* @__PURE__ */ u("div", {
|
|
1948
|
-
className:
|
|
2301
|
+
className: ft.orbitalChart,
|
|
1949
2302
|
style: {
|
|
1950
2303
|
width: t,
|
|
1951
2304
|
height: t
|
|
1952
2305
|
},
|
|
1953
2306
|
children: [/* @__PURE__ */ l("canvas", {
|
|
1954
2307
|
ref: r,
|
|
1955
|
-
className:
|
|
2308
|
+
className: ft.canvas,
|
|
1956
2309
|
style: {
|
|
1957
2310
|
width: t,
|
|
1958
2311
|
height: t
|
|
1959
2312
|
}
|
|
1960
2313
|
}), /* @__PURE__ */ l("ul", {
|
|
1961
|
-
className:
|
|
2314
|
+
className: ft.legend,
|
|
1962
2315
|
children: e.map((e) => /* @__PURE__ */ u("li", { children: [
|
|
1963
2316
|
/* @__PURE__ */ l("span", {
|
|
1964
|
-
className:
|
|
2317
|
+
className: ft.swatch,
|
|
1965
2318
|
style: { background: e.color }
|
|
1966
2319
|
}),
|
|
1967
2320
|
e.label,
|
|
@@ -1971,11 +2324,11 @@ var L = {
|
|
|
1971
2324
|
] }, e.label))
|
|
1972
2325
|
})]
|
|
1973
2326
|
});
|
|
1974
|
-
},
|
|
2327
|
+
}, ht = {
|
|
1975
2328
|
particleNetwork: "cos-particleNetwork-GSZq-",
|
|
1976
2329
|
canvas: "cos-canvas-E-BGP",
|
|
1977
2330
|
hint: "cos-hint-LEO5o"
|
|
1978
|
-
},
|
|
2331
|
+
}, gt = ({ width: e = 800, height: r = 500, particleCount: i = 60, linkDistance: a = 120, repelRadius: s = 150, color: c = "#38bdf8" }) => {
|
|
1979
2332
|
let d = o(null), f = o([]), p = o({
|
|
1980
2333
|
x: -1e3,
|
|
1981
2334
|
y: -1e3
|
|
@@ -2058,14 +2411,14 @@ var L = {
|
|
|
2058
2411
|
};
|
|
2059
2412
|
};
|
|
2060
2413
|
return /* @__PURE__ */ u("div", {
|
|
2061
|
-
className:
|
|
2414
|
+
className: ht.particleNetwork,
|
|
2062
2415
|
style: {
|
|
2063
2416
|
width: e,
|
|
2064
2417
|
height: r
|
|
2065
2418
|
},
|
|
2066
2419
|
children: [/* @__PURE__ */ l("canvas", {
|
|
2067
2420
|
ref: d,
|
|
2068
|
-
className:
|
|
2421
|
+
className: ht.canvas,
|
|
2069
2422
|
style: {
|
|
2070
2423
|
width: e,
|
|
2071
2424
|
height: r
|
|
@@ -2075,14 +2428,14 @@ var L = {
|
|
|
2075
2428
|
onTouchMove: _,
|
|
2076
2429
|
onTouchEnd: y
|
|
2077
2430
|
}), /* @__PURE__ */ l("p", {
|
|
2078
|
-
className:
|
|
2431
|
+
className: ht.hint,
|
|
2079
2432
|
children: "移动鼠标或手指与粒子互动"
|
|
2080
2433
|
})]
|
|
2081
2434
|
});
|
|
2082
|
-
},
|
|
2435
|
+
}, _t = {
|
|
2083
2436
|
plasmaBall: "cos-plasmaBall-xGHSj",
|
|
2084
2437
|
canvas: "cos-canvas-V1CgL"
|
|
2085
|
-
},
|
|
2438
|
+
}, vt = ({ width: e = 320, height: t = 320, color: r = "#a78bfa", arcCount: i = 8 }) => {
|
|
2086
2439
|
let a = o(null), s = o({
|
|
2087
2440
|
x: e / 2,
|
|
2088
2441
|
y: t / 2,
|
|
@@ -2143,38 +2496,38 @@ var L = {
|
|
|
2143
2496
|
t,
|
|
2144
2497
|
e
|
|
2145
2498
|
]), /* @__PURE__ */ l("div", {
|
|
2146
|
-
className:
|
|
2499
|
+
className: _t.plasmaBall,
|
|
2147
2500
|
style: {
|
|
2148
2501
|
width: e,
|
|
2149
2502
|
height: t
|
|
2150
2503
|
},
|
|
2151
2504
|
children: /* @__PURE__ */ l("canvas", {
|
|
2152
2505
|
ref: a,
|
|
2153
|
-
className:
|
|
2506
|
+
className: _t.canvas,
|
|
2154
2507
|
style: {
|
|
2155
2508
|
width: e,
|
|
2156
2509
|
height: t
|
|
2157
2510
|
}
|
|
2158
2511
|
})
|
|
2159
2512
|
});
|
|
2160
|
-
},
|
|
2513
|
+
}, yt = {
|
|
2161
2514
|
smokeFog: "cos-smokeFog-SYlts",
|
|
2162
2515
|
canvas: "cos-canvas-iOJV7"
|
|
2163
|
-
},
|
|
2516
|
+
}, bt = 10, U = 128, xt = "#d2d4d8", St = [
|
|
2164
2517
|
"#14151c",
|
|
2165
2518
|
"#1a1b24",
|
|
2166
2519
|
"#0e0f14"
|
|
2167
|
-
],
|
|
2520
|
+
], Ct = (e, t) => {
|
|
2168
2521
|
let n = Math.sin(e * 127.1 + t * 311.7) * 43758.5453;
|
|
2169
2522
|
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 =
|
|
2523
|
+
}, wt = (e, t) => {
|
|
2524
|
+
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 = Ct(n, r), l = Ct(n + 1, r), u = Ct(n, r + 1), d = Ct(n + 1, r + 1);
|
|
2172
2525
|
return c + (l - c) * o + (u - c) * s + (c - l - u + d) * o * s;
|
|
2173
|
-
},
|
|
2526
|
+
}, Tt = (e, t) => {
|
|
2174
2527
|
let n = 0, r = .5, i = 1;
|
|
2175
|
-
for (let a = 0; a < 4; a++) n += r *
|
|
2528
|
+
for (let a = 0; a < 4; a++) n += r * wt(e * i, t * i), i *= 2.05, r *= .5;
|
|
2176
2529
|
return n;
|
|
2177
|
-
},
|
|
2530
|
+
}, Et = (e, t) => {
|
|
2178
2531
|
let n = e.replace("#", "").trim(), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n;
|
|
2179
2532
|
if (r.length !== 6) return t;
|
|
2180
2533
|
let i = Number.parseInt(r, 16);
|
|
@@ -2183,48 +2536,48 @@ var L = {
|
|
|
2183
2536
|
i >> 8 & 255,
|
|
2184
2537
|
i & 255
|
|
2185
2538
|
];
|
|
2186
|
-
},
|
|
2539
|
+
}, Dt = (e, t, n) => [
|
|
2187
2540
|
Math.round(e[0] + (t[0] - e[0]) * n),
|
|
2188
2541
|
Math.round(e[1] + (t[1] - e[1]) * n),
|
|
2189
2542
|
Math.round(e[2] + (t[2] - e[2]) * n)
|
|
2190
|
-
],
|
|
2543
|
+
], Ot = (e, t = 1) => t >= 1 ? `rgb(${e[0]} ${e[1]} ${e[2]})` : `rgb(${e[0]} ${e[1]} ${e[2]} / ${t})`, kt = (e) => {
|
|
2191
2544
|
if (Array.isArray(e) && e.length >= 3) return [
|
|
2192
2545
|
e[0],
|
|
2193
2546
|
e[1],
|
|
2194
2547
|
e[2]
|
|
2195
2548
|
];
|
|
2196
|
-
let t =
|
|
2549
|
+
let t = Et(typeof e == "string" ? e : St[2], [
|
|
2197
2550
|
14,
|
|
2198
2551
|
15,
|
|
2199
2552
|
20
|
|
2200
|
-
]), n =
|
|
2553
|
+
]), n = Dt(t, [
|
|
2201
2554
|
255,
|
|
2202
2555
|
255,
|
|
2203
2556
|
255
|
|
2204
2557
|
], .06);
|
|
2205
2558
|
return [
|
|
2206
|
-
|
|
2559
|
+
Ot(Dt(t, [
|
|
2207
2560
|
255,
|
|
2208
2561
|
255,
|
|
2209
2562
|
255
|
|
2210
2563
|
], .1)),
|
|
2211
|
-
|
|
2212
|
-
|
|
2564
|
+
Ot(n),
|
|
2565
|
+
Ot(t)
|
|
2213
2566
|
];
|
|
2214
|
-
},
|
|
2567
|
+
}, At = (e, t) => {
|
|
2215
2568
|
let n = document.createElement("canvas");
|
|
2216
|
-
n.width =
|
|
2217
|
-
let r = n.getContext("2d"), i = r.createImageData(
|
|
2218
|
-
for (let n = 0; n <
|
|
2569
|
+
n.width = U, n.height = U;
|
|
2570
|
+
let r = n.getContext("2d"), i = r.createImageData(U, U), a = i.data, o = U / 2, s = U / 2, c = U * .48;
|
|
2571
|
+
for (let n = 0; n < U; n++) for (let r = 0; r < U; r++) {
|
|
2219
2572
|
let i = (r - o) / c, l = (n - s) / c, u = Math.hypot(i, l);
|
|
2220
2573
|
if (u > 1.15) continue;
|
|
2221
|
-
let d =
|
|
2574
|
+
let d = Tt(r * .045 + e * 17.1, n * .045 + e * 9.3) * .7 + Tt(r * .09 - e * 3.2, n * .09 + e * 5.7) * .3, f = u + (d - .45) * .55, p = 1 - Math.max(0, f);
|
|
2222
2575
|
if (p = Math.max(0, p) ** 1.35, p *= .55 + d * .7, p < .01) continue;
|
|
2223
|
-
let m = (n *
|
|
2576
|
+
let m = (n * U + r) * 4, h = .88 + d * .18;
|
|
2224
2577
|
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
2578
|
}
|
|
2226
2579
|
return r.putImageData(i, 0, 0), n;
|
|
2227
|
-
},
|
|
2580
|
+
}, jt = (e) => Array.from({ length: bt }, (t, n) => At(n + 1, e)), Mt = (e, t, n = 0) => {
|
|
2228
2581
|
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
2582
|
return {
|
|
2230
2583
|
x: Math.random() * e,
|
|
@@ -2239,19 +2592,19 @@ var L = {
|
|
|
2239
2592
|
age: i,
|
|
2240
2593
|
ageSpeed: 4e-4 + Math.random() * 65e-5,
|
|
2241
2594
|
opacity: o,
|
|
2242
|
-
sprite: Math.floor(Math.random() *
|
|
2595
|
+
sprite: Math.floor(Math.random() * bt),
|
|
2243
2596
|
stretch: .85 + Math.random() * .55 + n * .25,
|
|
2244
2597
|
receptivity: .5 + Math.random() * .85,
|
|
2245
2598
|
mass: .5 + Math.random() * .9,
|
|
2246
2599
|
phase: Math.random() * Math.PI * 2,
|
|
2247
2600
|
warmth: Math.random()
|
|
2248
2601
|
};
|
|
2249
|
-
},
|
|
2602
|
+
}, Nt = (e, t) => {
|
|
2250
2603
|
let n = Math.hypot(e.vx, e.vy);
|
|
2251
2604
|
if (n <= t) return;
|
|
2252
2605
|
let r = t / n;
|
|
2253
2606
|
e.vx *= r, e.vy *= r;
|
|
2254
|
-
},
|
|
2607
|
+
}, Pt = (e) => e < .06 ? e / .06 : e > .55 ? Math.max(0, 1 - (e - .55) / .45) : 1, Ft = (e, t) => .22 + Math.min(1, Math.max(0, e / t)) ** 1.15 * .78, It = ({ width: e = 800, height: r = 500, density: i = .5, color: a = xt, backgroundColor: s = St, speed: c = 1, disperseStrength: u = 1, disperseRadius: d = 1, interactive: f = !0 }) => {
|
|
2255
2608
|
let p = o(null), m = o([]), h = o([]), g = o(null), _ = o(""), b = o(0), x = o({
|
|
2256
2609
|
speed: c,
|
|
2257
2610
|
disperseStrength: u,
|
|
@@ -2277,14 +2630,14 @@ var L = {
|
|
|
2277
2630
|
a,
|
|
2278
2631
|
s
|
|
2279
2632
|
]), n(() => {
|
|
2280
|
-
g.current =
|
|
2633
|
+
g.current = jt(Et(a, [
|
|
2281
2634
|
210,
|
|
2282
2635
|
212,
|
|
2283
2636
|
216
|
|
2284
2637
|
])), _.current = a;
|
|
2285
2638
|
}, [a]), n(() => {
|
|
2286
2639
|
let t = Math.floor(56 + i * 100);
|
|
2287
|
-
m.current = Array.from({ length: t }, () =>
|
|
2640
|
+
m.current = Array.from({ length: t }, () => Mt(e, r, Math.random() ** 1.75));
|
|
2288
2641
|
}, [
|
|
2289
2642
|
i,
|
|
2290
2643
|
r,
|
|
@@ -2321,36 +2674,36 @@ var L = {
|
|
|
2321
2674
|
let i = t.getContext("2d");
|
|
2322
2675
|
if (!i) return;
|
|
2323
2676
|
i.setTransform(n, 0, 0, n, 0, 0);
|
|
2324
|
-
let a =
|
|
2677
|
+
let a = Et(x.current.color, [
|
|
2325
2678
|
210,
|
|
2326
2679
|
212,
|
|
2327
2680
|
216
|
|
2328
2681
|
]);
|
|
2329
|
-
g.current || (g.current =
|
|
2682
|
+
g.current || (g.current = jt(a), _.current = x.current.color);
|
|
2330
2683
|
let o = g.current, s = 0, c = document.hidden, l = v((e) => {
|
|
2331
2684
|
c = e;
|
|
2332
2685
|
}), u = typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, d = () => {
|
|
2333
|
-
let [t, n, a] =
|
|
2686
|
+
let [t, n, a] = kt(x.current.backgroundColor), o = i.createLinearGradient(0, 0, 0, r);
|
|
2334
2687
|
o.addColorStop(0, t), o.addColorStop(.45, n), o.addColorStop(1, a), i.fillStyle = o, i.fillRect(0, 0, e, r);
|
|
2335
|
-
let s =
|
|
2688
|
+
let s = Et(a, [
|
|
2336
2689
|
14,
|
|
2337
2690
|
15,
|
|
2338
2691
|
20
|
|
2339
|
-
]), c =
|
|
2692
|
+
]), c = Dt(s, [
|
|
2340
2693
|
255,
|
|
2341
2694
|
255,
|
|
2342
2695
|
255
|
|
2343
2696
|
], .22), l = i.createRadialGradient(e * .5, r * .75, 0, e * .5, r, e * .55);
|
|
2344
|
-
l.addColorStop(0,
|
|
2697
|
+
l.addColorStop(0, Ot(c, .35)), l.addColorStop(1, Ot(s, 0)), i.fillStyle = l, i.fillRect(0, 0, e, r);
|
|
2345
2698
|
}, f = (e) => {
|
|
2346
|
-
let t =
|
|
2699
|
+
let t = Pt(e.age) * Ft(e.y, r);
|
|
2347
2700
|
if (t <= .01) return;
|
|
2348
2701
|
let n = o[e.sprite], a = e.birthSize + (e.maxSize - e.birthSize) * Math.min(1, e.age * 1.15), s = e.size + (a - e.size) * .35, c = s, l = s * e.stretch;
|
|
2349
2702
|
i.save(), i.translate(e.x, e.y), i.rotate(e.rotation), i.globalAlpha = e.opacity * t * (.85 + e.warmth * .2), i.globalCompositeOperation = "screen", i.drawImage(n, -c / 2, -l / 2, c, l), i.restore();
|
|
2350
2703
|
}, S = () => {
|
|
2351
2704
|
if (b.current = requestAnimationFrame(S), c) return;
|
|
2352
2705
|
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 =
|
|
2706
|
+
s += .01 * Math.max(t, .001), d(), _.current !== x.current.color && (g.current = jt(Et(x.current.color, [
|
|
2354
2707
|
210,
|
|
2355
2708
|
212,
|
|
2356
2709
|
216
|
|
@@ -2365,7 +2718,7 @@ var L = {
|
|
|
2365
2718
|
let c = o / t.radius, l = Math.exp(-c * c * 2.2) * (1 - c * .35), u = Math.exp(-(((c - .72) / .32) ** 2)), d = l * .55 + u * .45, f = .72 + .28 * Math.sin(e.phase * 2.7 + s * 1.2 + o * .03), p = d * e.receptivity * f * i;
|
|
2366
2719
|
if (p < .02) continue;
|
|
2367
2720
|
let m = r / o, h = a / o, g = -h * t.swirl, _ = m * t.swirl, v = 1 / (.65 + e.mass * .7), y = Math.sin(e.phase * 4.2 + s * 1.6) * .35;
|
|
2368
|
-
e.vx += (m * .55 + g * .22 + y * .12) * p * v, e.vy += (h * .48 + _ * .22 - .06) * p * v, e.opacity *= 1 - p * .028, e.maxSize *= 1 + p * .02, e.stretch += p * .012, e.spin += y * p * .004,
|
|
2721
|
+
e.vx += (m * .55 + g * .22 + y * .12) * p * v, e.vy += (h * .48 + _ * .22 - .06) * p * v, e.opacity *= 1 - p * .028, e.maxSize *= 1 + p * .02, e.stretch += p * .012, e.spin += y * p * .004, Nt(e, 2.4 * Math.max(n, .35));
|
|
2369
2722
|
}
|
|
2370
2723
|
t.life *= .972, t.life < .04 && u.splice(e, 1);
|
|
2371
2724
|
}
|
|
@@ -2377,13 +2730,13 @@ var L = {
|
|
|
2377
2730
|
o.vx *= f, o.vy *= f, o.x += o.vx * t, o.y += o.vy * t, o.rotation += (o.spin + o.vx * .002) * t, o.age += o.ageSpeed * t;
|
|
2378
2731
|
let p = o.birthSize + (o.maxSize - o.birthSize) * Math.min(1, o.age * 1.15);
|
|
2379
2732
|
o.size += (p - o.size) * .04;
|
|
2380
|
-
let m = (.3 + o.warmth * .1) *
|
|
2733
|
+
let m = (.3 + o.warmth * .1) * Ft(o.y, r), h = .006 + .008 * Math.max(0, 1 - d / 2.2);
|
|
2381
2734
|
if (o.opacity += (m - o.opacity) * h, o.stretch += (1.05 + (1 - o.y / r) * .55 - o.stretch) * .01, o.age >= 1 || o.y < -o.size || o.opacity < .02) {
|
|
2382
|
-
l[n] =
|
|
2735
|
+
l[n] = Mt(e, r, 0);
|
|
2383
2736
|
continue;
|
|
2384
2737
|
}
|
|
2385
2738
|
o.x < -o.size && (o.x = e + o.size * .5), o.x > e + o.size && (o.x = -o.size * .5);
|
|
2386
|
-
let g =
|
|
2739
|
+
let g = Pt(o.age) * Ft(o.y, r);
|
|
2387
2740
|
if (g <= .01) continue;
|
|
2388
2741
|
let _ = a[o.sprite], v = o.birthSize + (o.maxSize - o.birthSize) * Math.min(1, o.age * 1.15), y = o.size + (v - o.size) * .35, b = y, x = y * o.stretch;
|
|
2389
2742
|
i.save(), i.translate(o.x, o.y), i.rotate(o.rotation), i.globalAlpha = o.opacity * g * (.85 + o.warmth * .2), i.globalCompositeOperation = "screen", i.drawImage(_, -b / 2, -x / 2, b, x), i.restore();
|
|
@@ -2401,14 +2754,14 @@ var L = {
|
|
|
2401
2754
|
cancelAnimationFrame(b.current), l();
|
|
2402
2755
|
};
|
|
2403
2756
|
}, [r, e]), /* @__PURE__ */ l("div", {
|
|
2404
|
-
className:
|
|
2757
|
+
className: yt.smokeFog,
|
|
2405
2758
|
style: {
|
|
2406
2759
|
width: e,
|
|
2407
2760
|
height: r
|
|
2408
2761
|
},
|
|
2409
2762
|
children: /* @__PURE__ */ l("canvas", {
|
|
2410
2763
|
ref: p,
|
|
2411
|
-
className:
|
|
2764
|
+
className: yt.canvas,
|
|
2412
2765
|
style: {
|
|
2413
2766
|
width: e,
|
|
2414
2767
|
height: r,
|
|
@@ -2418,10 +2771,435 @@ var L = {
|
|
|
2418
2771
|
"aria-label": f ? "烟雾背景,点击可驱散" : "烟雾背景"
|
|
2419
2772
|
})
|
|
2420
2773
|
});
|
|
2421
|
-
},
|
|
2774
|
+
}, Lt = .82, Rt = .08, zt = 1e3 / 60, Bt = 46 * 2.6, Vt = () => ({
|
|
2775
|
+
x: -1e3,
|
|
2776
|
+
y: -1e3,
|
|
2777
|
+
prevX: -1e3,
|
|
2778
|
+
prevY: -1e3,
|
|
2779
|
+
vx: 0,
|
|
2780
|
+
vy: 0,
|
|
2781
|
+
speed: 0,
|
|
2782
|
+
active: !1,
|
|
2783
|
+
lastTs: 0
|
|
2784
|
+
}), Ht = (e) => e < .5 ? 2 * e * e : 1 - (-2 * e + 2) ** 2 / 2, Ut = (e) => 1 - (1 - e) ** 3, Wt = (e, t, n) => {
|
|
2785
|
+
let r = Math.min(1, Math.max(0, (n - e) / (t - e)));
|
|
2786
|
+
return r * r * (3 - 2 * r);
|
|
2787
|
+
}, W = (e, t) => e ** t, Gt = (e) => {
|
|
2788
|
+
let t = Math.sin(e * 127.1 + 311.7) * 43758.5453;
|
|
2789
|
+
return t - Math.floor(t);
|
|
2790
|
+
}, Kt = (e, t, n = !0) => {
|
|
2791
|
+
let r = .18 + (e / 18) ** .5 * .52, i = n ? .8 + Math.random() * .35 : 1;
|
|
2792
|
+
return r * t * i;
|
|
2793
|
+
}, G = (e, t, n, r, i) => {
|
|
2794
|
+
let a = e.createRadialGradient(t, n, 0, t, n, r);
|
|
2795
|
+
for (let [e, t] of i) a.addColorStop(e, t);
|
|
2796
|
+
e.fillStyle = a, e.beginPath(), e.arc(t, n, r, 0, Math.PI * 2), e.fill();
|
|
2797
|
+
}, qt = (e, t, n, r, i, a, o) => {
|
|
2798
|
+
e.save(), e.translate(t, n), e.rotate(r), e.scale(a, 1);
|
|
2799
|
+
let s = e.createRadialGradient(0, 0, 0, 0, i * .15, i);
|
|
2800
|
+
s.addColorStop(0, `rgb(170 220 240 / ${o * 100}%)`), s.addColorStop(.2, `rgb(90 170 200 / ${o * 45}%)`), s.addColorStop(.55, `rgb(40 110 150 / ${o * 12}%)`), s.addColorStop(1, "rgb(10 40 60 / 0%)"), e.fillStyle = s, e.beginPath(), e.arc(0, i * .15, i, 0, Math.PI * 2), e.fill(), e.restore();
|
|
2801
|
+
}, Jt = (e, t, n, r, i) => {
|
|
2802
|
+
let a = Math.min(70, Math.floor(t * n / 22e3));
|
|
2803
|
+
for (let o = 0; o < a; o++) {
|
|
2804
|
+
let a = Gt(o + 1), s = Gt(o + 57), c = Gt(o + 131), l = .3 + c * 1.1, u = 5 + s * 16, d = Math.sin(r * (.1 + a * .28) + o * .7) * (5 + s * 14), f = (a * t + r * (1.5 + c * 5) + d) % (t + 24) - 12, p = (s * n + r * u * .22) % (n + 24) - 12, m = Math.min(1, Math.max(0, p / n)), h = (.02 + c * .07) * (.35 + m * .55), g = l * 4.4;
|
|
2805
|
+
e.globalAlpha = h, e.drawImage(i, f - g * .5, p - g * .5, g, g);
|
|
2806
|
+
}
|
|
2807
|
+
e.globalAlpha = 1;
|
|
2808
|
+
}, Yt = (e, t, n, r) => {
|
|
2809
|
+
let i = e.createLinearGradient(0, 0, 0, n);
|
|
2810
|
+
i.addColorStop(0, "#0c4558"), i.addColorStop(.08, "#0a3c50"), i.addColorStop(.18, "#083445"), i.addColorStop(.32, "#062a38"), i.addColorStop(.48, "#041f2b"), i.addColorStop(.64, "#03161f"), i.addColorStop(.8, "#020e15"), i.addColorStop(.92, "#01080c"), i.addColorStop(1, "#000406"), e.fillStyle = i, e.fillRect(0, 0, t, n), G(e, t * .55, -n * .05, n * 1.05, [
|
|
2811
|
+
[0, "rgb(150 215 235 / 26%)"],
|
|
2812
|
+
[.18, "rgb(80 170 200 / 14%)"],
|
|
2813
|
+
[.4, `${r}12`],
|
|
2814
|
+
[.65, "rgb(30 90 120 / 4%)"],
|
|
2815
|
+
[1, "rgb(5 20 30 / 0%)"]
|
|
2816
|
+
]), G(e, t * .18, n * .12, t * .7, [
|
|
2817
|
+
[0, "rgb(70 150 175 / 8%)"],
|
|
2818
|
+
[.45, "rgb(30 90 120 / 3%)"],
|
|
2819
|
+
[1, "rgb(10 30 45 / 0%)"]
|
|
2820
|
+
]), G(e, t * .88, n * .22, t * .55, [
|
|
2821
|
+
[0, "rgb(50 120 150 / 6%)"],
|
|
2822
|
+
[.5, "rgb(20 70 100 / 2%)"],
|
|
2823
|
+
[1, "rgb(5 20 30 / 0%)"]
|
|
2824
|
+
]);
|
|
2825
|
+
for (let r = 0; r < 4; r++) {
|
|
2826
|
+
let i = Gt(r + 3), a = Gt(r + 11);
|
|
2827
|
+
G(e, t * (.2 + i * .6), n * (.28 + a * .4), n * (.28 + a * .18), [
|
|
2828
|
+
[0, `rgb(25 70 95 / ${4 + i * 3}%)`],
|
|
2829
|
+
[.5, `rgb(15 45 65 / ${2 + a * 2}%)`],
|
|
2830
|
+
[1, "rgb(5 20 30 / 0%)"]
|
|
2831
|
+
]);
|
|
2832
|
+
}
|
|
2833
|
+
let a = e.createLinearGradient(0, 0, 0, n);
|
|
2834
|
+
a.addColorStop(0, "rgb(0 10 16 / 0%)"), a.addColorStop(.35, "rgb(0 8 14 / 6%)"), a.addColorStop(.65, "rgb(0 5 10 / 22%)"), a.addColorStop(.85, "rgb(0 3 7 / 42%)"), a.addColorStop(1, "rgb(0 1 3 / 62%)"), e.fillStyle = a, e.fillRect(0, 0, t, n), G(e, t * .5, n * 1.05, n * .55, [
|
|
2835
|
+
[0, "rgb(0 2 5 / 70%)"],
|
|
2836
|
+
[.45, "rgb(0 4 8 / 35%)"],
|
|
2837
|
+
[1, "rgb(0 6 10 / 0%)"]
|
|
2838
|
+
]), G(e, t * .28, n * 1.02, t * .4, [[0, "rgb(0 3 6 / 28%)"], [1, "rgb(0 3 6 / 0%)"]]), G(e, t * .75, n * 1.04, t * .35, [[0, "rgb(0 2 5 / 24%)"], [1, "rgb(0 2 5 / 0%)"]]);
|
|
2839
|
+
let o = e.createRadialGradient(t * .5, n * .4, Math.min(t, n) * .35, t * .5, n * .48, Math.max(t, n) * .78);
|
|
2840
|
+
o.addColorStop(0, "rgb(0 0 0 / 0%)"), o.addColorStop(.55, "rgb(0 6 10 / 6%)"), o.addColorStop(.8, "rgb(0 3 6 / 18%)"), o.addColorStop(1, "rgb(0 1 3 / 36%)"), e.fillStyle = o, e.fillRect(0, 0, t, n);
|
|
2841
|
+
}, Xt = (e, t, n, r, i, a) => {
|
|
2842
|
+
let o = t * (.55 + Math.sin(r * .07) * .03);
|
|
2843
|
+
e.save(), e.globalCompositeOperation = "screen";
|
|
2844
|
+
for (let i = 0; i < 5; i++) {
|
|
2845
|
+
let o = r * .11 + i * 1.35, s = t * (.22 + i * .14) + Math.sin(o) * t * (a ? .015 : .04), c = .12 + Math.sin(o * .6 + i) * (a ? .02 : .05), l = .045 + i % 3 * .012 + Math.sin(r * .2 + i) * .008;
|
|
2846
|
+
qt(e, s, -n * .02, c, n * (.7 + i % 2 * .12), .12 + i % 3 * .04, l);
|
|
2847
|
+
}
|
|
2848
|
+
qt(e, o + t * .02, -n * .04, .08 + Math.sin(r * .09) * (a ? .012 : .03), n * .78, .2, .07 + Math.sin(r * .15) * .012), e.restore(), Jt(e, t, n, r, i);
|
|
2849
|
+
}, Zt = () => {
|
|
2850
|
+
let e = document.createElement("canvas");
|
|
2851
|
+
e.width = 48, e.height = 48;
|
|
2852
|
+
let t = e.getContext("2d");
|
|
2853
|
+
if (!t) return e;
|
|
2854
|
+
let n = t.createRadialGradient(48 / 2, 48 / 2, 0, 48 / 2, 48 / 2, 48 / 2);
|
|
2855
|
+
return n.addColorStop(0, "rgb(220 240 250 / 90%)"), n.addColorStop(.3, "rgb(180 220 240 / 42%)"), n.addColorStop(1, "rgb(180 220 240 / 0%)"), t.fillStyle = n, t.beginPath(), t.arc(48 / 2, 48 / 2, 48 / 2, 0, Math.PI * 2), t.fill(), e;
|
|
2856
|
+
}, Qt = (e, t) => e.find((e) => e.id === t), $t = (e) => {
|
|
2857
|
+
let t = e.progress, n = Ht(Wt(0, .72, t)), r = Ut(Wt(.28, 1, t)), i = e.startSecondaryX - e.startPrimaryX, a = e.startSecondaryY - e.startPrimaryY, o = Math.hypot(i, a) || 1, s = i / o, c = a / o, l = e.startPrimaryRadius, u = e.startSecondaryRadius, d = l + u, f = d * (1 - n), p = e.startPrimaryX + s * (d - f) * (u / (l + u)), m = e.startPrimaryY + c * (d - f) * (u / (l + u)), h = p + s * f, g = m + c * f;
|
|
2858
|
+
return {
|
|
2859
|
+
ax: p,
|
|
2860
|
+
ay: m,
|
|
2861
|
+
ar: l + (e.targetRadius - l) * r,
|
|
2862
|
+
bx: h,
|
|
2863
|
+
by: g,
|
|
2864
|
+
br: Math.max(.8, u * (1 - r * .97)),
|
|
2865
|
+
approach: n,
|
|
2866
|
+
absorb: r
|
|
2867
|
+
};
|
|
2868
|
+
}, en = (e, t) => {
|
|
2869
|
+
let n = /* @__PURE__ */ new Map();
|
|
2870
|
+
for (let t of e) {
|
|
2871
|
+
let e = `${Math.floor(t.x / Bt)},${Math.floor(t.y / Bt)}`, r = n.get(e);
|
|
2872
|
+
r ? r.push(t) : n.set(e, [t]);
|
|
2873
|
+
}
|
|
2874
|
+
for (let r of e) {
|
|
2875
|
+
let e = Math.floor(r.x / Bt), i = Math.floor(r.y / Bt);
|
|
2876
|
+
for (let a = -1; a <= 1; a++) for (let o = -1; o <= 1; o++) {
|
|
2877
|
+
let s = n.get(`${e + a},${i + o}`);
|
|
2878
|
+
if (s) for (let e of s) e.id <= r.id || t(r, e);
|
|
2879
|
+
}
|
|
2880
|
+
}
|
|
2881
|
+
}, tn = (e) => {
|
|
2882
|
+
en(e, (e, t) => {
|
|
2883
|
+
let n = t.x - e.x, r = t.y - e.y, i = Math.hypot(n, r) || 1, a = i - (e.radius + t.radius), o = Math.min(8, (e.radius + t.radius) * .14);
|
|
2884
|
+
if (a > o || a < 0) return;
|
|
2885
|
+
let s = (1 - a / o) * .01, c = n / i, l = r / i;
|
|
2886
|
+
e.vx += c * s, e.vy += l * s * .55, t.vx -= c * s, t.vy -= l * s * .55;
|
|
2887
|
+
});
|
|
2888
|
+
}, nn = (e, t, n) => {
|
|
2889
|
+
en(e, (e, r) => {
|
|
2890
|
+
if (n.has(e.id) || n.has(r.id) || Math.hypot(e.x - r.x, e.y - r.y) > e.radius + r.radius - Math.min(e.radius, r.radius) * .12) return;
|
|
2891
|
+
let i = e.radius >= r.radius ? e : r, a = e.radius >= r.radius ? r : e, o = Math.min(46, Math.cbrt(i.radius ** 3 + a.radius ** 3));
|
|
2892
|
+
t.push({
|
|
2893
|
+
primaryId: i.id,
|
|
2894
|
+
secondaryId: a.id,
|
|
2895
|
+
progress: 0,
|
|
2896
|
+
targetRadius: o,
|
|
2897
|
+
startPrimaryRadius: i.radius,
|
|
2898
|
+
startSecondaryRadius: a.radius,
|
|
2899
|
+
startPrimaryX: i.x,
|
|
2900
|
+
startPrimaryY: i.y,
|
|
2901
|
+
startSecondaryX: a.x,
|
|
2902
|
+
startSecondaryY: a.y
|
|
2903
|
+
}), n.add(i.id), n.add(a.id);
|
|
2904
|
+
});
|
|
2905
|
+
}, rn = (e, t, n, r) => {
|
|
2906
|
+
let i = [];
|
|
2907
|
+
for (let a = 0; a < t.length; a++) {
|
|
2908
|
+
let o = t[a], s = Qt(e, o.primaryId), c = Qt(e, o.secondaryId);
|
|
2909
|
+
if (!s || !c) {
|
|
2910
|
+
i.push(a);
|
|
2911
|
+
continue;
|
|
2912
|
+
}
|
|
2913
|
+
o.progress = Math.min(1, o.progress + .018 * r);
|
|
2914
|
+
let l = (s.vy + c.vy) * .5 - .12, u = (s.vx + c.vx) * .5;
|
|
2915
|
+
o.startPrimaryX += u * r, o.startPrimaryY += l * r, o.startSecondaryX += u * r, o.startSecondaryY += l * r;
|
|
2916
|
+
let d = $t(o);
|
|
2917
|
+
if (o.pose = d, s.x = d.ax, s.y = d.ay, s.radius = d.ar, c.x = d.bx, c.y = d.by, c.radius = d.br, s.vx = u, s.vy = l, c.vx = u, c.vy = l, o.progress >= 1) {
|
|
2918
|
+
s.x = (d.ax * d.ar + d.bx * d.br) / Math.max(1, d.ar + d.br), s.y = (d.ay * d.ar + d.by * d.br) / Math.max(1, d.ar + d.br), s.radius = o.targetRadius, s.terminalRise = Math.min(2.2, Kt(s.radius, n, !1) * 1.04), s.settle = .7, s.aspect = .94;
|
|
2919
|
+
let t = e.findIndex((e) => e.id === c.id);
|
|
2920
|
+
t >= 0 && e.splice(t, 1), i.push(a);
|
|
2921
|
+
}
|
|
2922
|
+
}
|
|
2923
|
+
for (let e = i.length - 1; e >= 0; e--) t.splice(i[e], 1);
|
|
2924
|
+
}, an = (e, t, n, r, i = !1) => {
|
|
2925
|
+
let a = i ? 2.5 + Math.random() * 9 : 4 + Math.random() * (Math.random() < .25 ? 18 : 10), o = a + 8, s = Kt(a, r), c = a < 10 ? .985 + Math.random() * .02 : .96 + Math.random() * .03;
|
|
2926
|
+
return {
|
|
2927
|
+
id: e,
|
|
2928
|
+
x: o + Math.random() * Math.max(1, t - o * 2),
|
|
2929
|
+
y: n + a + Math.random() * (i ? 120 : 36),
|
|
2930
|
+
radius: a,
|
|
2931
|
+
terminalRise: s,
|
|
2932
|
+
drift: (Math.random() - .5) * .22,
|
|
2933
|
+
vx: (Math.random() - .5) * .15,
|
|
2934
|
+
vy: -s * (.04 + Math.random() * .14),
|
|
2935
|
+
phase: Math.random() * Math.PI * 2,
|
|
2936
|
+
alpha: .42 + Math.random() * .38,
|
|
2937
|
+
aspect: c,
|
|
2938
|
+
deformAmp: .008 + Math.random() * .012 + Math.min(.015, a * 6e-4),
|
|
2939
|
+
deformPhase: Math.random() * Math.PI * 2,
|
|
2940
|
+
deformSpeed: .7 + Math.random() * .5,
|
|
2941
|
+
tilt: Math.random() * Math.PI * 2,
|
|
2942
|
+
pulseBoost: 0,
|
|
2943
|
+
streamStretch: 0,
|
|
2944
|
+
streamAngle: 0,
|
|
2945
|
+
mode2: 0,
|
|
2946
|
+
mode2Vel: 0,
|
|
2947
|
+
mode2Angle: Math.random() * Math.PI,
|
|
2948
|
+
mode3: 0,
|
|
2949
|
+
mode3Vel: 0,
|
|
2950
|
+
mode3Phase: Math.random() * Math.PI * 2,
|
|
2951
|
+
settle: 0
|
|
2952
|
+
};
|
|
2953
|
+
}, on = (e, t, n) => ({
|
|
2954
|
+
x: Math.sin(t * .009 + n * .48) * .12 + Math.cos(e * .006 - n * .32) * .09,
|
|
2955
|
+
y: Math.cos(e * .008 + n * .38) * .05
|
|
2956
|
+
}), sn = (e, t, n, r, i) => {
|
|
2957
|
+
let a = 1 + (1 - Math.min(1, Math.max(0, e.y / n))) * .12, o = (e.terminalRise * r * a - -e.vy) * (.022 + e.radius * .0011);
|
|
2958
|
+
e.vy -= o * i;
|
|
2959
|
+
let s = .03 + e.radius * .0025, c = Math.sin(t * (1.1 + e.deformSpeed) + e.phase) * s + Math.sin(t * 2.1 + e.deformPhase) * s * .35;
|
|
2960
|
+
e.vy -= c * .02 * i;
|
|
2961
|
+
let l = Math.sin(t * .85 + e.deformPhase) * (.05 + e.radius * .003) + Math.cos(t * .5 + e.phase) * .03;
|
|
2962
|
+
e.vx += l * .015 * i;
|
|
2963
|
+
let u = on(e.x, e.y, t);
|
|
2964
|
+
e.vx += (e.drift * .015 + u.x * .05) * i, e.vy += u.y * .025 * i, e.vx *= W(.968, i), e.vy *= W(.994, i), e.x += (e.vx + u.x * .22) * i, e.y += e.vy * i;
|
|
2965
|
+
}, cn = (e, t, n, r, i, a, o) => {
|
|
2966
|
+
let s = e - n, c = t - r, l = Math.hypot(s, c) || 1, u = 70 + Math.min(140, o * 3.8), d = l / u;
|
|
2967
|
+
if (d > 1.35) return {
|
|
2968
|
+
fx: 0,
|
|
2969
|
+
fy: 0,
|
|
2970
|
+
strain: 0,
|
|
2971
|
+
strainAngle: 0,
|
|
2972
|
+
excite: 0
|
|
2973
|
+
};
|
|
2974
|
+
let f = Math.exp(-d * d * 2.1), p = s / l, m = c / l, h = Math.max(.001, Math.hypot(i, a)), g = i / h, _ = a / h, v = -_, y = g, b = s * v + c * y, x = s * g + c * _, S = f * Math.min(1.15, o / 22), C = x < 0 ? 1.35 : .72, w = f * Math.min(1, o / 18) * Math.tanh(b / (u * .35)), T = f * Math.min(.85, o / 30) * (1 - Math.abs(x) / (u + 1)), E = g * S * 1.55 * C + v * w * 1.25 + p * T * .55, D = _ * S * 1.55 * C + y * w * 1.25 + m * T * .55;
|
|
2975
|
+
return {
|
|
2976
|
+
fx: E,
|
|
2977
|
+
fy: D,
|
|
2978
|
+
strain: f * Math.min(1, o / 16) * (.55 + Math.abs(w) * .45),
|
|
2979
|
+
strainAngle: Math.atan2(D + _ * .4, E + g * .4),
|
|
2980
|
+
excite: f * Math.min(1.2, o / 14)
|
|
2981
|
+
};
|
|
2982
|
+
}, ln = (e, t) => {
|
|
2983
|
+
let n = .22 + 3.4 / Math.sqrt(Math.max(6, e.radius)), r = n * 1.55, i = .045 + e.radius * 9e-4, a = .055 + e.radius * .001;
|
|
2984
|
+
e.mode2Vel += (-n * n * e.mode2 - i * e.mode2Vel) * t, e.mode2 += e.mode2Vel * t, e.mode2 = Math.max(-1.1, Math.min(1.1, e.mode2)), e.mode2 *= W(.998, t), e.mode3Vel += (-r * r * e.mode3 - a * e.mode3Vel) * t, e.mode3 += e.mode3Vel * t, e.mode3 = Math.max(-.9, Math.min(.9, e.mode3)), e.mode3 *= W(.997, t), e.mode3Phase += (.04 + Math.abs(e.mode3Vel) * .8) * t, e.streamStretch *= W(.88, t), Math.abs(e.streamStretch) < .004 && (e.streamStretch = 0), Math.abs(e.mode2) < .002 && Math.abs(e.mode2Vel) < .002 && (e.mode2 = 0, e.mode2Vel = 0), Math.abs(e.mode3) < .002 && Math.abs(e.mode3Vel) < .002 && (e.mode3 = 0, e.mode3Vel = 0);
|
|
2985
|
+
}, un = (e, t, n, r, i, a) => {
|
|
2986
|
+
if (t < .02 && r < .02) return;
|
|
2987
|
+
let o = Math.min(.55, t * .65);
|
|
2988
|
+
e.streamStretch = e.streamStretch * (1 - o) + t * o, e.streamAngle = e.streamAngle * (1 - o) + n * o;
|
|
2989
|
+
let s = r * (.06 + Math.min(.05, e.radius * .0014));
|
|
2990
|
+
e.mode2Vel += s * (.75 + Math.random() * .85), e.mode2Angle = e.mode2Angle * .7 + n * .3, e.mode3Vel += s * .45 * (Math.random() - .3), e.pulseBoost = Math.min(1.35, e.pulseBoost + r * .08), e.tilt += (i * .002 - a * .0015) * r;
|
|
2991
|
+
}, dn = (e, t, n) => {
|
|
2992
|
+
let r = Math.sin(n * e.deformSpeed + e.deformPhase) * e.deformAmp + (Math.sin(t * 2 + e.phase + n * .4) * e.deformAmp * .55 + Math.sin(t * 3 + e.deformPhase) * e.deformAmp * .25) + e.pulseBoost * .035 + e.settle * .06;
|
|
2993
|
+
if (Math.abs(e.streamStretch) > .01) {
|
|
2994
|
+
let n = Math.cos(t - e.streamAngle), i = e.streamStretch * (.14 + Math.min(.08, e.radius * .0025));
|
|
2995
|
+
r += n * n * i, r -= (1 - n * n) * i * .55;
|
|
2996
|
+
}
|
|
2997
|
+
return Math.abs(e.mode2) > .002 && (r += e.mode2 * Math.cos(2 * (t - e.mode2Angle)) * .28), Math.abs(e.mode3) > .002 && (r += e.mode3 * Math.cos(3 * (t - e.mode3Phase)) * .16), e.radius * (1 + r);
|
|
2998
|
+
}, fn = (e, t) => {
|
|
2999
|
+
let n = e.x, r = e.y, i = e.aspect - e.settle * .04, a = e.tilt, o = Math.abs(e.streamStretch) * .7 + Math.abs(e.mode2) * .9 + Math.abs(e.mode3) * .35;
|
|
3000
|
+
if (o > .03) {
|
|
3001
|
+
let t = Math.min(1, o), n = e.streamStretch > .02 ? e.streamAngle : e.mode2Angle;
|
|
3002
|
+
a = a * (1 - t * .55) + n * t * .55, i -= Math.min(.12, e.streamStretch * .1 + Math.abs(e.mode2) * .08);
|
|
3003
|
+
}
|
|
3004
|
+
let s = Math.cos(a), c = Math.sin(a), l = new Path2D();
|
|
3005
|
+
for (let a = 0; a <= 48; a++) {
|
|
3006
|
+
let o = Math.PI * 2 * a / 48, u = dn(e, o, t), d = Math.cos(o) * u, f = Math.sin(o) * u * i, p = n + d * s - f * c, m = r + d * c + f * s;
|
|
3007
|
+
a === 0 ? l.moveTo(p, m) : l.lineTo(p, m);
|
|
3008
|
+
}
|
|
3009
|
+
return l.closePath(), l;
|
|
3010
|
+
}, pn = (e, t, n, r, i, a, o, s) => {
|
|
3011
|
+
let c = (e - n) * (e - n) + (t - r) * (t - r) + .35, l = (e - a) * (e - a) + (t - o) * (t - o) + .35;
|
|
3012
|
+
return i * i / c + s * s / l;
|
|
3013
|
+
}, mn = (e, t, n, r, i, a, o, s, c) => {
|
|
3014
|
+
let l = Math.cos(e), u = Math.sin(e), d = Math.hypot(t - s, n - c) + Math.hypot(i - s, a - c) + r + o + 8, f = 0, p = d;
|
|
3015
|
+
for (let e = 0; e < 14; e++) {
|
|
3016
|
+
let e = (f + p) * .5;
|
|
3017
|
+
pn(s + l * e, c + u * e, t, n, r, i, a, o) >= 1 ? f = e : p = e;
|
|
3018
|
+
}
|
|
3019
|
+
let m = (f + p) * .5;
|
|
3020
|
+
return {
|
|
3021
|
+
x: s + l * m,
|
|
3022
|
+
y: c + u * m
|
|
3023
|
+
};
|
|
3024
|
+
}, hn = (e, t, n, r, i, a) => {
|
|
3025
|
+
let o = n + a || 1, s = (e * n + r * a) / o, c = (t * n + i * a) / o, l = new Path2D();
|
|
3026
|
+
for (let o = 0; o <= 56; o++) {
|
|
3027
|
+
let u = mn(Math.PI * 2 * o / 56, e, t, n, r, i, a, s, c);
|
|
3028
|
+
o === 0 ? l.moveTo(u.x, u.y) : l.lineTo(u.x, u.y);
|
|
3029
|
+
}
|
|
3030
|
+
return l.closePath(), {
|
|
3031
|
+
path: l,
|
|
3032
|
+
cx: s,
|
|
3033
|
+
cy: c,
|
|
3034
|
+
radius: Math.max(n, a)
|
|
3035
|
+
};
|
|
3036
|
+
}, gn = (e, t, n, r, i, a) => {
|
|
3037
|
+
let o = fn(t, n), s = Math.min(1, Math.max(0, t.y / a)), c = i * Lt, l = a * Rt, u = Math.atan2(l - t.y, c - t.x), d = t.x + Math.cos(u) * t.radius * .38, f = t.y + Math.sin(u) * t.radius * .38, p = t.x - Math.cos(u) * t.radius * .42, m = t.y - Math.sin(u) * t.radius * .42, h = t.alpha * (.55 + (1 - s) * .55), g = e.createRadialGradient(d, f, t.radius * .04, t.x, t.y, t.radius * 1.45);
|
|
3038
|
+
g.addColorStop(0, "rgb(255 255 255 / 72%)"), g.addColorStop(.12, "rgb(186 230 253 / 42%)"), g.addColorStop(.35, `${r}30`), g.addColorStop(.62, "rgb(14 116 144 / 22%)"), g.addColorStop(.85, "rgb(2 12 27 / 48%)"), g.addColorStop(1, "rgb(1 4 12 / 78%)"), e.fillStyle = g, e.globalAlpha = h, e.fill(o), e.save(), e.clip(o);
|
|
3039
|
+
let _ = e.createRadialGradient(p, m, 0, p, m, t.radius * .95);
|
|
3040
|
+
_.addColorStop(0, "rgb(1 8 20 / 58%)"), _.addColorStop(.55, "rgb(2 12 27 / 28%)"), _.addColorStop(1, "rgb(2 12 27 / 0%)"), e.fillStyle = _, e.fillRect(t.x - t.radius * 1.2, t.y - t.radius * 1.2, t.radius * 2.4, t.radius * 2.4), e.beginPath(), e.ellipse(d, f, t.radius * .2, t.radius * .11, u - .25, 0, Math.PI * 2), e.fillStyle = "rgb(255 255 255 / 78%)", e.fill(), e.beginPath(), e.ellipse(t.x + Math.cos(u + .9) * t.radius * .15, t.y + Math.sin(u + .9) * t.radius * .15, t.radius * .07, t.radius * .04, u, 0, Math.PI * 2), e.fillStyle = "rgb(255 255 255 / 22%)", e.fill(), e.restore();
|
|
3041
|
+
let v = e.createRadialGradient(t.x, t.y, t.radius * .68, t.x, t.y, t.radius * 1.06);
|
|
3042
|
+
v.addColorStop(0, "rgb(255 255 255 / 0%)"), v.addColorStop(.5, "rgb(186 230 253 / 24%)"), v.addColorStop(1, "rgb(224 242 254 / 55%)"), e.strokeStyle = v, e.lineWidth = .8 + t.radius * .028, e.stroke(o), e.globalAlpha = 1;
|
|
3043
|
+
}, _n = (e, t, n, r, i, a, o, s, c, l, u) => {
|
|
3044
|
+
let d = hn(t, n, r, i, a, o), f = Math.min(1, Math.max(0, d.cy / l)), p = c * Lt, m = l * Rt, h = Math.atan2(m - d.cy, p - d.cx), g = d.cx + Math.cos(h) * d.radius * .32, _ = d.cy + Math.sin(h) * d.radius * .32, v = Math.hypot(t - i, n - a) + r + o, y = e.createRadialGradient(g, _, d.radius * .05, d.cx, d.cy, v * .75);
|
|
3045
|
+
y.addColorStop(0, "rgb(255 255 255 / 70%)"), y.addColorStop(.14, "rgb(186 230 253 / 40%)"), y.addColorStop(.4, `${s}32`), y.addColorStop(.75, "rgb(2 12 27 / 45%)"), y.addColorStop(1, "rgb(1 4 12 / 75%)"), e.fillStyle = y, e.globalAlpha = u * (.55 + (1 - f) * .5), e.fill(d.path), e.save(), e.clip(d.path), e.beginPath(), e.ellipse(g, _, d.radius * .22, d.radius * .12, h - .2, 0, Math.PI * 2), e.fillStyle = "rgb(255 255 255 / 72%)", e.fill(), e.restore(), e.strokeStyle = "rgb(224 242 254 / 42%)", e.lineWidth = 1 + d.radius * .02, e.stroke(d.path), e.globalAlpha = 1;
|
|
3046
|
+
}, vn = {
|
|
3047
|
+
bubbleField: "cos-bubbleField-i9211",
|
|
3048
|
+
canvas: "cos-canvas-8vKsT",
|
|
3049
|
+
hint: "cos-hint-I3R2H"
|
|
3050
|
+
}, yn = ({ width: e = 800, height: t = 500, bubbleCount: r = 36, speed: i = 1, color: s = "#7dd3fc", interactive: c = !0 }) => {
|
|
3051
|
+
let d = o(null), f = o([]), p = o([]), m = o(Vt()), h = o(0), g = o(0), _ = o(1), y = o(0), b = o(null), x = o(null), S = o({
|
|
3052
|
+
width: e,
|
|
3053
|
+
height: t,
|
|
3054
|
+
speed: i,
|
|
3055
|
+
color: s,
|
|
3056
|
+
interactive: c,
|
|
3057
|
+
bubbleCount: r
|
|
3058
|
+
});
|
|
3059
|
+
n(() => {
|
|
3060
|
+
S.current = {
|
|
3061
|
+
width: e,
|
|
3062
|
+
height: t,
|
|
3063
|
+
speed: i,
|
|
3064
|
+
color: s,
|
|
3065
|
+
interactive: c,
|
|
3066
|
+
bubbleCount: r
|
|
3067
|
+
};
|
|
3068
|
+
}, [
|
|
3069
|
+
e,
|
|
3070
|
+
t,
|
|
3071
|
+
i,
|
|
3072
|
+
s,
|
|
3073
|
+
c,
|
|
3074
|
+
r
|
|
3075
|
+
]), n(() => {
|
|
3076
|
+
f.current = Array.from({ length: r }, () => {
|
|
3077
|
+
let n = an(_.current++, e, t, i, !0);
|
|
3078
|
+
return n.y = t * (.15 + Math.random() * .85), n.vy = -n.terminalRise * (.35 + Math.random() * .35), n;
|
|
3079
|
+
}), p.current = [], m.current = Vt(), h.current = 0, g.current = 0, y.current = 0;
|
|
3080
|
+
}, [
|
|
3081
|
+
r,
|
|
3082
|
+
t,
|
|
3083
|
+
i,
|
|
3084
|
+
e
|
|
3085
|
+
]), n(() => {
|
|
3086
|
+
let n = d.current;
|
|
3087
|
+
if (!n) return;
|
|
3088
|
+
let r = Math.min(window.devicePixelRatio || 1, 2);
|
|
3089
|
+
n.width = Math.floor(e * r), n.height = Math.floor(t * r);
|
|
3090
|
+
let i = n.getContext("2d");
|
|
3091
|
+
if (!i) return;
|
|
3092
|
+
i.setTransform(r, 0, 0, r, 0, 0);
|
|
3093
|
+
let a = typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
3094
|
+
x.current ||= Zt();
|
|
3095
|
+
let o = x.current, s = 0, c = 0, l = document.hidden, u = v((e) => {
|
|
3096
|
+
l = e;
|
|
3097
|
+
}), C = (r, i) => {
|
|
3098
|
+
let a = n.getBoundingClientRect(), o = e / Math.max(a.width, 1), s = t / Math.max(a.height, 1);
|
|
3099
|
+
return {
|
|
3100
|
+
x: (r - a.left) * o,
|
|
3101
|
+
y: (i - a.top) * s
|
|
3102
|
+
};
|
|
3103
|
+
}, w = (e, t) => {
|
|
3104
|
+
if (!S.current.interactive) return;
|
|
3105
|
+
let { x: n, y: r } = C(e, t), i = m.current, a = performance.now(), o = i.lastTs > 0 ? Math.max(1, a - i.lastTs) : 16;
|
|
3106
|
+
if (i.active) {
|
|
3107
|
+
let e = n - i.x, t = r - i.y, a = 16 / o, s = e * a, c = t * a, l = Math.hypot(s, c);
|
|
3108
|
+
i.vx = i.vx * .55 + s * .45, i.vy = i.vy * .55 + c * .45, i.speed = i.speed * .55 + l * .45;
|
|
3109
|
+
} else i.vx = 0, i.vy = 0, i.speed = 0;
|
|
3110
|
+
i.prevX = i.x, i.prevY = i.y, i.x = n, i.y = r, i.active = !0, i.lastTs = a;
|
|
3111
|
+
}, T = () => {
|
|
3112
|
+
m.current = Vt();
|
|
3113
|
+
}, E = (e) => {
|
|
3114
|
+
w(e.clientX, e.clientY);
|
|
3115
|
+
}, D = (e) => {
|
|
3116
|
+
w(e.clientX, e.clientY);
|
|
3117
|
+
}, O = (e) => {
|
|
3118
|
+
w(e.clientX, e.clientY);
|
|
3119
|
+
};
|
|
3120
|
+
n.addEventListener("pointermove", E), n.addEventListener("pointerenter", D), n.addEventListener("pointerdown", O), n.addEventListener("pointerleave", T);
|
|
3121
|
+
let k = (u = 0) => {
|
|
3122
|
+
if (c = requestAnimationFrame(k), l) return;
|
|
3123
|
+
s ||= u;
|
|
3124
|
+
let d = Math.min(40, Math.max(8, u - s || 16.666666666666668));
|
|
3125
|
+
s = u;
|
|
3126
|
+
let v = d / zt, x = d / 1e3;
|
|
3127
|
+
h.current += x * (a ? .6 : 1);
|
|
3128
|
+
let C = h.current, { color: w, speed: T, bubbleCount: E, interactive: D } = S.current, O = `${e}x${t}@${r}:${w}`;
|
|
3129
|
+
if (b.current?.key !== O) {
|
|
3130
|
+
let i = document.createElement("canvas");
|
|
3131
|
+
i.width = n.width, i.height = n.height;
|
|
3132
|
+
let a = i.getContext("2d");
|
|
3133
|
+
a && (a.setTransform(r, 0, 0, r, 0, 0), Yt(a, e, t, w), b.current = {
|
|
3134
|
+
key: O,
|
|
3135
|
+
canvas: i
|
|
3136
|
+
});
|
|
3137
|
+
}
|
|
3138
|
+
b.current && i.drawImage(b.current.canvas, 0, 0, e, t), Xt(i, e, t, C, o, a), g.current += x, g.current > .2 && f.current.length < E && (g.current = 0, f.current.push(an(_.current++, e, t, T)));
|
|
3139
|
+
let A = m.current;
|
|
3140
|
+
A.active && (A.speed *= W(.94, v), A.vx *= W(.94, v), A.vy *= W(.94, v));
|
|
3141
|
+
let j = /* @__PURE__ */ new Set();
|
|
3142
|
+
for (let e of p.current) j.add(e.primaryId), j.add(e.secondaryId);
|
|
3143
|
+
for (let n of f.current) {
|
|
3144
|
+
if (n.phase += .008 * v, n.tilt += Math.sin(C * .2 + n.deformPhase) * .0012 * v, n.pulseBoost *= W(.92, v), n.settle *= W(.93, v), n.settle > 0 && (n.aspect += (.985 - n.aspect) * .08 * v), n.settle < .01 && (n.settle = 0), j.has(n.id)) ln(n, v);
|
|
3145
|
+
else {
|
|
3146
|
+
sn(n, C, t, T, v), ln(n, v);
|
|
3147
|
+
let e = Math.hypot(n.vx, n.vy + n.terminalRise * .35);
|
|
3148
|
+
if (e > .55) {
|
|
3149
|
+
let t = Math.atan2(n.vy, n.vx);
|
|
3150
|
+
n.streamStretch = Math.min(.85, n.streamStretch * W(.9, v) + Math.min(.35, (e - .55) * .08) * v), n.streamAngle = n.streamAngle * W(.85, v) + t * (1 - W(.85, v));
|
|
3151
|
+
}
|
|
3152
|
+
}
|
|
3153
|
+
if (D && A.active && A.speed > .2 && !j.has(n.id)) {
|
|
3154
|
+
let e = cn(n.x, n.y, A.x, A.y, A.vx, A.vy, A.speed);
|
|
3155
|
+
if (e.excite > .01 || Math.hypot(e.fx, e.fy) > .01) {
|
|
3156
|
+
let t = 1 / (.75 + n.radius * .035), r = a ? .55 : 1;
|
|
3157
|
+
n.vx += e.fx * t * v * r, n.vy += e.fy * t * .82 * v * r, un(n, e.strain, e.strainAngle, e.excite, e.fx, e.fy);
|
|
3158
|
+
}
|
|
3159
|
+
}
|
|
3160
|
+
if (n.y + n.radius < -12) {
|
|
3161
|
+
let r = an(_.current++, e, t, T);
|
|
3162
|
+
Object.assign(n, r, { y: t + r.radius + y.current++ * .01 });
|
|
3163
|
+
}
|
|
3164
|
+
n.x < -n.radius * 1.5 && (n.x = e + n.radius), n.x > e + n.radius * 1.5 && (n.x = -n.radius);
|
|
3165
|
+
}
|
|
3166
|
+
let M = f.current.filter((e) => !j.has(e.id));
|
|
3167
|
+
tn(M), nn(M, p.current, j), rn(f.current, p.current, T, v), j.clear();
|
|
3168
|
+
for (let e of p.current) j.add(e.primaryId), j.add(e.secondaryId);
|
|
3169
|
+
for (let n of p.current) {
|
|
3170
|
+
let r = n.pose ?? $t(n), a = Math.min(.9, .55 + r.absorb * .2);
|
|
3171
|
+
_n(i, r.ax, r.ay, r.ar, r.bx, r.by, r.br, w, e, t, a);
|
|
3172
|
+
}
|
|
3173
|
+
let N = [...f.current].sort((e, t) => t.y - e.y);
|
|
3174
|
+
for (let n of N) j.has(n.id) || gn(i, n, C, w, e, t);
|
|
3175
|
+
};
|
|
3176
|
+
return k(), () => {
|
|
3177
|
+
cancelAnimationFrame(c), n.removeEventListener("pointermove", E), n.removeEventListener("pointerenter", D), n.removeEventListener("pointerdown", O), n.removeEventListener("pointerleave", T), u();
|
|
3178
|
+
};
|
|
3179
|
+
}, [t, e]);
|
|
3180
|
+
let C = a(() => c ? "海底气泡上升 · 划过扰动水流" : "海底气泡上升", [c]);
|
|
3181
|
+
return /* @__PURE__ */ u("div", {
|
|
3182
|
+
className: vn.bubbleField,
|
|
3183
|
+
style: {
|
|
3184
|
+
width: e,
|
|
3185
|
+
height: t
|
|
3186
|
+
},
|
|
3187
|
+
children: [/* @__PURE__ */ l("canvas", {
|
|
3188
|
+
ref: d,
|
|
3189
|
+
className: vn.canvas,
|
|
3190
|
+
style: {
|
|
3191
|
+
width: e,
|
|
3192
|
+
height: t
|
|
3193
|
+
}
|
|
3194
|
+
}), /* @__PURE__ */ l("div", {
|
|
3195
|
+
className: vn.hint,
|
|
3196
|
+
children: C
|
|
3197
|
+
})]
|
|
3198
|
+
});
|
|
3199
|
+
}, bn = {
|
|
2422
3200
|
solarSystem: "cos-solarSystem-27h8F",
|
|
2423
3201
|
canvas: "cos-canvas-C0nRa"
|
|
2424
|
-
},
|
|
3202
|
+
}, xn = [
|
|
2425
3203
|
{
|
|
2426
3204
|
name: "Mercury",
|
|
2427
3205
|
radius: 0,
|
|
@@ -2479,10 +3257,10 @@ var L = {
|
|
|
2479
3257
|
size: 2,
|
|
2480
3258
|
parent: 2
|
|
2481
3259
|
}
|
|
2482
|
-
],
|
|
3260
|
+
], Sn = ({ width: e = 400, height: t = 400, speed: r = 1, showOrbits: i = !0 }) => {
|
|
2483
3261
|
let a = o(null), s = o([]), c = o([]);
|
|
2484
3262
|
return n(() => {
|
|
2485
|
-
s.current =
|
|
3263
|
+
s.current = xn.map((e) => ({
|
|
2486
3264
|
...e,
|
|
2487
3265
|
angle: Math.random() * Math.PI * 2
|
|
2488
3266
|
})), c.current = Array.from({ length: 80 }, () => ({
|
|
@@ -2531,24 +3309,24 @@ var L = {
|
|
|
2531
3309
|
r,
|
|
2532
3310
|
e
|
|
2533
3311
|
]), /* @__PURE__ */ l("div", {
|
|
2534
|
-
className:
|
|
3312
|
+
className: bn.solarSystem,
|
|
2535
3313
|
style: {
|
|
2536
3314
|
width: e,
|
|
2537
3315
|
height: t
|
|
2538
3316
|
},
|
|
2539
3317
|
children: /* @__PURE__ */ l("canvas", {
|
|
2540
3318
|
ref: a,
|
|
2541
|
-
className:
|
|
3319
|
+
className: bn.canvas,
|
|
2542
3320
|
style: {
|
|
2543
3321
|
width: e,
|
|
2544
3322
|
height: t
|
|
2545
3323
|
}
|
|
2546
3324
|
})
|
|
2547
3325
|
});
|
|
2548
|
-
},
|
|
3326
|
+
}, Cn = {
|
|
2549
3327
|
snowfall: "cos-snowfall-Q-Dhg",
|
|
2550
3328
|
canvas: "cos-canvas-bJVF8"
|
|
2551
|
-
},
|
|
3329
|
+
}, wn = ({ width: e = 800, height: r = 500, mode: i = "snow", count: a = 120 }) => {
|
|
2552
3330
|
let s = o(null), c = o([]), u = o(0), d = t((t) => ({
|
|
2553
3331
|
x: Math.random() * e,
|
|
2554
3332
|
y: t ?? Math.random() * r,
|
|
@@ -2595,24 +3373,24 @@ var L = {
|
|
|
2595
3373
|
i,
|
|
2596
3374
|
e
|
|
2597
3375
|
]), /* @__PURE__ */ l("div", {
|
|
2598
|
-
className:
|
|
3376
|
+
className: Cn.snowfall,
|
|
2599
3377
|
style: {
|
|
2600
3378
|
width: e,
|
|
2601
3379
|
height: r
|
|
2602
3380
|
},
|
|
2603
3381
|
children: /* @__PURE__ */ l("canvas", {
|
|
2604
3382
|
ref: s,
|
|
2605
|
-
className:
|
|
3383
|
+
className: Cn.canvas,
|
|
2606
3384
|
style: {
|
|
2607
3385
|
width: e,
|
|
2608
3386
|
height: r
|
|
2609
3387
|
}
|
|
2610
3388
|
})
|
|
2611
3389
|
});
|
|
2612
|
-
},
|
|
3390
|
+
}, Tn = {
|
|
2613
3391
|
starfield: "cos-starfield-QTwia",
|
|
2614
3392
|
canvas: "cos-canvas-C2t3g"
|
|
2615
|
-
},
|
|
3393
|
+
}, En = ({ width: e = 800, height: t = 500, starCount: r = 400, speed: i = 1 }) => {
|
|
2616
3394
|
let a = o(null), s = o([]), c = o(0);
|
|
2617
3395
|
return n(() => {
|
|
2618
3396
|
s.current = Array.from({ length: r }, () => ({
|
|
@@ -2655,21 +3433,21 @@ var L = {
|
|
|
2655
3433
|
r,
|
|
2656
3434
|
e
|
|
2657
3435
|
]), /* @__PURE__ */ l("div", {
|
|
2658
|
-
className:
|
|
3436
|
+
className: Tn.starfield,
|
|
2659
3437
|
style: {
|
|
2660
3438
|
width: e,
|
|
2661
3439
|
height: t
|
|
2662
3440
|
},
|
|
2663
3441
|
children: /* @__PURE__ */ l("canvas", {
|
|
2664
3442
|
ref: a,
|
|
2665
|
-
className:
|
|
3443
|
+
className: Tn.canvas,
|
|
2666
3444
|
style: {
|
|
2667
3445
|
width: e,
|
|
2668
3446
|
height: t
|
|
2669
3447
|
}
|
|
2670
3448
|
})
|
|
2671
3449
|
});
|
|
2672
|
-
},
|
|
3450
|
+
}, K = {
|
|
2673
3451
|
progressChest: "cos-progressChest-Bqcv1",
|
|
2674
3452
|
barWrap: "cos-barWrap-E2pnl",
|
|
2675
3453
|
barTrack: "cos-barTrack-dKLhs",
|
|
@@ -2684,37 +3462,37 @@ var L = {
|
|
|
2684
3462
|
treasure: "cos-treasure-nx-6S",
|
|
2685
3463
|
pop: "cos-pop-uRZvT",
|
|
2686
3464
|
label: "cos-label-61hRe"
|
|
2687
|
-
},
|
|
3465
|
+
}, Dn = ({ progress: e = 0, onOpen: t, label: r = "开启宝箱" }) => {
|
|
2688
3466
|
let i = o(!1), a = o(t), s = y(e, 0, 100), c = s >= 100;
|
|
2689
3467
|
return n(() => {
|
|
2690
3468
|
a.current = t;
|
|
2691
3469
|
}, [t]), n(() => {
|
|
2692
3470
|
c && !i.current && (i.current = !0, a.current?.()), c || (i.current = !1);
|
|
2693
3471
|
}, [c]), /* @__PURE__ */ u("div", {
|
|
2694
|
-
className:
|
|
3472
|
+
className: K.progressChest,
|
|
2695
3473
|
children: [
|
|
2696
3474
|
/* @__PURE__ */ u("div", {
|
|
2697
|
-
className:
|
|
3475
|
+
className: K.barWrap,
|
|
2698
3476
|
children: [/* @__PURE__ */ l("div", {
|
|
2699
|
-
className:
|
|
3477
|
+
className: K.barTrack,
|
|
2700
3478
|
children: /* @__PURE__ */ l("div", {
|
|
2701
|
-
className:
|
|
3479
|
+
className: K.barFill,
|
|
2702
3480
|
style: { width: `${s}%` }
|
|
2703
3481
|
})
|
|
2704
3482
|
}), /* @__PURE__ */ u("span", {
|
|
2705
|
-
className:
|
|
3483
|
+
className: K.pct,
|
|
2706
3484
|
children: [s.toFixed(0), "%"]
|
|
2707
3485
|
})]
|
|
2708
3486
|
}),
|
|
2709
3487
|
/* @__PURE__ */ u("div", {
|
|
2710
|
-
className: `${
|
|
3488
|
+
className: `${K.chest} ${c ? K.open : ""}`,
|
|
2711
3489
|
children: [/* @__PURE__ */ u("div", {
|
|
2712
|
-
className:
|
|
2713
|
-
children: [/* @__PURE__ */ l("div", { className:
|
|
3490
|
+
className: K.lid,
|
|
3491
|
+
children: [/* @__PURE__ */ l("div", { className: K.lidTop }), /* @__PURE__ */ l("div", { className: K.lock })]
|
|
2714
3492
|
}), /* @__PURE__ */ l("div", {
|
|
2715
|
-
className:
|
|
3493
|
+
className: K.body,
|
|
2716
3494
|
children: c && /* @__PURE__ */ u("div", {
|
|
2717
|
-
className:
|
|
3495
|
+
className: K.treasure,
|
|
2718
3496
|
children: [
|
|
2719
3497
|
/* @__PURE__ */ l("span", { children: "💎" }),
|
|
2720
3498
|
/* @__PURE__ */ l("span", { children: "✨" }),
|
|
@@ -2724,15 +3502,15 @@ var L = {
|
|
|
2724
3502
|
})]
|
|
2725
3503
|
}),
|
|
2726
3504
|
/* @__PURE__ */ l("p", {
|
|
2727
|
-
className:
|
|
3505
|
+
className: K.label,
|
|
2728
3506
|
children: c ? "宝箱已开启!" : r
|
|
2729
3507
|
})
|
|
2730
3508
|
]
|
|
2731
3509
|
});
|
|
2732
|
-
},
|
|
3510
|
+
}, On = {
|
|
2733
3511
|
radarScan: "cos-radarScan-PZaG8",
|
|
2734
3512
|
canvas: "cos-canvas-fUw5N"
|
|
2735
|
-
},
|
|
3513
|
+
}, kn = ({ size: e = 300, color: t = "#22d3ee", blipCount: r = 5 }) => {
|
|
2736
3514
|
let i = o(null), a = o(0), s = o([]), c = o(0);
|
|
2737
3515
|
return n(() => {
|
|
2738
3516
|
s.current = Array.from({ length: r }, () => ({
|
|
@@ -2769,27 +3547,27 @@ var L = {
|
|
|
2769
3547
|
t,
|
|
2770
3548
|
e
|
|
2771
3549
|
]), /* @__PURE__ */ l("div", {
|
|
2772
|
-
className:
|
|
3550
|
+
className: On.radarScan,
|
|
2773
3551
|
style: {
|
|
2774
3552
|
width: e,
|
|
2775
3553
|
height: e
|
|
2776
3554
|
},
|
|
2777
3555
|
children: /* @__PURE__ */ l("canvas", {
|
|
2778
3556
|
ref: i,
|
|
2779
|
-
className:
|
|
3557
|
+
className: On.canvas,
|
|
2780
3558
|
style: {
|
|
2781
3559
|
width: e,
|
|
2782
3560
|
height: e
|
|
2783
3561
|
}
|
|
2784
3562
|
})
|
|
2785
3563
|
});
|
|
2786
|
-
},
|
|
3564
|
+
}, An = {
|
|
2787
3565
|
redPacketRain: "cos-redPacketRain-eJ7FW",
|
|
2788
3566
|
canvas: "cos-canvas-direH",
|
|
2789
3567
|
hud: "cos-hud-InqMq",
|
|
2790
3568
|
end: "cos-end-u0J7o",
|
|
2791
3569
|
hint: "cos-hint-sO6ld"
|
|
2792
|
-
},
|
|
3570
|
+
}, jn = ({ duration: e = 1e4, onGrab: r }) => {
|
|
2793
3571
|
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
3572
|
n(() => {
|
|
2795
3573
|
y.current = r;
|
|
@@ -2835,11 +3613,11 @@ var L = {
|
|
|
2835
3613
|
cancelAnimationFrame(c.current), clearTimeout(l), s();
|
|
2836
3614
|
};
|
|
2837
3615
|
}, [e, b]), /* @__PURE__ */ u("div", {
|
|
2838
|
-
className:
|
|
3616
|
+
className: An.redPacketRain,
|
|
2839
3617
|
children: [
|
|
2840
3618
|
/* @__PURE__ */ l("canvas", {
|
|
2841
3619
|
ref: i,
|
|
2842
|
-
className:
|
|
3620
|
+
className: An.canvas,
|
|
2843
3621
|
style: {
|
|
2844
3622
|
width: 400,
|
|
2845
3623
|
height: 500
|
|
@@ -2853,25 +3631,25 @@ var L = {
|
|
|
2853
3631
|
}
|
|
2854
3632
|
}),
|
|
2855
3633
|
/* @__PURE__ */ u("div", {
|
|
2856
|
-
className:
|
|
3634
|
+
className: An.hud,
|
|
2857
3635
|
children: [/* @__PURE__ */ u("span", { children: ["已抢: ¥", p] }), !h && /* @__PURE__ */ l("span", {
|
|
2858
|
-
className:
|
|
3636
|
+
className: An.end,
|
|
2859
3637
|
children: "红包雨结束"
|
|
2860
3638
|
})]
|
|
2861
3639
|
}),
|
|
2862
3640
|
/* @__PURE__ */ l("p", {
|
|
2863
|
-
className:
|
|
3641
|
+
className: An.hint,
|
|
2864
3642
|
children: "点击红包抢夺"
|
|
2865
3643
|
})
|
|
2866
3644
|
]
|
|
2867
3645
|
});
|
|
2868
|
-
},
|
|
3646
|
+
}, Mn = {
|
|
2869
3647
|
returnCityContainer: "cos-returnCityContainer-6XTxj",
|
|
2870
3648
|
star: "cos-star-a59Dx",
|
|
2871
3649
|
glassWrap: "cos-glassWrap-golMO",
|
|
2872
3650
|
rotate: "cos-rotate-7X9Jj",
|
|
2873
3651
|
glassItem: "cos-glassItem-OwlFI"
|
|
2874
|
-
},
|
|
3652
|
+
}, Nn = ({ starCount: e, glassCount: t = 8, glassRadius: r = 150 }) => {
|
|
2875
3653
|
let i = o(null), a = o(null);
|
|
2876
3654
|
return n(() => {
|
|
2877
3655
|
let n = i.current, o = a.current;
|
|
@@ -2880,13 +3658,13 @@ var L = {
|
|
|
2880
3658
|
for (let e = 0; e < f; e++) {
|
|
2881
3659
|
let e = window.setTimeout(() => {
|
|
2882
3660
|
let e = document.createElement("div");
|
|
2883
|
-
e.className =
|
|
3661
|
+
e.className = Mn.star, e.style.top = `${Math.random() * d}px`, e.style.left = `${Math.random() * u}px`, n.append(e), c.push(e);
|
|
2884
3662
|
}, Math.random() * 2e3);
|
|
2885
3663
|
s.push(e);
|
|
2886
3664
|
}
|
|
2887
3665
|
for (let e = 0; e < t; e++) {
|
|
2888
3666
|
let n = document.createElement("div");
|
|
2889
|
-
n.className =
|
|
3667
|
+
n.className = Mn.glassItem, n.style.transform = `rotateY(${360 / t * e}deg) translateZ(${r}px)`, o.appendChild(n), l.push(n);
|
|
2890
3668
|
let i = window.setTimeout(() => {
|
|
2891
3669
|
n.style.top = "0px", n.style.opacity = "1";
|
|
2892
3670
|
}, e * 300);
|
|
@@ -2901,16 +3679,16 @@ var L = {
|
|
|
2901
3679
|
r
|
|
2902
3680
|
]), /* @__PURE__ */ l("div", {
|
|
2903
3681
|
ref: i,
|
|
2904
|
-
className:
|
|
3682
|
+
className: Mn.returnCityContainer,
|
|
2905
3683
|
children: /* @__PURE__ */ l("div", {
|
|
2906
3684
|
ref: a,
|
|
2907
|
-
className:
|
|
3685
|
+
className: Mn.glassWrap
|
|
2908
3686
|
})
|
|
2909
3687
|
});
|
|
2910
|
-
},
|
|
3688
|
+
}, Pn = {
|
|
2911
3689
|
ropeChain: "cos-ropeChain-gYaSK",
|
|
2912
3690
|
canvas: "cos-canvas-5i95N"
|
|
2913
|
-
},
|
|
3691
|
+
}, Fn = ({ width: e = 400, height: t = 400, segments: r = 16, color: i = "#38bdf8", gravity: a = .4 }) => {
|
|
2914
3692
|
let s = o(null), c = o([]), u = o({
|
|
2915
3693
|
active: !1,
|
|
2916
3694
|
index: -1
|
|
@@ -2995,21 +3773,21 @@ var L = {
|
|
|
2995
3773
|
r,
|
|
2996
3774
|
e
|
|
2997
3775
|
]), /* @__PURE__ */ l("div", {
|
|
2998
|
-
className:
|
|
3776
|
+
className: Pn.ropeChain,
|
|
2999
3777
|
style: {
|
|
3000
3778
|
width: e,
|
|
3001
3779
|
height: t
|
|
3002
3780
|
},
|
|
3003
3781
|
children: /* @__PURE__ */ l("canvas", {
|
|
3004
3782
|
ref: s,
|
|
3005
|
-
className:
|
|
3783
|
+
className: Pn.canvas,
|
|
3006
3784
|
style: {
|
|
3007
3785
|
width: e,
|
|
3008
3786
|
height: t
|
|
3009
3787
|
}
|
|
3010
3788
|
})
|
|
3011
3789
|
});
|
|
3012
|
-
},
|
|
3790
|
+
}, q = {
|
|
3013
3791
|
speedometer: "cos-speedometer-INc7F",
|
|
3014
3792
|
svg: "cos-svg-HG-lE",
|
|
3015
3793
|
track: "cos-track-5-922",
|
|
@@ -3019,37 +3797,37 @@ var L = {
|
|
|
3019
3797
|
hub: "cos-hub-4WaHw",
|
|
3020
3798
|
valueText: "cos-valueText--q4Xi",
|
|
3021
3799
|
label: "cos-label-hOPy1"
|
|
3022
|
-
},
|
|
3800
|
+
}, J = (e, t, n, r) => {
|
|
3023
3801
|
let i = (r - 90) * Math.PI / 180;
|
|
3024
3802
|
return {
|
|
3025
3803
|
x: e + n * Math.cos(i),
|
|
3026
3804
|
y: t + n * Math.sin(i)
|
|
3027
3805
|
};
|
|
3028
|
-
},
|
|
3806
|
+
}, In = ({ value: e = 0, max: t = 100, label: n = "SPEED", color: r = "#f97316" }) => {
|
|
3029
3807
|
let i = -120 + y(t > 0 ? e / t : 0, 0, 1) * 240, o = a(() => {
|
|
3030
|
-
let e =
|
|
3808
|
+
let e = J(100, 100, 72, -120), t = J(100, 100, 72, 120);
|
|
3031
3809
|
return `M ${e.x} ${e.y} A 72 72 0 1 1 ${t.x} ${t.y}`;
|
|
3032
3810
|
}, []), s = a(() => {
|
|
3033
|
-
let e =
|
|
3811
|
+
let e = J(100, 100, 72, -120), t = J(100, 100, 72, i), n = +(i - -120 > 180);
|
|
3034
3812
|
return `M ${e.x} ${e.y} A 72 72 0 ${n} 1 ${t.x} ${t.y}`;
|
|
3035
|
-
}, [i]), c =
|
|
3813
|
+
}, [i]), c = J(100, 100, 58, i);
|
|
3036
3814
|
return /* @__PURE__ */ u("div", {
|
|
3037
|
-
className:
|
|
3815
|
+
className: q.speedometer,
|
|
3038
3816
|
style: { "--gauge-color": r },
|
|
3039
3817
|
children: [/* @__PURE__ */ u("svg", {
|
|
3040
3818
|
viewBox: "0 0 200 130",
|
|
3041
|
-
className:
|
|
3819
|
+
className: q.svg,
|
|
3042
3820
|
children: [
|
|
3043
3821
|
/* @__PURE__ */ l("path", {
|
|
3044
3822
|
d: o,
|
|
3045
|
-
className:
|
|
3823
|
+
className: q.track,
|
|
3046
3824
|
fill: "none",
|
|
3047
3825
|
strokeWidth: "12",
|
|
3048
3826
|
strokeLinecap: "round"
|
|
3049
3827
|
}),
|
|
3050
3828
|
/* @__PURE__ */ l("path", {
|
|
3051
3829
|
d: s,
|
|
3052
|
-
className:
|
|
3830
|
+
className: q.valueArc,
|
|
3053
3831
|
fill: "none",
|
|
3054
3832
|
strokeWidth: "12",
|
|
3055
3833
|
strokeLinecap: "round"
|
|
@@ -3061,13 +3839,13 @@ var L = {
|
|
|
3061
3839
|
60,
|
|
3062
3840
|
120
|
|
3063
3841
|
].map((e) => {
|
|
3064
|
-
let t =
|
|
3842
|
+
let t = J(100, 100, 58, e), n = J(100, 100, 66, e);
|
|
3065
3843
|
return /* @__PURE__ */ l("line", {
|
|
3066
3844
|
x1: t.x,
|
|
3067
3845
|
y1: t.y,
|
|
3068
3846
|
x2: n.x,
|
|
3069
3847
|
y2: n.y,
|
|
3070
|
-
className:
|
|
3848
|
+
className: q.tick
|
|
3071
3849
|
}, e);
|
|
3072
3850
|
}),
|
|
3073
3851
|
/* @__PURE__ */ l("line", {
|
|
@@ -3075,27 +3853,27 @@ var L = {
|
|
|
3075
3853
|
y1: "100",
|
|
3076
3854
|
x2: c.x,
|
|
3077
3855
|
y2: c.y,
|
|
3078
|
-
className:
|
|
3856
|
+
className: q.needle
|
|
3079
3857
|
}),
|
|
3080
3858
|
/* @__PURE__ */ l("circle", {
|
|
3081
3859
|
cx: "100",
|
|
3082
3860
|
cy: "100",
|
|
3083
3861
|
r: "6",
|
|
3084
|
-
className:
|
|
3862
|
+
className: q.hub
|
|
3085
3863
|
}),
|
|
3086
3864
|
/* @__PURE__ */ l("text", {
|
|
3087
3865
|
x: "100",
|
|
3088
3866
|
y: "118",
|
|
3089
|
-
className:
|
|
3867
|
+
className: q.valueText,
|
|
3090
3868
|
children: Math.round(e)
|
|
3091
3869
|
})
|
|
3092
3870
|
]
|
|
3093
3871
|
}), /* @__PURE__ */ l("span", {
|
|
3094
|
-
className:
|
|
3872
|
+
className: q.label,
|
|
3095
3873
|
children: n
|
|
3096
3874
|
})]
|
|
3097
3875
|
});
|
|
3098
|
-
},
|
|
3876
|
+
}, Y = {
|
|
3099
3877
|
timelinePulse: "cos-timelinePulse-kcBM6",
|
|
3100
3878
|
axis: "cos-axis-9DWis",
|
|
3101
3879
|
track: "cos-track-jG-HV",
|
|
@@ -3105,7 +3883,7 @@ var L = {
|
|
|
3105
3883
|
dot: "cos-dot-HJEVy",
|
|
3106
3884
|
pulse: "cos-pulse-N6FD1",
|
|
3107
3885
|
name: "cos-name-7zefJ"
|
|
3108
|
-
},
|
|
3886
|
+
}, Ln = ({ steps: e = [
|
|
3109
3887
|
"Start",
|
|
3110
3888
|
"Process",
|
|
3111
3889
|
"Review",
|
|
@@ -3113,26 +3891,26 @@ var L = {
|
|
|
3113
3891
|
], current: t = 0, color: n = "#22d3ee" }) => {
|
|
3114
3892
|
let r = y(t, 0, Math.max(0, e.length - 1)), i = e.length > 1 ? r / (e.length - 1) : 0;
|
|
3115
3893
|
return /* @__PURE__ */ l("div", {
|
|
3116
|
-
className:
|
|
3894
|
+
className: Y.timelinePulse,
|
|
3117
3895
|
style: {
|
|
3118
3896
|
"--pulse-color": n,
|
|
3119
3897
|
"--step-count": e.length,
|
|
3120
3898
|
"--progress-ratio": i
|
|
3121
3899
|
},
|
|
3122
3900
|
children: /* @__PURE__ */ u("div", {
|
|
3123
|
-
className:
|
|
3901
|
+
className: Y.axis,
|
|
3124
3902
|
children: [
|
|
3125
|
-
/* @__PURE__ */ l("div", { className:
|
|
3126
|
-
/* @__PURE__ */ l("div", { className:
|
|
3903
|
+
/* @__PURE__ */ l("div", { className: Y.track }),
|
|
3904
|
+
/* @__PURE__ */ l("div", { className: Y.progress }),
|
|
3127
3905
|
/* @__PURE__ */ l("ul", {
|
|
3128
|
-
className:
|
|
3906
|
+
className: Y.steps,
|
|
3129
3907
|
children: e.map((e, t) => {
|
|
3130
3908
|
let n = t < r ? "done" : t === r ? "current" : "pending";
|
|
3131
3909
|
return /* @__PURE__ */ u("li", {
|
|
3132
|
-
className:
|
|
3910
|
+
className: Y.step,
|
|
3133
3911
|
"data-state": n,
|
|
3134
|
-
children: [/* @__PURE__ */ l("span", { className:
|
|
3135
|
-
className:
|
|
3912
|
+
children: [/* @__PURE__ */ l("span", { className: Y.dot }), /* @__PURE__ */ l("span", {
|
|
3913
|
+
className: Y.name,
|
|
3136
3914
|
children: e
|
|
3137
3915
|
})]
|
|
3138
3916
|
}, e + t);
|
|
@@ -3141,11 +3919,11 @@ var L = {
|
|
|
3141
3919
|
]
|
|
3142
3920
|
})
|
|
3143
3921
|
});
|
|
3144
|
-
},
|
|
3922
|
+
}, Rn = {
|
|
3145
3923
|
rippleWater: "cos-rippleWater-wsinI",
|
|
3146
3924
|
canvas: "cos-canvas-XOdSF",
|
|
3147
3925
|
hint: "cos-hint-0JH5D"
|
|
3148
|
-
},
|
|
3926
|
+
}, zn = "\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", Bn = "\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", Vn = (e) => {
|
|
3149
3927
|
let t = e.replace("#", ""), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t, r = Number.parseInt(n, 16);
|
|
3150
3928
|
return Number.isNaN(r) ? [
|
|
3151
3929
|
.22,
|
|
@@ -3156,18 +3934,18 @@ var L = {
|
|
|
3156
3934
|
(r >> 8 & 255) / 255,
|
|
3157
3935
|
(r & 255) / 255
|
|
3158
3936
|
];
|
|
3159
|
-
},
|
|
3937
|
+
}, Hn = (e, t, n) => {
|
|
3160
3938
|
let r = e.createShader(t);
|
|
3161
3939
|
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 =
|
|
3940
|
+
}, Un = (e, t, n) => {
|
|
3941
|
+
let r = Hn(e, e.VERTEX_SHADER, t), i = Hn(e, e.FRAGMENT_SHADER, n);
|
|
3164
3942
|
if (!r || !i) return null;
|
|
3165
3943
|
let a = e.createProgram();
|
|
3166
3944
|
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:
|
|
3945
|
+
}, X = 192, Wn = (e) => ({
|
|
3946
|
+
from: Vn(e.fromColor),
|
|
3947
|
+
to: Vn(e.toColor),
|
|
3948
|
+
tint: Vn(e.color),
|
|
3171
3949
|
waveAmplitude: e.waveAmplitude,
|
|
3172
3950
|
waveSpeed: e.waveSpeed,
|
|
3173
3951
|
shimmer: e.shimmer,
|
|
@@ -3177,8 +3955,8 @@ var L = {
|
|
|
3177
3955
|
damping: e.damping,
|
|
3178
3956
|
spread: e.spread,
|
|
3179
3957
|
interactive: e.interactive
|
|
3180
|
-
}),
|
|
3181
|
-
let C = o(null), w = o(0), T = o(null), E = o(
|
|
3958
|
+
}), Gn = ({ 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 = "点击水面产生涟漪" }) => {
|
|
3959
|
+
let C = o(null), w = o(0), T = o(null), E = o(Wn({
|
|
3182
3960
|
fromColor: i,
|
|
3183
3961
|
toColor: a,
|
|
3184
3962
|
color: s,
|
|
@@ -3193,7 +3971,7 @@ var L = {
|
|
|
3193
3971
|
interactive: b
|
|
3194
3972
|
}));
|
|
3195
3973
|
n(() => {
|
|
3196
|
-
E.current =
|
|
3974
|
+
E.current = Wn({
|
|
3197
3975
|
fromColor: i,
|
|
3198
3976
|
toColor: a,
|
|
3199
3977
|
color: s,
|
|
@@ -3252,7 +4030,7 @@ var L = {
|
|
|
3252
4030
|
premultipliedAlpha: !1
|
|
3253
4031
|
});
|
|
3254
4032
|
if (!i) return;
|
|
3255
|
-
let a =
|
|
4033
|
+
let a = Un(i, zn, Bn);
|
|
3256
4034
|
if (!a) return;
|
|
3257
4035
|
let o = i.createBuffer();
|
|
3258
4036
|
i.bindBuffer(i.ARRAY_BUFFER, o), i.bufferData(i.ARRAY_BUFFER, new Float32Array([
|
|
@@ -3265,65 +4043,65 @@ var L = {
|
|
|
3265
4043
|
1,
|
|
3266
4044
|
1
|
|
3267
4045
|
]), 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 =
|
|
4046
|
+
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 = X * X, S = new Float32Array(x), D = new Float32Array(x), O = new Float32Array(x), k = i.createTexture();
|
|
3269
4047
|
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
4048
|
let A = new Uint8Array(x * 4), j = () => {
|
|
3271
4049
|
for (let e = 0; e < x; e++) {
|
|
3272
4050
|
let t = Math.max(0, Math.min(255, Math.floor((D[e] * .5 + .5) * 255))), n = e * 4;
|
|
3273
4051
|
A[n] = t, A[n + 1] = t, A[n + 2] = t, A[n + 3] = 255;
|
|
3274
4052
|
}
|
|
3275
|
-
i.bindTexture(i.TEXTURE_2D, k), i.texImage2D(i.TEXTURE_2D, 0, i.RGBA,
|
|
4053
|
+
i.bindTexture(i.TEXTURE_2D, k), i.texImage2D(i.TEXTURE_2D, 0, i.RGBA, X, X, 0, i.RGBA, i.UNSIGNED_BYTE, A);
|
|
3276
4054
|
}, M = (e, t, n, r) => {
|
|
3277
|
-
let i = e * (
|
|
4055
|
+
let i = e * (X - 1), a = t * (X - 1), o = y(r, 2, 12);
|
|
3278
4056
|
for (let e = -o - 1; e <= o + 1; e++) for (let t = -o - 1; t <= o + 1; t++) {
|
|
3279
4057
|
let r = Math.round(i + t), s = Math.round(a + e);
|
|
3280
|
-
if (r <= 0 || r >=
|
|
4058
|
+
if (r <= 0 || r >= X - 1 || s <= 0 || s >= X - 1) continue;
|
|
3281
4059
|
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 *
|
|
4060
|
+
D[s * X + r] += n * (l + u * 1.1);
|
|
3283
4061
|
}
|
|
3284
4062
|
}, N = (e, t) => {
|
|
3285
4063
|
let n = y(e, .9, .999), r = y(t, .3, .7);
|
|
3286
4064
|
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 -
|
|
4065
|
+
for (let e = 1; e < X - 1; e++) {
|
|
4066
|
+
let t = e * X;
|
|
4067
|
+
for (let e = 1; e < X - 1; e++) {
|
|
4068
|
+
let i = t + e, a = D[i - 1] + D[i + 1] + D[i - X] + D[i + X];
|
|
3291
4069
|
O[i] = (a * r - S[i]) * n, O[i] > 1.5 ? O[i] = 1.5 : O[i] < -1.5 && (O[i] = -1.5);
|
|
3292
4070
|
}
|
|
3293
4071
|
}
|
|
3294
4072
|
let e = S;
|
|
3295
4073
|
S = D, D = O, O = e, O.fill(0);
|
|
3296
4074
|
}
|
|
3297
|
-
},
|
|
4075
|
+
}, P = (e) => {
|
|
3298
4076
|
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,
|
|
4077
|
+
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, X, X), 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
4078
|
};
|
|
3301
|
-
if (j(), typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return
|
|
4079
|
+
if (j(), typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return P(0), () => {
|
|
3302
4080
|
i.deleteTexture(k), i.deleteBuffer(o), i.deleteProgram(a);
|
|
3303
4081
|
};
|
|
3304
|
-
let
|
|
3305
|
-
|
|
3306
|
-
}),
|
|
3307
|
-
if (w.current = requestAnimationFrame(
|
|
4082
|
+
let F = document.hidden, I = v((e) => {
|
|
4083
|
+
F = e;
|
|
4084
|
+
}), L = performance.now(), R = (e) => {
|
|
4085
|
+
if (w.current = requestAnimationFrame(R), F) return;
|
|
3308
4086
|
let t = E.current;
|
|
3309
4087
|
if (T.current) {
|
|
3310
4088
|
let e = T.current, n = y(e.strength, 0, 3), r = t.rippleRadius;
|
|
3311
4089
|
M(e.x, e.y, n, r), M(e.x + .004, e.y - .003, n * .35, r), T.current = null;
|
|
3312
4090
|
}
|
|
3313
|
-
N(t.damping, t.spread), j(),
|
|
4091
|
+
N(t.damping, t.spread), j(), P((e - L) / 1e3);
|
|
3314
4092
|
};
|
|
3315
|
-
return w.current = requestAnimationFrame(
|
|
3316
|
-
cancelAnimationFrame(w.current),
|
|
4093
|
+
return w.current = requestAnimationFrame(R), () => {
|
|
4094
|
+
cancelAnimationFrame(w.current), I(), i.deleteTexture(k), i.deleteBuffer(o), i.deleteProgram(a);
|
|
3317
4095
|
};
|
|
3318
4096
|
}, [r, e]), /* @__PURE__ */ u("div", {
|
|
3319
|
-
className:
|
|
4097
|
+
className: Rn.rippleWater,
|
|
3320
4098
|
style: {
|
|
3321
4099
|
width: e,
|
|
3322
4100
|
height: r
|
|
3323
4101
|
},
|
|
3324
4102
|
children: [/* @__PURE__ */ l("canvas", {
|
|
3325
4103
|
ref: C,
|
|
3326
|
-
className:
|
|
4104
|
+
className: Rn.canvas,
|
|
3327
4105
|
style: {
|
|
3328
4106
|
width: e,
|
|
3329
4107
|
height: r,
|
|
@@ -3332,20 +4110,20 @@ var L = {
|
|
|
3332
4110
|
role: "img",
|
|
3333
4111
|
"aria-label": S || "涟漪水面"
|
|
3334
4112
|
}), x ? /* @__PURE__ */ l("span", {
|
|
3335
|
-
className:
|
|
4113
|
+
className: Rn.hint,
|
|
3336
4114
|
"aria-hidden": !0,
|
|
3337
4115
|
children: S
|
|
3338
4116
|
}) : null]
|
|
3339
4117
|
});
|
|
3340
|
-
},
|
|
4118
|
+
}, Kn = {
|
|
3341
4119
|
scrambleText: "cos-scrambleText-hN4Wm",
|
|
3342
4120
|
text: "cos-text-frsHs",
|
|
3343
4121
|
cursor: "cos-cursor-3zQOy",
|
|
3344
4122
|
blink: "cos-blink-OcKXu"
|
|
3345
|
-
},
|
|
4123
|
+
}, qn = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*", Jn = ({ text: e = "DECRYPTED", duration: t = 2e3, charset: r = qn }) => {
|
|
3346
4124
|
let [i, a] = s(""), c = o(0), d = o(0);
|
|
3347
4125
|
return n(() => {
|
|
3348
|
-
let n = r.length > 0 ? r :
|
|
4126
|
+
let n = r.length > 0 ? r : qn, i = e;
|
|
3349
4127
|
d.current = performance.now();
|
|
3350
4128
|
let o = (e) => {
|
|
3351
4129
|
let r = e - d.current, s = Math.min(r / t, 1), l = Math.floor(s * i.length);
|
|
@@ -3357,18 +4135,18 @@ var L = {
|
|
|
3357
4135
|
t,
|
|
3358
4136
|
r
|
|
3359
4137
|
]), /* @__PURE__ */ l("div", {
|
|
3360
|
-
className:
|
|
4138
|
+
className: Kn.scrambleText,
|
|
3361
4139
|
children: /* @__PURE__ */ u("p", {
|
|
3362
|
-
className:
|
|
3363
|
-
children: [i, /* @__PURE__ */ l("span", { className:
|
|
4140
|
+
className: Kn.text,
|
|
4141
|
+
children: [i, /* @__PURE__ */ l("span", { className: Kn.cursor })]
|
|
3364
4142
|
})
|
|
3365
4143
|
});
|
|
3366
|
-
},
|
|
4144
|
+
}, Yn = {
|
|
3367
4145
|
scratchCard: "cos-scratchCard-McIEK",
|
|
3368
4146
|
prize: "cos-prize-X0z5V",
|
|
3369
4147
|
canvas: "cos-canvas-JqIlr",
|
|
3370
4148
|
hidden: "cos-hidden-Lsfbt"
|
|
3371
|
-
},
|
|
4149
|
+
}, Xn = ({ coverColor: e = "#94a3b8", prize: r = "🎉 恭喜中奖!", onReveal: i, width: a = 300, height: c = 180 }) => {
|
|
3372
4150
|
let d = o(null), f = o(!1), p = o(!1), m = o(i), [h, g] = s(!1);
|
|
3373
4151
|
n(() => {
|
|
3374
4152
|
m.current = i;
|
|
@@ -3431,17 +4209,17 @@ var L = {
|
|
|
3431
4209
|
f.current = !1;
|
|
3432
4210
|
};
|
|
3433
4211
|
return /* @__PURE__ */ u("div", {
|
|
3434
|
-
className:
|
|
4212
|
+
className: Yn.scratchCard,
|
|
3435
4213
|
style: {
|
|
3436
4214
|
width: a,
|
|
3437
4215
|
height: c
|
|
3438
4216
|
},
|
|
3439
4217
|
children: [/* @__PURE__ */ l("div", {
|
|
3440
|
-
className:
|
|
4218
|
+
className: Yn.prize,
|
|
3441
4219
|
children: r
|
|
3442
4220
|
}), /* @__PURE__ */ l("canvas", {
|
|
3443
4221
|
ref: d,
|
|
3444
|
-
className: `${
|
|
4222
|
+
className: `${Yn.canvas} ${h ? Yn.hidden : ""}`,
|
|
3445
4223
|
style: {
|
|
3446
4224
|
width: a,
|
|
3447
4225
|
height: c
|
|
@@ -3455,7 +4233,7 @@ var L = {
|
|
|
3455
4233
|
onTouchEnd: C
|
|
3456
4234
|
})]
|
|
3457
4235
|
});
|
|
3458
|
-
},
|
|
4236
|
+
}, Z = {
|
|
3459
4237
|
slotMachine: "cos-slotMachine-P6FyZ",
|
|
3460
4238
|
machine: "cos-machine-B066r",
|
|
3461
4239
|
reel: "cos-reel-eEpJ3",
|
|
@@ -3464,14 +4242,14 @@ var L = {
|
|
|
3464
4242
|
mask: "cos-mask-jdrj3",
|
|
3465
4243
|
spinBtn: "cos-spinBtn-DvDE7",
|
|
3466
4244
|
result: "cos-result-dLN5b"
|
|
3467
|
-
},
|
|
4245
|
+
}, Zn = [
|
|
3468
4246
|
"🍒",
|
|
3469
4247
|
"🍋",
|
|
3470
4248
|
"🍊",
|
|
3471
4249
|
"🍇",
|
|
3472
4250
|
"⭐",
|
|
3473
4251
|
"7️⃣"
|
|
3474
|
-
],
|
|
4252
|
+
], Qn = (e) => 1 - (1 - e) ** 3, $n = ({ symbols: e = Zn, onSpinEnd: r }) => {
|
|
3475
4253
|
let [i, a] = s(!1), [c, d] = s([
|
|
3476
4254
|
0,
|
|
3477
4255
|
0,
|
|
@@ -3488,31 +4266,31 @@ var L = {
|
|
|
3488
4266
|
return n(() => () => {
|
|
3489
4267
|
g.current && (g.current.cancelled = !0), cancelAnimationFrame(m.current);
|
|
3490
4268
|
}, []), /* @__PURE__ */ u("div", {
|
|
3491
|
-
className:
|
|
4269
|
+
className: Z.slotMachine,
|
|
3492
4270
|
children: [
|
|
3493
4271
|
/* @__PURE__ */ l("div", {
|
|
3494
|
-
className:
|
|
4272
|
+
className: Z.machine,
|
|
3495
4273
|
children: [
|
|
3496
4274
|
0,
|
|
3497
4275
|
1,
|
|
3498
4276
|
2
|
|
3499
4277
|
].map((e) => /* @__PURE__ */ u("div", {
|
|
3500
|
-
className:
|
|
4278
|
+
className: Z.reel,
|
|
3501
4279
|
style: { height: 240 },
|
|
3502
4280
|
children: [/* @__PURE__ */ l("div", {
|
|
3503
|
-
className:
|
|
4281
|
+
className: Z.strip,
|
|
3504
4282
|
style: { transform: `translateY(${c[e]}px)` },
|
|
3505
4283
|
children: _.map((e, t) => /* @__PURE__ */ l("div", {
|
|
3506
|
-
className:
|
|
4284
|
+
className: Z.item,
|
|
3507
4285
|
style: { height: 80 },
|
|
3508
4286
|
children: e
|
|
3509
4287
|
}, t))
|
|
3510
|
-
}), /* @__PURE__ */ l("div", { className:
|
|
4288
|
+
}), /* @__PURE__ */ l("div", { className: Z.mask })]
|
|
3511
4289
|
}, e))
|
|
3512
4290
|
}),
|
|
3513
4291
|
/* @__PURE__ */ l("button", {
|
|
3514
4292
|
type: "button",
|
|
3515
|
-
className:
|
|
4293
|
+
className: Z.spinBtn,
|
|
3516
4294
|
onClick: () => {
|
|
3517
4295
|
if (i) return;
|
|
3518
4296
|
a(!0), p([]);
|
|
@@ -3531,7 +4309,7 @@ var L = {
|
|
|
3531
4309
|
if (d(r.map((e, t) => {
|
|
3532
4310
|
let r = i - l - s[t];
|
|
3533
4311
|
if (r < 0) return e;
|
|
3534
|
-
let a =
|
|
4312
|
+
let a = Qn(Math.min(r / o, 1));
|
|
3535
4313
|
return e + (n[t] - e) * a;
|
|
3536
4314
|
})), !s.every((e) => i - l - e >= o)) m.current = requestAnimationFrame(f);
|
|
3537
4315
|
else if (!u.cancelled) {
|
|
@@ -3546,12 +4324,155 @@ var L = {
|
|
|
3546
4324
|
children: i ? "旋转中..." : "开始"
|
|
3547
4325
|
}),
|
|
3548
4326
|
f.length > 0 && !i && /* @__PURE__ */ l("p", {
|
|
3549
|
-
className:
|
|
4327
|
+
className: Z.result,
|
|
3550
4328
|
children: f[0] === f[1] && f[1] === f[2] ? "🎰 大奖!" : `结果: ${f.join(" ")}`
|
|
3551
4329
|
})
|
|
3552
4330
|
]
|
|
3553
4331
|
});
|
|
3554
|
-
},
|
|
4332
|
+
}, er = {
|
|
4333
|
+
sandFall: "cos-sandFall-kgJeI",
|
|
4334
|
+
canvas: "cos-canvas-9z6X1",
|
|
4335
|
+
toolbar: "cos-toolbar-u8dLM",
|
|
4336
|
+
hint: "cos-hint-DS8tY",
|
|
4337
|
+
button: "cos-button-YhINe"
|
|
4338
|
+
}, tr = [
|
|
4339
|
+
"#fbbf24",
|
|
4340
|
+
"#f59e0b",
|
|
4341
|
+
"#d97706",
|
|
4342
|
+
"#b45309",
|
|
4343
|
+
"#92400e"
|
|
4344
|
+
], nr = (e) => {
|
|
4345
|
+
let t = e.trim().replace("#", "");
|
|
4346
|
+
if (!/^[0-9a-fA-F]{6}$/.test(t)) return [
|
|
4347
|
+
251,
|
|
4348
|
+
191,
|
|
4349
|
+
36
|
|
4350
|
+
];
|
|
4351
|
+
let n = parseInt(t, 16);
|
|
4352
|
+
return [
|
|
4353
|
+
n >> 16 & 255,
|
|
4354
|
+
n >> 8 & 255,
|
|
4355
|
+
n & 255
|
|
4356
|
+
];
|
|
4357
|
+
}, rr = ({ width: e = 480, height: t = 400, cellSize: r = 4, colors: i = tr, spawnRate: s = 3 }) => {
|
|
4358
|
+
let c = o(null), d = Math.max(1, Math.floor(e / r)), f = Math.max(1, Math.floor(t / r)), p = o(Array(d * f).fill(null)), m = o({
|
|
4359
|
+
x: -1,
|
|
4360
|
+
y: -1,
|
|
4361
|
+
down: !1
|
|
4362
|
+
}), h = a(() => (i.length > 0 ? i : tr).map(nr), [i]), g = () => {
|
|
4363
|
+
p.current = Array(d * f).fill(null);
|
|
4364
|
+
};
|
|
4365
|
+
n(() => {
|
|
4366
|
+
p.current = Array(d * f).fill(null);
|
|
4367
|
+
}, [d, f]), n(() => {
|
|
4368
|
+
let n = c.current;
|
|
4369
|
+
if (!n) return;
|
|
4370
|
+
let i = window.devicePixelRatio || 1;
|
|
4371
|
+
n.width = e * i, n.height = t * i;
|
|
4372
|
+
let a = n.getContext("2d");
|
|
4373
|
+
if (!a) return;
|
|
4374
|
+
a.setTransform(i, 0, 0, i, 0, 0);
|
|
4375
|
+
let o = 0, l = document.hidden, u = v((e) => {
|
|
4376
|
+
l = e;
|
|
4377
|
+
}), g = (e, t) => t * d + e, _ = () => {
|
|
4378
|
+
let e = p.current;
|
|
4379
|
+
for (let t = f - 2; t >= 0; t--) for (let n = 0; n < d; n++) {
|
|
4380
|
+
let r = g(n, t);
|
|
4381
|
+
if (e[r] === null) continue;
|
|
4382
|
+
let i = g(n, t + 1);
|
|
4383
|
+
if (e[i] === null) {
|
|
4384
|
+
e[i] = e[r], e[r] = null;
|
|
4385
|
+
continue;
|
|
4386
|
+
}
|
|
4387
|
+
let a = Math.random() < .5 ? -1 : 1, o = n + a, s = n - a;
|
|
4388
|
+
o >= 0 && o < d && e[g(o, t + 1)] === null ? (e[g(o, t + 1)] = e[r], e[r] = null) : s >= 0 && s < d && e[g(s, t + 1)] === null && (e[g(s, t + 1)] = e[r], e[r] = null);
|
|
4389
|
+
}
|
|
4390
|
+
}, y = () => {
|
|
4391
|
+
let { x: e, y: t, down: n } = m.current;
|
|
4392
|
+
if (!n || e < 0 || t < 0) return;
|
|
4393
|
+
let i = Math.floor(e / r), a = Math.floor(t / r), o = p.current;
|
|
4394
|
+
for (let e = 0; e < s; e++) {
|
|
4395
|
+
let e = i + Math.floor((Math.random() - .5) * 6), t = a + Math.floor((Math.random() - .5) * 3);
|
|
4396
|
+
if (e < 0 || e >= d || t < 0 || t >= f) continue;
|
|
4397
|
+
let n = g(e, t);
|
|
4398
|
+
o[n] === null && (o[n] = Math.floor(Math.random() * h.length));
|
|
4399
|
+
}
|
|
4400
|
+
}, b = () => {
|
|
4401
|
+
a.fillStyle = "#0f172a", a.fillRect(0, 0, e, t);
|
|
4402
|
+
let n = p.current;
|
|
4403
|
+
for (let e = 0; e < f; e++) for (let t = 0; t < d; t++) {
|
|
4404
|
+
let i = n[g(t, e)];
|
|
4405
|
+
if (i === null) continue;
|
|
4406
|
+
let [o, s, c] = h[i];
|
|
4407
|
+
a.fillStyle = `rgb(${o} ${s} ${c})`, a.fillRect(t * r, e * r, r, r);
|
|
4408
|
+
}
|
|
4409
|
+
}, x = () => {
|
|
4410
|
+
o = requestAnimationFrame(x), !l && (y(), _(), b());
|
|
4411
|
+
};
|
|
4412
|
+
return o = requestAnimationFrame(x), () => {
|
|
4413
|
+
cancelAnimationFrame(o), u();
|
|
4414
|
+
};
|
|
4415
|
+
}, [
|
|
4416
|
+
r,
|
|
4417
|
+
d,
|
|
4418
|
+
t,
|
|
4419
|
+
h,
|
|
4420
|
+
f,
|
|
4421
|
+
s,
|
|
4422
|
+
e
|
|
4423
|
+
]);
|
|
4424
|
+
let _ = (e, t, n, r) => {
|
|
4425
|
+
m.current = {
|
|
4426
|
+
x: e - n.left,
|
|
4427
|
+
y: t - n.top,
|
|
4428
|
+
down: r
|
|
4429
|
+
};
|
|
4430
|
+
};
|
|
4431
|
+
return /* @__PURE__ */ u("div", {
|
|
4432
|
+
className: er.sandFall,
|
|
4433
|
+
style: { width: e },
|
|
4434
|
+
children: [/* @__PURE__ */ l("canvas", {
|
|
4435
|
+
ref: c,
|
|
4436
|
+
className: er.canvas,
|
|
4437
|
+
style: {
|
|
4438
|
+
width: e,
|
|
4439
|
+
height: t
|
|
4440
|
+
},
|
|
4441
|
+
onMouseDown: (e) => _(e.clientX, e.clientY, e.currentTarget.getBoundingClientRect(), !0),
|
|
4442
|
+
onMouseMove: (e) => {
|
|
4443
|
+
m.current.down && _(e.clientX, e.clientY, e.currentTarget.getBoundingClientRect(), !0);
|
|
4444
|
+
},
|
|
4445
|
+
onMouseUp: () => {
|
|
4446
|
+
m.current.down = !1;
|
|
4447
|
+
},
|
|
4448
|
+
onMouseLeave: () => {
|
|
4449
|
+
m.current.down = !1;
|
|
4450
|
+
},
|
|
4451
|
+
onTouchStart: (e) => {
|
|
4452
|
+
let t = e.touches[0];
|
|
4453
|
+
t && _(t.clientX, t.clientY, e.currentTarget.getBoundingClientRect(), !0);
|
|
4454
|
+
},
|
|
4455
|
+
onTouchMove: (e) => {
|
|
4456
|
+
let t = e.touches[0];
|
|
4457
|
+
t && _(t.clientX, t.clientY, e.currentTarget.getBoundingClientRect(), !0);
|
|
4458
|
+
},
|
|
4459
|
+
onTouchEnd: () => {
|
|
4460
|
+
m.current.down = !1;
|
|
4461
|
+
}
|
|
4462
|
+
}), /* @__PURE__ */ u("div", {
|
|
4463
|
+
className: er.toolbar,
|
|
4464
|
+
children: [/* @__PURE__ */ l("span", {
|
|
4465
|
+
className: er.hint,
|
|
4466
|
+
children: "按住鼠标绘制沙粒"
|
|
4467
|
+
}), /* @__PURE__ */ l("button", {
|
|
4468
|
+
type: "button",
|
|
4469
|
+
className: er.button,
|
|
4470
|
+
onClick: g,
|
|
4471
|
+
children: "Clear"
|
|
4472
|
+
})]
|
|
4473
|
+
})]
|
|
4474
|
+
});
|
|
4475
|
+
}, ir = {
|
|
3555
4476
|
splitReveal: "cos-splitReveal-6W8-6",
|
|
3556
4477
|
text: "cos-text-miTsj",
|
|
3557
4478
|
char: "cos-char-0gPJV",
|
|
@@ -3560,27 +4481,244 @@ var L = {
|
|
|
3560
4481
|
fromBottom: "cos-fromBottom-24D6g",
|
|
3561
4482
|
fromLeft: "cos-fromLeft-OMiPY",
|
|
3562
4483
|
fromRight: "cos-fromRight-EcMOR"
|
|
3563
|
-
},
|
|
4484
|
+
}, ar = [
|
|
3564
4485
|
"fromTop",
|
|
3565
4486
|
"fromBottom",
|
|
3566
4487
|
"fromLeft",
|
|
3567
4488
|
"fromRight"
|
|
3568
|
-
],
|
|
3569
|
-
className:
|
|
4489
|
+
], or = ({ text: e = "REVEAL", delay: t = 80, color: n = "#f8fafc" }) => /* @__PURE__ */ l("div", {
|
|
4490
|
+
className: ir.splitReveal,
|
|
3570
4491
|
children: /* @__PURE__ */ l("h1", {
|
|
3571
|
-
className:
|
|
4492
|
+
className: ir.text,
|
|
3572
4493
|
style: { "--reveal-color": n },
|
|
3573
4494
|
children: e.split("").map((e, n) => /* @__PURE__ */ l("span", {
|
|
3574
|
-
className: `${
|
|
4495
|
+
className: `${ir.char} ${ir[ar[n % ar.length]]}`,
|
|
3575
4496
|
style: { animationDelay: `${n * t}ms` },
|
|
3576
4497
|
children: e === " " ? "\xA0" : e
|
|
3577
4498
|
}, `${e}-${n}`))
|
|
3578
4499
|
})
|
|
3579
|
-
}),
|
|
4500
|
+
}), sr = {
|
|
4501
|
+
splitText: "cos-splitText-hz-Wy",
|
|
4502
|
+
text: "cos-text-E89BY",
|
|
4503
|
+
char: "cos-char-Rmkag",
|
|
4504
|
+
fadeUp: "cos-fadeUp-5VVYL",
|
|
4505
|
+
enter: "cos-enter-Nt9F9",
|
|
4506
|
+
fadeUpIn: "cos-fadeUpIn-eRcGj",
|
|
4507
|
+
exit: "cos-exit-oGQWA",
|
|
4508
|
+
fadeUpOut: "cos-fadeUpOut-YFnv-",
|
|
4509
|
+
scale: "cos-scale-yrOq-",
|
|
4510
|
+
scaleIn: "cos-scaleIn-0YN5q",
|
|
4511
|
+
scaleOut: "cos-scaleOut-4Q-NP",
|
|
4512
|
+
rotate: "cos-rotate-TXlZi",
|
|
4513
|
+
rotateIn: "cos-rotateIn-ixK-d",
|
|
4514
|
+
rotateOut: "cos-rotateOut-OA6Ys",
|
|
4515
|
+
blur: "cos-blur-8VyzQ",
|
|
4516
|
+
blurIn: "cos-blurIn-X-IdF",
|
|
4517
|
+
blurOut: "cos-blurOut-ZBSbO"
|
|
4518
|
+
}, cr = ({ text: e = "SPLIT TEXT", animation: t = "fadeUp", stagger: r = 50, duration: i = 500, loop: o = !0, loopPause: c = 2400, fontSize: u = 56, color: d = "#f8fafc" }) => {
|
|
4519
|
+
let [f, p] = s(!0), m = a(() => e.split(""), [e]), h = m.length * r + i;
|
|
4520
|
+
return n(() => {
|
|
4521
|
+
if (!o) return;
|
|
4522
|
+
let e, t, n = !1, r = () => {
|
|
4523
|
+
n || (p(!0), t = setTimeout(() => {
|
|
4524
|
+
n || (p(!1), e = setTimeout(r, Math.max(i, 600)));
|
|
4525
|
+
}, h + c));
|
|
4526
|
+
};
|
|
4527
|
+
return r(), () => {
|
|
4528
|
+
n = !0, e && clearTimeout(e), t && clearTimeout(t);
|
|
4529
|
+
};
|
|
4530
|
+
}, [
|
|
4531
|
+
i,
|
|
4532
|
+
o,
|
|
4533
|
+
c,
|
|
4534
|
+
h
|
|
4535
|
+
]), /* @__PURE__ */ l("div", {
|
|
4536
|
+
className: sr.splitText,
|
|
4537
|
+
children: /* @__PURE__ */ l("div", {
|
|
4538
|
+
className: sr.text,
|
|
4539
|
+
style: {
|
|
4540
|
+
fontSize: u,
|
|
4541
|
+
"--split-color": d,
|
|
4542
|
+
"--split-duration": `${i}ms`
|
|
4543
|
+
},
|
|
4544
|
+
children: m.map((e, n) => /* @__PURE__ */ l("span", {
|
|
4545
|
+
className: `${sr.char} ${sr[t]} ${f ? sr.enter : sr.exit}`,
|
|
4546
|
+
style: { animationDelay: `${n * r}ms` },
|
|
4547
|
+
children: e === " " ? "\xA0" : e
|
|
4548
|
+
}, `${e}-${n}`))
|
|
4549
|
+
})
|
|
4550
|
+
});
|
|
4551
|
+
}, lr = {
|
|
4552
|
+
springMass: "cos-springMass-cYEt6",
|
|
4553
|
+
canvas: "cos-canvas-mwL9l",
|
|
4554
|
+
hint: "cos-hint-TKLm3"
|
|
4555
|
+
}, ur = (e, t, n, r) => {
|
|
4556
|
+
let i = Math.max(3, Math.min(n, 10)), a = Math.max(3, Math.min(r, 8)), o = e * .16, s = t * .18, c = (e - o * 2) / (i - 1), l = (t - s * 2) / (a - 1), u = [];
|
|
4557
|
+
for (let e = 0; e < a; e++) for (let t = 0; t < i; t++) {
|
|
4558
|
+
let n = e === 0 && (t === 0 || t === i - 1) || e === a - 1 && (t === 0 || t === i - 1);
|
|
4559
|
+
u.push({
|
|
4560
|
+
x: o + t * c,
|
|
4561
|
+
y: s + e * l,
|
|
4562
|
+
vx: 0,
|
|
4563
|
+
vy: 0,
|
|
4564
|
+
pinned: n
|
|
4565
|
+
});
|
|
4566
|
+
}
|
|
4567
|
+
let d = [], f = (e, t) => t * i + e;
|
|
4568
|
+
for (let e = 0; e < a; e++) for (let t = 0; t < i; t++) if (t < i - 1 && d.push({
|
|
4569
|
+
a: f(t, e),
|
|
4570
|
+
b: f(t + 1, e),
|
|
4571
|
+
rest: c
|
|
4572
|
+
}), e < a - 1 && d.push({
|
|
4573
|
+
a: f(t, e),
|
|
4574
|
+
b: f(t, e + 1),
|
|
4575
|
+
rest: l
|
|
4576
|
+
}), t < i - 1 && e < a - 1) {
|
|
4577
|
+
let n = Math.hypot(c, l);
|
|
4578
|
+
d.push({
|
|
4579
|
+
a: f(t, e),
|
|
4580
|
+
b: f(t + 1, e + 1),
|
|
4581
|
+
rest: n
|
|
4582
|
+
}), d.push({
|
|
4583
|
+
a: f(t + 1, e),
|
|
4584
|
+
b: f(t, e + 1),
|
|
4585
|
+
rest: n
|
|
4586
|
+
});
|
|
4587
|
+
}
|
|
4588
|
+
return {
|
|
4589
|
+
nodes: u,
|
|
4590
|
+
springs: d,
|
|
4591
|
+
cols: i,
|
|
4592
|
+
rows: a
|
|
4593
|
+
};
|
|
4594
|
+
}, dr = ({ width: e = 560, height: t = 400, cols: r = 6, rows: i = 5, stiffness: a = .22, damping: s = .9, color: c = "#a78bfa" }) => {
|
|
4595
|
+
let d = o(null), f = o(ur(e, t, r, i)), p = o(null), m = o({
|
|
4596
|
+
x: 0,
|
|
4597
|
+
y: 0
|
|
4598
|
+
});
|
|
4599
|
+
n(() => {
|
|
4600
|
+
f.current = ur(e, t, r, i), p.current = null;
|
|
4601
|
+
}, [
|
|
4602
|
+
r,
|
|
4603
|
+
t,
|
|
4604
|
+
i,
|
|
4605
|
+
e
|
|
4606
|
+
]), n(() => {
|
|
4607
|
+
let n = d.current;
|
|
4608
|
+
if (!n) return;
|
|
4609
|
+
let r = window.devicePixelRatio || 1;
|
|
4610
|
+
n.width = e * r, n.height = t * r;
|
|
4611
|
+
let i = n.getContext("2d");
|
|
4612
|
+
if (!i) return;
|
|
4613
|
+
i.setTransform(r, 0, 0, r, 0, 0);
|
|
4614
|
+
let o = 0, l = document.hidden, u = v((e) => {
|
|
4615
|
+
l = e;
|
|
4616
|
+
}), h = Math.max(.04, Math.min(a, .8)), g = () => {
|
|
4617
|
+
let { nodes: n, springs: r } = f.current, i = p.current;
|
|
4618
|
+
if (i) {
|
|
4619
|
+
let e = n[i.index];
|
|
4620
|
+
e.x = m.current.x + i.ox, e.y = m.current.y + i.oy, e.vx = 0, e.vy = 0;
|
|
4621
|
+
}
|
|
4622
|
+
for (let e of r) {
|
|
4623
|
+
let t = n[e.a], r = n[e.b], a = r.x - t.x, o = r.y - t.y, s = Math.hypot(a, o) || .001, c = (s - e.rest) * h, l = a / s * c, u = o / s * c, d = i?.index === e.a, f = i?.index === e.b;
|
|
4624
|
+
!t.pinned && !d && (t.vx += l, t.vy += u), !r.pinned && !f && (r.vx -= l, r.vy -= u);
|
|
4625
|
+
}
|
|
4626
|
+
for (let r = 0; r < n.length; r++) {
|
|
4627
|
+
let a = n[r];
|
|
4628
|
+
if (a.pinned || i?.index === r) {
|
|
4629
|
+
a.vx = 0, a.vy = 0;
|
|
4630
|
+
continue;
|
|
4631
|
+
}
|
|
4632
|
+
a.vx *= s, a.vy *= s, a.x += a.vx, a.y += a.vy, a.x < 10 ? (a.x = 10, a.vx *= -.4) : a.x > e - 10 && (a.x = e - 10, a.vx *= -.4), a.y < 10 ? (a.y = 10, a.vy *= -.4) : a.y > t - 10 && (a.y = t - 10, a.vy *= -.4);
|
|
4633
|
+
}
|
|
4634
|
+
}, _ = () => {
|
|
4635
|
+
let { nodes: n, springs: r } = f.current;
|
|
4636
|
+
i.fillStyle = "#0f172a", i.fillRect(0, 0, e, t);
|
|
4637
|
+
for (let a of r) {
|
|
4638
|
+
let r = n[a.a], o = n[a.b], s = Math.hypot(o.x - r.x, o.y - r.y) || 1, l = Math.min(1, Math.abs(s - a.rest) / a.rest);
|
|
4639
|
+
i.beginPath(), i.moveTo(r.x, r.y), i.lineTo(o.x, o.y), i.strokeStyle = c, i.globalAlpha = .22 + l * .55, i.lineWidth = a.rest > Math.max(e, t) * .2 ? 1 : 1.6, i.stroke(), i.globalAlpha = 1;
|
|
4640
|
+
}
|
|
4641
|
+
n.forEach((e, t) => {
|
|
4642
|
+
i.beginPath(), i.arc(e.x, e.y, e.pinned ? 6 : 8, 0, Math.PI * 2), i.fillStyle = e.pinned ? "#64748b" : c, i.fill(), i.strokeStyle = "rgb(255 255 255 / 28%)", i.lineWidth = 1, i.stroke(), p.current?.index === t && (i.beginPath(), i.arc(e.x, e.y, 13, 0, Math.PI * 2), i.strokeStyle = c, i.globalAlpha = .45, i.lineWidth = 2, i.stroke(), i.globalAlpha = 1);
|
|
4643
|
+
});
|
|
4644
|
+
}, y = () => {
|
|
4645
|
+
o = requestAnimationFrame(y), !l && (g(), _());
|
|
4646
|
+
};
|
|
4647
|
+
return o = requestAnimationFrame(y), () => {
|
|
4648
|
+
cancelAnimationFrame(o), u();
|
|
4649
|
+
};
|
|
4650
|
+
}, [
|
|
4651
|
+
c,
|
|
4652
|
+
s,
|
|
4653
|
+
t,
|
|
4654
|
+
a,
|
|
4655
|
+
e
|
|
4656
|
+
]);
|
|
4657
|
+
let h = (e, t) => {
|
|
4658
|
+
let { nodes: n } = f.current, r = -1, i = 20;
|
|
4659
|
+
return n.forEach((n, a) => {
|
|
4660
|
+
if (n.pinned) return;
|
|
4661
|
+
let o = Math.hypot(n.x - e, n.y - t);
|
|
4662
|
+
o < i && (i = o, r = a);
|
|
4663
|
+
}), r;
|
|
4664
|
+
}, g = (e, t, n) => {
|
|
4665
|
+
let r = e - n.left, i = t - n.top;
|
|
4666
|
+
m.current = {
|
|
4667
|
+
x: r,
|
|
4668
|
+
y: i
|
|
4669
|
+
};
|
|
4670
|
+
let a = h(r, i);
|
|
4671
|
+
if (a < 0) return;
|
|
4672
|
+
let o = f.current.nodes[a];
|
|
4673
|
+
p.current = {
|
|
4674
|
+
index: a,
|
|
4675
|
+
ox: o.x - r,
|
|
4676
|
+
oy: o.y - i
|
|
4677
|
+
};
|
|
4678
|
+
}, _ = (e, t, n) => {
|
|
4679
|
+
m.current = {
|
|
4680
|
+
x: e - n.left,
|
|
4681
|
+
y: t - n.top
|
|
4682
|
+
};
|
|
4683
|
+
}, y = () => {
|
|
4684
|
+
p.current = null;
|
|
4685
|
+
};
|
|
4686
|
+
return /* @__PURE__ */ u("div", {
|
|
4687
|
+
className: lr.springMass,
|
|
4688
|
+
style: {
|
|
4689
|
+
width: e,
|
|
4690
|
+
height: t
|
|
4691
|
+
},
|
|
4692
|
+
children: [/* @__PURE__ */ l("canvas", {
|
|
4693
|
+
ref: d,
|
|
4694
|
+
className: lr.canvas,
|
|
4695
|
+
style: {
|
|
4696
|
+
width: e,
|
|
4697
|
+
height: t
|
|
4698
|
+
},
|
|
4699
|
+
onMouseDown: (e) => g(e.clientX, e.clientY, e.currentTarget.getBoundingClientRect()),
|
|
4700
|
+
onMouseMove: (e) => _(e.clientX, e.clientY, e.currentTarget.getBoundingClientRect()),
|
|
4701
|
+
onMouseUp: y,
|
|
4702
|
+
onMouseLeave: y,
|
|
4703
|
+
onTouchStart: (e) => {
|
|
4704
|
+
let t = e.touches[0];
|
|
4705
|
+
t && g(t.clientX, t.clientY, e.currentTarget.getBoundingClientRect());
|
|
4706
|
+
},
|
|
4707
|
+
onTouchMove: (e) => {
|
|
4708
|
+
let t = e.touches[0];
|
|
4709
|
+
t && _(t.clientX, t.clientY, e.currentTarget.getBoundingClientRect());
|
|
4710
|
+
},
|
|
4711
|
+
onTouchEnd: y
|
|
4712
|
+
}), /* @__PURE__ */ l("div", {
|
|
4713
|
+
className: lr.hint,
|
|
4714
|
+
children: "拖拽网格质点,观察弹簧回弹"
|
|
4715
|
+
})]
|
|
4716
|
+
});
|
|
4717
|
+
}, fr = {
|
|
3580
4718
|
spotlight: "cos-spotlight-OddY1",
|
|
3581
4719
|
content: "cos-content-5I1Wy",
|
|
3582
4720
|
overlay: "cos-overlay-F6CJ5"
|
|
3583
|
-
},
|
|
4721
|
+
}, pr = ({ children: e, radius: n = 120, dimColor: r = "rgba(0, 0, 0, 0.85)" }) => {
|
|
3584
4722
|
let i = o(null), a = t((e) => {
|
|
3585
4723
|
let t = i.current;
|
|
3586
4724
|
if (!t) return;
|
|
@@ -3589,18 +4727,18 @@ var L = {
|
|
|
3589
4727
|
}, []);
|
|
3590
4728
|
return /* @__PURE__ */ u("div", {
|
|
3591
4729
|
ref: i,
|
|
3592
|
-
className:
|
|
4730
|
+
className: fr.spotlight,
|
|
3593
4731
|
style: {
|
|
3594
4732
|
"--spot-radius": `${n}px`,
|
|
3595
4733
|
"--dim-color": r
|
|
3596
4734
|
},
|
|
3597
4735
|
onMouseMove: a,
|
|
3598
4736
|
children: [/* @__PURE__ */ l("div", {
|
|
3599
|
-
className:
|
|
4737
|
+
className: fr.content,
|
|
3600
4738
|
children: e
|
|
3601
|
-
}), /* @__PURE__ */ l("div", { className:
|
|
4739
|
+
}), /* @__PURE__ */ l("div", { className: fr.overlay })]
|
|
3602
4740
|
});
|
|
3603
|
-
},
|
|
4741
|
+
}, mr = {
|
|
3604
4742
|
turntable: "cos-turntable-dkc32",
|
|
3605
4743
|
wheelWrap: "cos-wheelWrap-n7lhc",
|
|
3606
4744
|
canvas: "cos-canvas-A1-4x",
|
|
@@ -3608,7 +4746,7 @@ var L = {
|
|
|
3608
4746
|
spinBtn: "cos-spinBtn-l9JIC",
|
|
3609
4747
|
result: "cos-result-H8q2c",
|
|
3610
4748
|
"fade-in": "cos-fade-in-U9bUC"
|
|
3611
|
-
},
|
|
4749
|
+
}, hr = [
|
|
3612
4750
|
"#FF6B6B",
|
|
3613
4751
|
"#4ECDC4",
|
|
3614
4752
|
"#FFE66D",
|
|
@@ -3617,19 +4755,19 @@ var L = {
|
|
|
3617
4755
|
"#F472B6",
|
|
3618
4756
|
"#34D399",
|
|
3619
4757
|
"#FB923C"
|
|
3620
|
-
],
|
|
4758
|
+
], gr = [
|
|
3621
4759
|
{ label: "一等奖" },
|
|
3622
4760
|
{ label: "二等奖" },
|
|
3623
4761
|
{ label: "三等奖" },
|
|
3624
4762
|
{ label: "谢谢参与" },
|
|
3625
4763
|
{ label: "优惠券" },
|
|
3626
4764
|
{ label: "再来一次" }
|
|
3627
|
-
],
|
|
4765
|
+
], _r = (e) => 1 - (1 - e) ** 3, vr = ({ prizes: e = gr, size: r = 360, spinDuration: i = 4e3, spinRounds: a = 5, buttonText: c = "开始抽奖", onSpinEnd: d }) => {
|
|
3628
4766
|
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
4767
|
n(() => {
|
|
3630
4768
|
b.current = d;
|
|
3631
4769
|
}, [d]);
|
|
3632
|
-
let S = r + 48, C = (e, t) => t.color ??
|
|
4770
|
+
let S = r + 48, C = (e, t) => t.color ?? hr[e % hr.length], w = t((t) => {
|
|
3633
4771
|
let n = f.current;
|
|
3634
4772
|
if (!n) return;
|
|
3635
4773
|
let i = n.getContext("2d");
|
|
@@ -3664,22 +4802,22 @@ var L = {
|
|
|
3664
4802
|
return Math.floor((360 - r + n / 2) % 360 / n) % e.length;
|
|
3665
4803
|
};
|
|
3666
4804
|
return /* @__PURE__ */ u("div", {
|
|
3667
|
-
className:
|
|
4805
|
+
className: mr.turntable,
|
|
3668
4806
|
style: {
|
|
3669
4807
|
width: S,
|
|
3670
4808
|
height: S + 80
|
|
3671
4809
|
},
|
|
3672
4810
|
children: [/* @__PURE__ */ u("div", {
|
|
3673
|
-
className:
|
|
4811
|
+
className: mr.wheelWrap,
|
|
3674
4812
|
style: {
|
|
3675
4813
|
width: S,
|
|
3676
4814
|
height: S
|
|
3677
4815
|
},
|
|
3678
4816
|
children: [
|
|
3679
|
-
/* @__PURE__ */ l("div", { className:
|
|
4817
|
+
/* @__PURE__ */ l("div", { className: mr.pointer }),
|
|
3680
4818
|
/* @__PURE__ */ l("canvas", {
|
|
3681
4819
|
ref: f,
|
|
3682
|
-
className:
|
|
4820
|
+
className: mr.canvas,
|
|
3683
4821
|
style: {
|
|
3684
4822
|
width: S,
|
|
3685
4823
|
height: S
|
|
@@ -3687,7 +4825,7 @@ var L = {
|
|
|
3687
4825
|
}),
|
|
3688
4826
|
/* @__PURE__ */ l("button", {
|
|
3689
4827
|
type: "button",
|
|
3690
|
-
className:
|
|
4828
|
+
className: mr.spinBtn,
|
|
3691
4829
|
onClick: () => {
|
|
3692
4830
|
if (g || e.length === 0) return;
|
|
3693
4831
|
_(!0), y(null);
|
|
@@ -3695,7 +4833,7 @@ var L = {
|
|
|
3695
4833
|
x.current = l;
|
|
3696
4834
|
let u = (t) => {
|
|
3697
4835
|
if (l.cancelled) return;
|
|
3698
|
-
let n = t - c, r = Math.min(n / i, 1), a =
|
|
4836
|
+
let n = t - c, r = Math.min(n / i, 1), a = _r(r), d = s + (o - s) * a;
|
|
3699
4837
|
if (p.current = d, w(d), r < 1) m.current = requestAnimationFrame(u);
|
|
3700
4838
|
else if (!l.cancelled) {
|
|
3701
4839
|
let t = T(d), n = e[t];
|
|
@@ -3709,11 +4847,65 @@ var L = {
|
|
|
3709
4847
|
})
|
|
3710
4848
|
]
|
|
3711
4849
|
}), v && !g && /* @__PURE__ */ u("p", {
|
|
3712
|
-
className:
|
|
4850
|
+
className: mr.result,
|
|
3713
4851
|
children: ["恭喜获得:", /* @__PURE__ */ l("strong", { children: v.label })]
|
|
3714
4852
|
})]
|
|
3715
4853
|
});
|
|
3716
|
-
},
|
|
4854
|
+
}, yr = {
|
|
4855
|
+
textMorph: "cos-textMorph-W-C1e",
|
|
4856
|
+
stage: "cos-stage-AaMn6",
|
|
4857
|
+
layer: "cos-layer-N-4oM"
|
|
4858
|
+
}, br = [
|
|
4859
|
+
"COS DESIGN",
|
|
4860
|
+
"TEXT MORPH",
|
|
4861
|
+
"SMOOTH TRANSITION"
|
|
4862
|
+
], xr = (e, t, n) => Math.min(n, Math.max(t, e)), Sr = ({ texts: e = br, interval: t = 2200, duration: r = 680, fontSize: i = 64, color: c = "#f8fafc" }) => {
|
|
4863
|
+
let d = a(() => e.length > 0 ? e : br, [e]), [f, p] = s(0), [m, h] = s(0), g = o(0), _ = o(0);
|
|
4864
|
+
n(() => (_.current = window.setTimeout(() => {
|
|
4865
|
+
let e = performance.now(), t = (n) => {
|
|
4866
|
+
let i = xr((n - e) / Math.max(r, 16), 0, 1);
|
|
4867
|
+
if (h(i), i < 1) {
|
|
4868
|
+
g.current = requestAnimationFrame(t);
|
|
4869
|
+
return;
|
|
4870
|
+
}
|
|
4871
|
+
p((e) => (e + 1) % d.length), h(0);
|
|
4872
|
+
};
|
|
4873
|
+
g.current = requestAnimationFrame(t);
|
|
4874
|
+
}, t), () => {
|
|
4875
|
+
window.clearTimeout(_.current), cancelAnimationFrame(g.current);
|
|
4876
|
+
}), [
|
|
4877
|
+
r,
|
|
4878
|
+
f,
|
|
4879
|
+
t,
|
|
4880
|
+
d
|
|
4881
|
+
]);
|
|
4882
|
+
let v = d[f], y = d[(f + 1) % d.length], b = 1 - m, x = m, S = m * 14, C = (1 - m) * 14, w = 1 - m * .08, T = .92 + m * .08;
|
|
4883
|
+
return /* @__PURE__ */ l("div", {
|
|
4884
|
+
className: yr.textMorph,
|
|
4885
|
+
style: { "--morph-color": c },
|
|
4886
|
+
children: /* @__PURE__ */ u("div", {
|
|
4887
|
+
className: yr.stage,
|
|
4888
|
+
style: { fontSize: i },
|
|
4889
|
+
children: [/* @__PURE__ */ l("span", {
|
|
4890
|
+
className: `${yr.layer} ${yr.current}`,
|
|
4891
|
+
style: {
|
|
4892
|
+
opacity: b,
|
|
4893
|
+
filter: `blur(${S}px)`,
|
|
4894
|
+
transform: `scale(${w}) translateY(${m * -8}px)`
|
|
4895
|
+
},
|
|
4896
|
+
children: v
|
|
4897
|
+
}), /* @__PURE__ */ l("span", {
|
|
4898
|
+
className: `${yr.layer} ${yr.next}`,
|
|
4899
|
+
style: {
|
|
4900
|
+
opacity: x,
|
|
4901
|
+
filter: `blur(${C}px)`,
|
|
4902
|
+
transform: `scale(${T}) translateY(${(1 - m) * 8}px)`
|
|
4903
|
+
},
|
|
4904
|
+
children: y
|
|
4905
|
+
})]
|
|
4906
|
+
})
|
|
4907
|
+
});
|
|
4908
|
+
}, Cr = {
|
|
3717
4909
|
typewriter: "cos-typewriter-7UhOL",
|
|
3718
4910
|
terminal: "cos-terminal-NWNVN",
|
|
3719
4911
|
dots: "cos-dots-oulNg",
|
|
@@ -3721,11 +4913,11 @@ var L = {
|
|
|
3721
4913
|
prompt: "cos-prompt-Y4hVD",
|
|
3722
4914
|
cursor: "cos-cursor-m8hGi",
|
|
3723
4915
|
blink: "cos-blink-XykM7"
|
|
3724
|
-
},
|
|
4916
|
+
}, wr = [
|
|
3725
4917
|
"Hello, cos-design!",
|
|
3726
4918
|
"欢迎来到组件库 ✨",
|
|
3727
4919
|
"Build something fun 🚀"
|
|
3728
|
-
],
|
|
4920
|
+
], Tr = ({ texts: e, speed: t, deleteSpeed: r, pause: i }) => {
|
|
3729
4921
|
let [a, o] = s(""), [c, d] = s(0), [f, p] = s(!1);
|
|
3730
4922
|
return n(() => {
|
|
3731
4923
|
let n = e[c % e.length], s;
|
|
@@ -3747,114 +4939,365 @@ var L = {
|
|
|
3747
4939
|
r,
|
|
3748
4940
|
i
|
|
3749
4941
|
]), /* @__PURE__ */ l("div", {
|
|
3750
|
-
className:
|
|
4942
|
+
className: Cr.typewriter,
|
|
3751
4943
|
children: /* @__PURE__ */ u("div", {
|
|
3752
|
-
className:
|
|
4944
|
+
className: Cr.terminal,
|
|
3753
4945
|
children: [/* @__PURE__ */ u("div", {
|
|
3754
|
-
className:
|
|
4946
|
+
className: Cr.dots,
|
|
3755
4947
|
children: [
|
|
3756
4948
|
/* @__PURE__ */ l("span", {}),
|
|
3757
4949
|
/* @__PURE__ */ l("span", {}),
|
|
3758
4950
|
/* @__PURE__ */ l("span", {})
|
|
3759
4951
|
]
|
|
3760
4952
|
}), /* @__PURE__ */ u("p", {
|
|
3761
|
-
className:
|
|
4953
|
+
className: Cr.text,
|
|
3762
4954
|
children: [
|
|
3763
4955
|
/* @__PURE__ */ l("span", {
|
|
3764
|
-
className:
|
|
4956
|
+
className: Cr.prompt,
|
|
3765
4957
|
children: ">"
|
|
3766
4958
|
}),
|
|
3767
4959
|
a,
|
|
3768
4960
|
/* @__PURE__ */ l("span", {
|
|
3769
|
-
className:
|
|
4961
|
+
className: Cr.cursor,
|
|
3770
4962
|
children: "|"
|
|
3771
4963
|
})
|
|
3772
4964
|
]
|
|
3773
4965
|
})]
|
|
3774
4966
|
})
|
|
3775
4967
|
});
|
|
3776
|
-
},
|
|
3777
|
-
let i = e.length > 0 ? e :
|
|
3778
|
-
return /* @__PURE__ */ l(
|
|
4968
|
+
}, Er = ({ texts: e = wr, speed: t = 100, deleteSpeed: n = 50, pause: r = 2e3 }) => {
|
|
4969
|
+
let i = e.length > 0 ? e : wr;
|
|
4970
|
+
return /* @__PURE__ */ l(Tr, {
|
|
3779
4971
|
texts: i,
|
|
3780
4972
|
speed: t,
|
|
3781
4973
|
deleteSpeed: n,
|
|
3782
4974
|
pause: r
|
|
3783
4975
|
}, i.join("\0"));
|
|
3784
|
-
},
|
|
4976
|
+
}, Dr = {
|
|
3785
4977
|
waveButton: "cos-waveButton-Aa7G-",
|
|
3786
4978
|
btn: "cos-btn-WJrEN",
|
|
3787
4979
|
label: "cos-label-9BHOU",
|
|
3788
4980
|
wave: "cos-wave-GycLU",
|
|
3789
4981
|
ripple: "cos-ripple-5ZFpr"
|
|
3790
|
-
},
|
|
3791
|
-
className:
|
|
4982
|
+
}, Or = ({ text: e = "点我试试", color: t = "#38bdf8", className: n, style: r, ...i }) => /* @__PURE__ */ l("div", {
|
|
4983
|
+
className: Dr.waveButton,
|
|
3792
4984
|
children: /* @__PURE__ */ u("button", {
|
|
3793
4985
|
type: "button",
|
|
3794
|
-
className: `${
|
|
4986
|
+
className: `${Dr.btn} ${n ?? ""}`,
|
|
3795
4987
|
style: {
|
|
3796
4988
|
"--wave-color": t,
|
|
3797
4989
|
...r
|
|
3798
4990
|
},
|
|
3799
4991
|
...i,
|
|
3800
4992
|
children: [
|
|
3801
|
-
/* @__PURE__ */ l("span", { className:
|
|
3802
|
-
/* @__PURE__ */ l("span", { className:
|
|
4993
|
+
/* @__PURE__ */ l("span", { className: Dr.wave }),
|
|
4994
|
+
/* @__PURE__ */ l("span", { className: Dr.wave }),
|
|
3803
4995
|
/* @__PURE__ */ l("span", {
|
|
3804
|
-
className:
|
|
4996
|
+
className: Dr.label,
|
|
3805
4997
|
children: e
|
|
3806
4998
|
})
|
|
3807
4999
|
]
|
|
3808
5000
|
})
|
|
3809
|
-
}),
|
|
5001
|
+
}), kr = (e) => Math.min(1, Math.max(0, e)), Ar = (e) => {
|
|
5002
|
+
let t = e.replace("#", "").trim(), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t;
|
|
5003
|
+
if (n.length !== 6) return [
|
|
5004
|
+
80,
|
|
5005
|
+
140,
|
|
5006
|
+
200
|
|
5007
|
+
];
|
|
5008
|
+
let r = Number.parseInt(n, 16);
|
|
5009
|
+
return Number.isNaN(r) ? [
|
|
5010
|
+
80,
|
|
5011
|
+
140,
|
|
5012
|
+
200
|
|
5013
|
+
] : [
|
|
5014
|
+
r >> 16 & 255,
|
|
5015
|
+
r >> 8 & 255,
|
|
5016
|
+
r & 255
|
|
5017
|
+
];
|
|
5018
|
+
}, jr = ([e, t, n]) => {
|
|
5019
|
+
let r = (e) => Math.min(255, Math.max(0, Math.round(e))).toString(16).padStart(2, "0");
|
|
5020
|
+
return `#${r(e)}${r(t)}${r(n)}`;
|
|
5021
|
+
}, Mr = (e, t, n) => e + (t - e) * n, Nr = (e, t, n) => [
|
|
5022
|
+
Mr(e[0], t[0], n),
|
|
5023
|
+
Mr(e[1], t[1], n),
|
|
5024
|
+
Mr(e[2], t[2], n)
|
|
5025
|
+
], Q = (e, t, n) => jr(Nr(Ar(e), Ar(t), kr(n))), Pr = (e) => {
|
|
5026
|
+
let t = kr(e);
|
|
5027
|
+
return t * t * (3 - 2 * t);
|
|
5028
|
+
}, Fr = (e = Date.now()) => {
|
|
5029
|
+
let t = new Date(e), n = new Date(t);
|
|
5030
|
+
n.setHours(6, 0, 0, 0);
|
|
5031
|
+
let r = new Date(t);
|
|
5032
|
+
return r.setHours(18, 0, 0, 0), {
|
|
5033
|
+
sunrise: n.getTime(),
|
|
5034
|
+
sunset: r.getTime()
|
|
5035
|
+
};
|
|
5036
|
+
}, Ir = (e, t = /* @__PURE__ */ new Date()) => {
|
|
5037
|
+
let n = e.trim().match(/^(\d{1,2}):(\d{2})$/);
|
|
5038
|
+
if (!n) return null;
|
|
5039
|
+
let r = Number(n[1]), i = Number(n[2]);
|
|
5040
|
+
if (r < 0 || r > 23 || i < 0 || i > 59) return null;
|
|
5041
|
+
let a = new Date(t);
|
|
5042
|
+
return a.setHours(r, i, 0, 0), a.getTime();
|
|
5043
|
+
}, Lr = (e, t = /* @__PURE__ */ new Date()) => Ir(e ?? "14:00", t) ?? Ir("14:00", t), Rr = (e, t) => {
|
|
5044
|
+
let { sunrise: n, sunset: r } = t;
|
|
5045
|
+
if (!(r > n)) {
|
|
5046
|
+
let t = Fr(e);
|
|
5047
|
+
n = t.sunrise, r = t.sunset;
|
|
5048
|
+
}
|
|
5049
|
+
let i = Math.max(1, r - n), a = n + 1440 * 60 * 1e3, o = r - 1440 * 60 * 1e3, s = e >= n && e < r, c;
|
|
5050
|
+
if (s) c = kr((e - n) / i);
|
|
5051
|
+
else if (e >= r) {
|
|
5052
|
+
let t = Math.max(1, a - r);
|
|
5053
|
+
c = kr((e - r) / t);
|
|
5054
|
+
} else {
|
|
5055
|
+
let t = Math.max(1, n - o);
|
|
5056
|
+
c = kr((e - o) / t);
|
|
5057
|
+
}
|
|
5058
|
+
let l = s ? Math.sin(Math.PI * c) : 0, u = Math.abs(e - n), d = Math.abs(e - r), f = kr(1 - Math.min(u, d) / 45e5);
|
|
5059
|
+
return {
|
|
5060
|
+
isDay: s,
|
|
5061
|
+
arcProgress: c,
|
|
5062
|
+
elevation: l,
|
|
5063
|
+
twilight: f
|
|
5064
|
+
};
|
|
5065
|
+
}, zr = (e, t, n) => {
|
|
5066
|
+
let r = kr(n), i = Math.sin(Math.PI * r);
|
|
5067
|
+
return {
|
|
5068
|
+
x: e * (.1 + .8 * r),
|
|
5069
|
+
y: t * (.58 - .4 * i)
|
|
5070
|
+
};
|
|
5071
|
+
}, Br = "#e8895c", Vr = "#f3c98a", Hr = "#2a1f4a", Ur = "#c4784a", Wr = (e, t, n) => {
|
|
5072
|
+
if (n.isDay) {
|
|
5073
|
+
let t = Pr(n.elevation), r = (1 - t) * .72;
|
|
5074
|
+
return [Q(Q(e[0], Br, r), "#1a2438", (1 - t) * .12), Q(Q(e[1], Vr, r * .85), "#3a4558", (1 - t) * .08)];
|
|
5075
|
+
}
|
|
5076
|
+
let r = n.twilight;
|
|
5077
|
+
return [Q(t[0], Q(Hr, Br, .35), r * .55), Q(t[1], Q(Ur, Vr, .4), r * .7)];
|
|
5078
|
+
}, Gr = (e, t, n) => {
|
|
5079
|
+
let r = e.createLinearGradient(0, 0, 0, t);
|
|
5080
|
+
return r.addColorStop(0, n[0]), r.addColorStop(1, n[1]), r;
|
|
5081
|
+
}, Kr = (e) => {
|
|
5082
|
+
if (!e.isDay) return {
|
|
5083
|
+
scale: .92 + e.twilight * .06,
|
|
5084
|
+
alpha: .75 + e.twilight * .2
|
|
5085
|
+
};
|
|
5086
|
+
let t = e.elevation;
|
|
5087
|
+
return {
|
|
5088
|
+
scale: .82 + t * .22,
|
|
5089
|
+
alpha: .65 + t * .35
|
|
5090
|
+
};
|
|
5091
|
+
}, qr = 2, Jr = [
|
|
5092
|
+
"",
|
|
5093
|
+
"薄雾",
|
|
5094
|
+
"中雾",
|
|
5095
|
+
"浓雾"
|
|
5096
|
+
], Yr = (e) => Math.min(3, Math.max(1, Math.round(e))), Xr = (e) => {
|
|
5097
|
+
let t = Yr(e);
|
|
5098
|
+
return `${t} · ${Jr[t]}`;
|
|
5099
|
+
}, Zr = (e) => e === "fog", Qr = (e, t) => {
|
|
5100
|
+
let n = Yr(t);
|
|
5101
|
+
return n === 1 ? {
|
|
5102
|
+
...e,
|
|
5103
|
+
fogBanks: 3,
|
|
5104
|
+
haze: .06,
|
|
5105
|
+
cloudAlpha: Math.min(e.cloudAlpha, .28),
|
|
5106
|
+
sun: "soft"
|
|
5107
|
+
} : n === 3 ? {
|
|
5108
|
+
...e,
|
|
5109
|
+
fogBanks: 12,
|
|
5110
|
+
haze: .3,
|
|
5111
|
+
cloudAlpha: .42,
|
|
5112
|
+
sun: "dim"
|
|
5113
|
+
} : {
|
|
5114
|
+
...e,
|
|
5115
|
+
fogBanks: 5,
|
|
5116
|
+
haze: .11,
|
|
5117
|
+
cloudAlpha: .32,
|
|
5118
|
+
sun: "dim"
|
|
5119
|
+
};
|
|
5120
|
+
}, $r = (e) => {
|
|
5121
|
+
let t = Yr(e);
|
|
5122
|
+
return t === 1 ? .45 : t === 3 ? .95 : .65;
|
|
5123
|
+
}, ei = (e) => e === 45 ? 2 : e === 48 ? 3 : null, ti = (e) => e == null || !Number.isFinite(e) ? null : e >= 5e3 ? 1 : e >= 1e3 ? 2 : 3, ni = 2, ri = [
|
|
5124
|
+
"",
|
|
5125
|
+
"细雹",
|
|
5126
|
+
"密雹",
|
|
5127
|
+
"巨雹"
|
|
5128
|
+
], ii = (e) => Math.min(3, Math.max(1, Math.round(e))), ai = (e) => {
|
|
5129
|
+
let t = ii(e);
|
|
5130
|
+
return `${t} · ${ri[t]}`;
|
|
5131
|
+
}, oi = (e) => e === "hail", si = (e) => {
|
|
5132
|
+
let t = ii(e);
|
|
5133
|
+
return t === 1 ? {
|
|
5134
|
+
count: 75,
|
|
5135
|
+
sizeMin: .85,
|
|
5136
|
+
sizeMax: 2.1,
|
|
5137
|
+
speedMul: .88
|
|
5138
|
+
} : t === 3 ? {
|
|
5139
|
+
count: 210,
|
|
5140
|
+
sizeMin: 2.4,
|
|
5141
|
+
sizeMax: 5.6,
|
|
5142
|
+
speedMul: 1.22
|
|
5143
|
+
} : {
|
|
5144
|
+
count: 145,
|
|
5145
|
+
sizeMin: 1.4,
|
|
5146
|
+
sizeMax: 3.8,
|
|
5147
|
+
speedMul: 1
|
|
5148
|
+
};
|
|
5149
|
+
}, ci = (e) => e === 96 ? 2 : e === 99 ? 3 : null, li = 1, ui = 10, di = 5, fi = 5, $ = (e) => Math.min(10, Math.max(1, Math.round(e))), pi = (e, t, n) => e + (t - e) * n, mi = (e) => {
|
|
5150
|
+
let t = $(e);
|
|
5151
|
+
return t <= 2 ? 1 : t <= 4 ? 2 : t <= 6 ? 3 : t <= 8 ? 4 : 5;
|
|
5152
|
+
}, hi = [
|
|
5153
|
+
"毛毛雨",
|
|
5154
|
+
"小雨",
|
|
5155
|
+
"中雨",
|
|
5156
|
+
"暴雨",
|
|
5157
|
+
"特大暴雨"
|
|
5158
|
+
], gi = [
|
|
5159
|
+
"毛毛雪",
|
|
5160
|
+
"小雪",
|
|
5161
|
+
"中雪",
|
|
5162
|
+
"暴雪",
|
|
5163
|
+
"特大暴雪"
|
|
5164
|
+
], _i = (e, t) => {
|
|
5165
|
+
let n = mi(e);
|
|
5166
|
+
return (t === "rain" ? hi : gi)[n - 1];
|
|
5167
|
+
}, vi = (e, t) => `${$(e)} · ${_i(e, t)}`, yi = ["", ...hi], bi = ["", ...gi], xi = (e) => e === "lightRain" || e === "moderateRain" || e === "heavyRain" ? "rain" : e === "lightSnow" || e === "moderateSnow" || e === "heavySnow" ? "snow" : e, Si = (e) => e === "rain" || e === "lightRain" || e === "moderateRain" || e === "heavyRain", Ci = (e) => e === "snow" || e === "lightSnow" || e === "moderateSnow" || e === "heavySnow", wi = (e) => Si(e) || e === "thunderstorm" || e === "sleet", Ti = (e) => Ci(e) || e === "sleet", Ei = (e, t = 5) => e === "lightRain" ? 3 : e === "moderateRain" ? 5 : e === "heavyRain" ? 8 : $(t), Di = (e, t = 5) => e === "lightSnow" ? 3 : e === "moderateSnow" ? 5 : e === "heavySnow" ? 8 : $(t), Oi = (e, t) => t === "rain" ? e <= 2 ? "lightRain" : e === 3 ? "moderateRain" : "heavyRain" : e <= 2 ? "lightSnow" : e === 3 ? "moderateSnow" : "heavySnow", ki = (e, t = 5, n = 5) => e === "rain" ? Oi(mi(t), "rain") : e === "lightRain" || e === "moderateRain" || e === "heavyRain" ? Oi(mi(Ei(e)), "rain") : e === "snow" ? Oi(mi(n), "snow") : e === "lightSnow" || e === "moderateSnow" || e === "heavySnow" ? Oi(mi(Di(e)), "snow") : e, Ai = (e, t) => {
|
|
5168
|
+
let n = ($(t) - 1) / 9;
|
|
5169
|
+
return {
|
|
5170
|
+
count: Math.round(pi(35, 340, n)),
|
|
5171
|
+
speed: pi(5.5, 16, n),
|
|
5172
|
+
wind: pi(-.4, -3.2, n),
|
|
5173
|
+
alpha: pi(.28, .62, n),
|
|
5174
|
+
splash: $(t) >= 5
|
|
5175
|
+
};
|
|
5176
|
+
}, ji = (e) => {
|
|
5177
|
+
let t = ($(e) - 1) / 9;
|
|
5178
|
+
return Math.round(pi(30, 360, t));
|
|
5179
|
+
}, Mi = (e) => [51, 56].includes(e) ? 2 : [
|
|
5180
|
+
61,
|
|
5181
|
+
66,
|
|
5182
|
+
80
|
|
5183
|
+
].includes(e) ? 3 : [
|
|
5184
|
+
53,
|
|
5185
|
+
55,
|
|
5186
|
+
57,
|
|
5187
|
+
63,
|
|
5188
|
+
81
|
|
5189
|
+
].includes(e) ? 5 : [65, 67].includes(e) ? 8 : [82].includes(e) ? 10 : [95].includes(e) ? 7 : null, Ni = (e) => [77].includes(e) ? 2 : [71, 85].includes(e) ? 3 : [73].includes(e) ? 5 : [75].includes(e) ? 8 : [86].includes(e) ? 10 : null, Pi = 2, Fi = [
|
|
5190
|
+
"",
|
|
5191
|
+
"轻霾",
|
|
5192
|
+
"中霾",
|
|
5193
|
+
"重霾"
|
|
5194
|
+
], Ii = (e) => Math.min(3, Math.max(1, Math.round(e))), Li = (e) => {
|
|
5195
|
+
let t = Ii(e);
|
|
5196
|
+
return `${t} · ${Fi[t]}`;
|
|
5197
|
+
}, Ri = (e) => e === "smog", zi = (e, t) => {
|
|
5198
|
+
let n = Ii(t);
|
|
5199
|
+
return n === 1 ? {
|
|
5200
|
+
...e,
|
|
5201
|
+
fogBanks: 5,
|
|
5202
|
+
haze: .16,
|
|
5203
|
+
cloudAlpha: Math.min(e.cloudAlpha, .28),
|
|
5204
|
+
sun: "soft"
|
|
5205
|
+
} : n === 3 ? {
|
|
5206
|
+
...e,
|
|
5207
|
+
fogBanks: 16,
|
|
5208
|
+
haze: .48,
|
|
5209
|
+
cloudAlpha: .42,
|
|
5210
|
+
sun: "dim"
|
|
5211
|
+
} : {
|
|
5212
|
+
...e,
|
|
5213
|
+
fogBanks: 12,
|
|
5214
|
+
haze: .34,
|
|
5215
|
+
cloudAlpha: .35,
|
|
5216
|
+
sun: "dim"
|
|
5217
|
+
};
|
|
5218
|
+
}, Bi = (e) => {
|
|
5219
|
+
let t = Ii(e);
|
|
5220
|
+
return t === 1 ? .55 : t === 3 ? 1.05 : .85;
|
|
5221
|
+
}, Vi = (e) => e == null || !Number.isFinite(e) ? null : e >= 5e3 ? 1 : e >= 1e3 ? 2 : 3, Hi = {
|
|
3810
5222
|
0: "sunny",
|
|
3811
5223
|
1: "sunny",
|
|
3812
5224
|
2: "partlyCloudy",
|
|
3813
5225
|
3: "overcast",
|
|
3814
5226
|
45: "fog",
|
|
3815
5227
|
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: "
|
|
5228
|
+
51: "rain",
|
|
5229
|
+
53: "rain",
|
|
5230
|
+
55: "rain",
|
|
5231
|
+
56: "rain",
|
|
5232
|
+
57: "rain",
|
|
5233
|
+
61: "rain",
|
|
5234
|
+
63: "rain",
|
|
5235
|
+
65: "rain",
|
|
5236
|
+
66: "rain",
|
|
5237
|
+
67: "rain",
|
|
5238
|
+
80: "rain",
|
|
5239
|
+
81: "rain",
|
|
5240
|
+
82: "rain",
|
|
5241
|
+
71: "snow",
|
|
5242
|
+
73: "snow",
|
|
5243
|
+
75: "snow",
|
|
5244
|
+
77: "snow",
|
|
5245
|
+
85: "snow",
|
|
5246
|
+
86: "snow",
|
|
3835
5247
|
95: "thunderstorm",
|
|
3836
5248
|
96: "hail",
|
|
3837
5249
|
99: "hail"
|
|
3838
|
-
},
|
|
3839
|
-
let n = vn[e] ?? "overcast";
|
|
3840
|
-
return (n === "sunny" || n === "partlyCloudy" || n === "overcast") && t >= _n ? "gale" : n;
|
|
3841
|
-
}, bn = {
|
|
5250
|
+
}, Ui = (e) => xi(Hi[e] ?? "overcast"), Wi = {
|
|
3842
5251
|
weather: null,
|
|
5252
|
+
rainLevel: null,
|
|
5253
|
+
snowLevel: null,
|
|
5254
|
+
fogLevel: null,
|
|
5255
|
+
hailLevel: null,
|
|
5256
|
+
smogLevel: null,
|
|
3843
5257
|
status: "idle",
|
|
3844
5258
|
error: null,
|
|
3845
5259
|
current: null
|
|
3846
|
-
},
|
|
5260
|
+
}, Gi = {
|
|
3847
5261
|
weather: null,
|
|
5262
|
+
rainLevel: null,
|
|
5263
|
+
snowLevel: null,
|
|
5264
|
+
fogLevel: null,
|
|
5265
|
+
hailLevel: null,
|
|
5266
|
+
smogLevel: null,
|
|
3848
5267
|
status: "locating",
|
|
3849
5268
|
error: null,
|
|
3850
5269
|
current: null
|
|
3851
|
-
},
|
|
5270
|
+
}, Ki = {
|
|
3852
5271
|
weather: null,
|
|
5272
|
+
rainLevel: null,
|
|
5273
|
+
snowLevel: null,
|
|
5274
|
+
fogLevel: null,
|
|
5275
|
+
hailLevel: null,
|
|
5276
|
+
smogLevel: null,
|
|
3853
5277
|
status: "fetching",
|
|
3854
5278
|
error: null,
|
|
3855
5279
|
current: null
|
|
3856
|
-
},
|
|
3857
|
-
|
|
5280
|
+
}, qi = (e) => e != null && Number.isFinite(e.latitude) && Number.isFinite(e.longitude), Ji = (e) => {
|
|
5281
|
+
if (typeof e != "string" || !e) return null;
|
|
5282
|
+
let t = Date.parse(e);
|
|
5283
|
+
return Number.isFinite(t) ? t : null;
|
|
5284
|
+
}, Yi = (e) => {
|
|
5285
|
+
if (typeof e != "string" || !e) return null;
|
|
5286
|
+
let t = e.match(/T(\d{2}):(\d{2})/);
|
|
5287
|
+
return t ? `${t[1]}:${t[2]}` : null;
|
|
5288
|
+
}, Xi = (e, t) => {
|
|
5289
|
+
if (e) try {
|
|
5290
|
+
let t = new Intl.DateTimeFormat("en-GB", {
|
|
5291
|
+
timeZone: e,
|
|
5292
|
+
hour: "2-digit",
|
|
5293
|
+
minute: "2-digit",
|
|
5294
|
+
hour12: !1
|
|
5295
|
+
}).formatToParts(/* @__PURE__ */ new Date()), n = t.find((e) => e.type === "hour")?.value, r = t.find((e) => e.type === "minute")?.value;
|
|
5296
|
+
if (n != null && r != null) return `${n.padStart(2, "0")}:${r.padStart(2, "0")}`;
|
|
5297
|
+
} catch {}
|
|
5298
|
+
return t ?? null;
|
|
5299
|
+
}, Zi = (e = !0, t) => {
|
|
5300
|
+
let r = qi(t), i = r ? t.latitude : null, a = r ? t.longitude : null, o = e ? r ? Ki : Gi : Wi, c = `${e}:${i},${a}`, [l, u] = s(o), [d, f] = s(c);
|
|
3858
5301
|
return d !== c && (f(c), u((t) => e && t.weather ? {
|
|
3859
5302
|
...o,
|
|
3860
5303
|
weather: t.weather,
|
|
@@ -3866,15 +5309,23 @@ var L = {
|
|
|
3866
5309
|
let i = new URLSearchParams({
|
|
3867
5310
|
latitude: String(e),
|
|
3868
5311
|
longitude: String(r),
|
|
3869
|
-
current: "weather_code,wind_speed_10m,is_day"
|
|
5312
|
+
current: "weather_code,wind_speed_10m,is_day,visibility",
|
|
5313
|
+
daily: "sunrise,sunset",
|
|
5314
|
+
timezone: "auto",
|
|
5315
|
+
forecast_days: "1"
|
|
3870
5316
|
}), a = await fetch(`https://api.open-meteo.com/v1/forecast?${i}`, { signal: n.signal });
|
|
3871
5317
|
if (!a.ok) throw Error(`Open-Meteo 请求失败(HTTP ${a.status})`);
|
|
3872
5318
|
let o = await a.json(), s = Number(o?.current?.weather_code);
|
|
3873
5319
|
if (Number.isNaN(s)) throw Error("Open-Meteo 返回数据缺少 weather_code");
|
|
3874
|
-
let c = Number(o?.current?.wind_speed_10m ?? 0);
|
|
5320
|
+
let c = Number(o?.current?.wind_speed_10m ?? 0), l = Ji(o?.daily?.sunrise?.[0]), d = Ji(o?.daily?.sunset?.[0]), f = typeof o?.timezone == "string" ? o.timezone : null, p = Yi(o?.current?.time) ?? Xi(f), m = Ui(s), h = Mi(s), g = Ni(s), _ = o?.current?.visibility, v = _ != null && Number.isFinite(Number(_)) ? Number(_) : null, y = m === "fog" ? ti(v) ?? ei(s) ?? 2 : null, b = m === "hail" ? ci(s) ?? 2 : null, x = m === "smog" ? Vi(v) ?? 2 : null;
|
|
3875
5321
|
if (t) return;
|
|
3876
5322
|
u({
|
|
3877
|
-
weather:
|
|
5323
|
+
weather: m,
|
|
5324
|
+
rainLevel: h,
|
|
5325
|
+
snowLevel: g,
|
|
5326
|
+
fogLevel: y,
|
|
5327
|
+
hailLevel: b,
|
|
5328
|
+
smogLevel: x,
|
|
3878
5329
|
status: "success",
|
|
3879
5330
|
error: null,
|
|
3880
5331
|
current: {
|
|
@@ -3882,13 +5333,28 @@ var L = {
|
|
|
3882
5333
|
windSpeed: c,
|
|
3883
5334
|
isDay: o?.current?.is_day === 1,
|
|
3884
5335
|
latitude: e,
|
|
3885
|
-
longitude: r
|
|
5336
|
+
longitude: r,
|
|
5337
|
+
timezone: f,
|
|
5338
|
+
localTime: p,
|
|
5339
|
+
visibility: v,
|
|
5340
|
+
rainLevel: h,
|
|
5341
|
+
snowLevel: g,
|
|
5342
|
+
fogLevel: y,
|
|
5343
|
+
hailLevel: b,
|
|
5344
|
+
smogLevel: x,
|
|
5345
|
+
sunrise: l,
|
|
5346
|
+
sunset: d
|
|
3886
5347
|
}
|
|
3887
5348
|
});
|
|
3888
5349
|
} catch (e) {
|
|
3889
5350
|
if (t || e instanceof DOMException && e.name === "AbortError") return;
|
|
3890
5351
|
u({
|
|
3891
5352
|
weather: null,
|
|
5353
|
+
rainLevel: null,
|
|
5354
|
+
snowLevel: null,
|
|
5355
|
+
fogLevel: null,
|
|
5356
|
+
hailLevel: null,
|
|
5357
|
+
smogLevel: null,
|
|
3892
5358
|
status: "error",
|
|
3893
5359
|
error: e instanceof Error ? e.message : "天气获取失败",
|
|
3894
5360
|
current: null
|
|
@@ -3900,6 +5366,11 @@ var L = {
|
|
|
3900
5366
|
}) : typeof navigator > "u" || !navigator.geolocation ? (Promise.resolve().then(() => {
|
|
3901
5367
|
t || u({
|
|
3902
5368
|
weather: null,
|
|
5369
|
+
rainLevel: null,
|
|
5370
|
+
snowLevel: null,
|
|
5371
|
+
fogLevel: null,
|
|
5372
|
+
hailLevel: null,
|
|
5373
|
+
smogLevel: null,
|
|
3903
5374
|
status: "error",
|
|
3904
5375
|
error: "当前环境不支持定位",
|
|
3905
5376
|
current: null
|
|
@@ -3914,6 +5385,11 @@ var L = {
|
|
|
3914
5385
|
}, (e) => {
|
|
3915
5386
|
t || u({
|
|
3916
5387
|
weather: null,
|
|
5388
|
+
rainLevel: null,
|
|
5389
|
+
snowLevel: null,
|
|
5390
|
+
fogLevel: null,
|
|
5391
|
+
hailLevel: null,
|
|
5392
|
+
smogLevel: null,
|
|
3917
5393
|
status: "error",
|
|
3918
5394
|
error: e.message || "定位失败",
|
|
3919
5395
|
current: null
|
|
@@ -3929,49 +5405,157 @@ var L = {
|
|
|
3929
5405
|
i,
|
|
3930
5406
|
a
|
|
3931
5407
|
]), l;
|
|
3932
|
-
}
|
|
5408
|
+
}, Qi = async (e, t, n) => {
|
|
5409
|
+
let r = new URLSearchParams({
|
|
5410
|
+
latitude: String(e),
|
|
5411
|
+
longitude: String(t),
|
|
5412
|
+
daily: "sunrise,sunset",
|
|
5413
|
+
timezone: "auto",
|
|
5414
|
+
forecast_days: "1"
|
|
5415
|
+
}), i = await fetch(`https://api.open-meteo.com/v1/forecast?${r}`, { signal: n });
|
|
5416
|
+
if (!i.ok) return null;
|
|
5417
|
+
let a = await i.json(), o = Ji(a?.daily?.sunrise?.[0]), s = Ji(a?.daily?.sunset?.[0]);
|
|
5418
|
+
return o == null || s == null ? null : {
|
|
5419
|
+
sunrise: o,
|
|
5420
|
+
sunset: s
|
|
5421
|
+
};
|
|
5422
|
+
}, $i = (e) => {
|
|
5423
|
+
let t = qi(e), r = t ? e.latitude : null, i = t ? e.longitude : null, a = `${r},${i}`, [o, c] = s(null), [l, u] = s(a);
|
|
5424
|
+
return l !== a && (u(a), c(null)), n(() => {
|
|
5425
|
+
if (r == null || i == null) return;
|
|
5426
|
+
let e = !1, t = new AbortController();
|
|
5427
|
+
return Qi(r, i, t.signal).then((t) => {
|
|
5428
|
+
e || c(t);
|
|
5429
|
+
}).catch(() => {
|
|
5430
|
+
e || c(null);
|
|
5431
|
+
}), () => {
|
|
5432
|
+
e = !0, t.abort();
|
|
5433
|
+
};
|
|
5434
|
+
}, [r, i]), t ? o : null;
|
|
5435
|
+
}, ea = 3, ta = (e) => Math.min(12, Math.max(0, Math.round(e))), na = (e) => Math.max(0, ta(e) - 2), ra = .55, ia = [
|
|
5436
|
+
0,
|
|
5437
|
+
3,
|
|
5438
|
+
8,
|
|
5439
|
+
16,
|
|
5440
|
+
24,
|
|
5441
|
+
33,
|
|
5442
|
+
44,
|
|
5443
|
+
55,
|
|
5444
|
+
68,
|
|
5445
|
+
81,
|
|
5446
|
+
95,
|
|
5447
|
+
110,
|
|
5448
|
+
125
|
|
5449
|
+
], aa = [
|
|
5450
|
+
1,
|
|
5451
|
+
5,
|
|
5452
|
+
11,
|
|
5453
|
+
19,
|
|
5454
|
+
28,
|
|
5455
|
+
38,
|
|
5456
|
+
49,
|
|
5457
|
+
61,
|
|
5458
|
+
74,
|
|
5459
|
+
88,
|
|
5460
|
+
102,
|
|
5461
|
+
117,
|
|
5462
|
+
Infinity
|
|
5463
|
+
], oa = (e, t, n = 0, r = 0) => {
|
|
5464
|
+
let i = t.gustiness, a = t.wander, o = n * .0017 + r * .0024, s = e * ra, 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);
|
|
5465
|
+
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));
|
|
5466
|
+
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));
|
|
5467
|
+
return {
|
|
5468
|
+
intensity: d,
|
|
5469
|
+
angle: p,
|
|
5470
|
+
ux: Math.cos(p),
|
|
5471
|
+
uy: Math.sin(p)
|
|
5472
|
+
};
|
|
5473
|
+
}, sa = (e) => {
|
|
5474
|
+
let t = ta(e);
|
|
5475
|
+
if (t <= 0) return {
|
|
5476
|
+
count: 0,
|
|
5477
|
+
alphaMul: 0
|
|
5478
|
+
};
|
|
5479
|
+
let n = Math.min(1, (t / 9) ** 1.15);
|
|
5480
|
+
return {
|
|
5481
|
+
count: Math.floor(3 + n * n * 50),
|
|
5482
|
+
alphaMul: .1 + n * .9
|
|
5483
|
+
};
|
|
5484
|
+
}, ca = (e) => ia[ta(e)] ?? 16, la = (e) => {
|
|
5485
|
+
let t = Math.max(0, e);
|
|
5486
|
+
for (let e = 0; e < aa.length; e++) if (t <= aa[e]) return e;
|
|
5487
|
+
return 12;
|
|
5488
|
+
}, ua = (e) => {
|
|
5489
|
+
let t = la(e), n = na(t), r = ca(n), i = Math.max(.04, Math.min(r / 16, 4.2)), { alphaMul: a } = sa(n), o = i ** .82, s = Math.min(1, (n / 8) ** 1.1), c = (.04 + s * .32) * Math.PI;
|
|
5490
|
+
return {
|
|
5491
|
+
speedKmh: e,
|
|
5492
|
+
level: t,
|
|
5493
|
+
visualLevel: n,
|
|
5494
|
+
scale: i,
|
|
5495
|
+
cloud: .28 + i * .72,
|
|
5496
|
+
rain: o,
|
|
5497
|
+
snowDrift: -(.04 + o * .28),
|
|
5498
|
+
hail: .4 + o * .85,
|
|
5499
|
+
fog: .32 + o * .58,
|
|
5500
|
+
streak: .55 + o * .95,
|
|
5501
|
+
streakVisibility: a,
|
|
5502
|
+
gustiness: s,
|
|
5503
|
+
wander: c
|
|
5504
|
+
};
|
|
5505
|
+
}, da = (e) => e.live && e.liveWindKmh != null && Number.isFinite(e.liveWindKmh) ? Math.max(0, e.liveWindKmh) : ca(e.windLevel);
|
|
3933
5506
|
//#endregion
|
|
3934
5507
|
//#region src/components/weatherBackground/scene/draw-atmosphere.ts
|
|
3935
|
-
function
|
|
3936
|
-
let t = e.
|
|
3937
|
-
for (let
|
|
5508
|
+
function fa(e) {
|
|
5509
|
+
let t = e.windMotion.cloud, { intensity: n, angle: r, uy: i } = e.windField, a = -Math.cos(r);
|
|
5510
|
+
for (let r of e.state.clouds) {
|
|
5511
|
+
let o = Math.abs(r.speed) * t * n;
|
|
5512
|
+
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);
|
|
5513
|
+
}
|
|
3938
5514
|
}
|
|
3939
|
-
function
|
|
5515
|
+
function pa(e) {
|
|
3940
5516
|
let t = e.fogSprite;
|
|
3941
5517
|
if (!t || e.state.fogBanks.length === 0) return;
|
|
3942
|
-
let { canvas: n, baseR: r } = t;
|
|
3943
|
-
for (let t of e.state.fogBanks)
|
|
5518
|
+
let { canvas: n, baseR: r } = t, i = e.windMotion.fog, { intensity: a, angle: o, uy: s } = e.windField, c = -Math.cos(o);
|
|
5519
|
+
for (let t of e.state.fogBanks) {
|
|
5520
|
+
let o = Math.abs(t.speed) * i * a;
|
|
5521
|
+
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();
|
|
5522
|
+
}
|
|
3944
5523
|
}
|
|
3945
|
-
function
|
|
5524
|
+
function ma(e) {
|
|
3946
5525
|
if (e.cfg.haze <= 0) return;
|
|
3947
5526
|
let t = e.activeWeather === "smog" ? "177, 164, 135" : "220, 226, 232";
|
|
3948
5527
|
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
5528
|
}
|
|
3950
5529
|
//#endregion
|
|
3951
5530
|
//#region src/components/weatherBackground/lightning.ts
|
|
3952
|
-
function
|
|
5531
|
+
function ha(e, t, n, r, i, a) {
|
|
3953
5532
|
if (a <= 0) return [[e, t], [n, r]];
|
|
3954
|
-
let o = (e + n) / 2 + (Math.random() - .5) * i, s = (t + r) / 2, c =
|
|
5533
|
+
let o = (e + n) / 2 + (Math.random() - .5) * i, s = (t + r) / 2, c = ha(e, t, o, s, i * .55, a - 1), l = ha(o, s, n, r, i * .55, a - 1);
|
|
3955
5534
|
return [...c.slice(0, -1), ...l];
|
|
3956
5535
|
}
|
|
3957
5536
|
//#endregion
|
|
3958
5537
|
//#region src/components/weatherBackground/scene/draw-effects.ts
|
|
3959
|
-
function
|
|
3960
|
-
if (e.state.windStreaks.length
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
5538
|
+
function ga(e) {
|
|
5539
|
+
if (e.state.windStreaks.length === 0) return;
|
|
5540
|
+
let t = e.windMotion.streak, n = e.windMotion.streakVisibility;
|
|
5541
|
+
if (n <= .02) return;
|
|
5542
|
+
let r = e.state.t;
|
|
5543
|
+
for (let i of e.state.windStreaks) {
|
|
5544
|
+
let a = oa(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;
|
|
5545
|
+
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);
|
|
5546
|
+
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);
|
|
5547
|
+
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) {
|
|
5548
|
+
let t = i.x + c * p * .58, n = i.y + l * p * .58 * .45 - f * .4;
|
|
5549
|
+
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
5550
|
}
|
|
3967
5551
|
}
|
|
3968
5552
|
}
|
|
3969
|
-
function
|
|
5553
|
+
function _a(e) {
|
|
3970
5554
|
if (e.cfg.lightning) {
|
|
3971
5555
|
if (e.state.t >= e.state.nextStrike) {
|
|
3972
5556
|
e.state.nextStrike = e.state.t + 150 + Math.random() * 300, e.state.flashAlpha = .5, e.state.boltLife = 9;
|
|
3973
5557
|
let t = e.width * (.15 + Math.random() * .7);
|
|
3974
|
-
e.state.boltPoints =
|
|
5558
|
+
e.state.boltPoints = ha(t, e.height * .12, t + (Math.random() - .5) * e.width * .2, e.height * .92, 60, 6);
|
|
3975
5559
|
}
|
|
3976
5560
|
if (e.state.boltLife > 0) {
|
|
3977
5561
|
--e.state.boltLife;
|
|
@@ -3983,7 +5567,7 @@ function An(e) {
|
|
|
3983
5567
|
}
|
|
3984
5568
|
//#endregion
|
|
3985
5569
|
//#region src/components/weatherBackground/sprites/hail.ts
|
|
3986
|
-
var
|
|
5570
|
+
var va = 3.2, ya = (e) => {
|
|
3987
5571
|
let t = Math.ceil(e * 2.8 + 4), n = document.createElement("canvas");
|
|
3988
5572
|
n.width = t, n.height = t;
|
|
3989
5573
|
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 +5600,11 @@ var jn = 3.2, Mn = (e) => {
|
|
|
4016
5600
|
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
5601
|
}
|
|
4018
5602
|
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
|
-
|
|
5603
|
+
}, ba = (e = 16) => Array.from({ length: e }, () => ya(va)), xa = (e) => e[Math.floor(Math.random() * e.length)], Sa = (e, t, n, r, i = !0, a, o = 1) => {
|
|
5604
|
+
let s = a?.min ?? 1.4, c = a?.max ?? 4.8;
|
|
5605
|
+
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 = xa(r), e.drawSize = e.r * 2.8 + 4, e.rotation = Math.random() * Math.PI * 2, e.rotationSpeed = (Math.random() - .5) * .06;
|
|
5606
|
+
}, Ca = (e, t, n, r, i = 1) => {
|
|
5607
|
+
let a = {
|
|
4023
5608
|
x: 0,
|
|
4024
5609
|
y: 0,
|
|
4025
5610
|
r: 2,
|
|
@@ -4037,21 +5622,21 @@ var jn = 3.2, Mn = (e) => {
|
|
|
4037
5622
|
rotation: 0,
|
|
4038
5623
|
rotationSpeed: 0
|
|
4039
5624
|
};
|
|
4040
|
-
return
|
|
5625
|
+
return Sa(a, e, t, n, Math.random() < .72, r, i), a;
|
|
4041
5626
|
};
|
|
4042
5627
|
//#endregion
|
|
4043
5628
|
//#region src/components/weatherBackground/scene/draw-precipitation.ts
|
|
4044
|
-
function
|
|
5629
|
+
function wa(e) {
|
|
4045
5630
|
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:
|
|
5631
|
+
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;
|
|
5632
|
+
e.ctx.strokeStyle = `rgba(214, 228, 240, ${t})`, e.ctx.lineWidth = 1.2, e.ctx.beginPath();
|
|
5633
|
+
for (let t of e.state.drops) {
|
|
5634
|
+
let r = t.speed + c, i = Math.hypot(s, r) || 1, a = s / i, o = r / i;
|
|
5635
|
+
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({
|
|
5636
|
+
x: t.x,
|
|
4052
5637
|
r: 1,
|
|
4053
5638
|
alpha: .5
|
|
4054
|
-
}),
|
|
5639
|
+
}), t.y = -t.len, t.x = Math.random() * (e.width + 160) - 80);
|
|
4055
5640
|
}
|
|
4056
5641
|
e.ctx.stroke();
|
|
4057
5642
|
for (let t = e.state.splashes.length - 1; t >= 0; t--) {
|
|
@@ -4063,58 +5648,71 @@ function Ln(e) {
|
|
|
4063
5648
|
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
5649
|
}
|
|
4065
5650
|
}
|
|
4066
|
-
function
|
|
5651
|
+
function Ta(e) {
|
|
5652
|
+
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
5653
|
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);
|
|
5654
|
+
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
5655
|
let n = t.drawSize / 2;
|
|
4070
5656
|
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
5657
|
}
|
|
4072
5658
|
}
|
|
4073
|
-
function
|
|
5659
|
+
function Ea(e) {
|
|
4074
5660
|
if (e.state.hailstones.length === 0) return;
|
|
4075
|
-
let t = e.state.hailPool;
|
|
4076
|
-
for (let
|
|
4077
|
-
if (
|
|
4078
|
-
--
|
|
5661
|
+
let t = e.state.hailPool, n = e.windMotion.hail, r = e.state.t, i = e.windField;
|
|
5662
|
+
for (let a of e.state.hailstones) {
|
|
5663
|
+
if (a.delay > 0) {
|
|
5664
|
+
--a.delay;
|
|
4079
5665
|
continue;
|
|
4080
5666
|
}
|
|
4081
|
-
let
|
|
4082
|
-
if (
|
|
5667
|
+
let o = oa(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;
|
|
5668
|
+
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
5669
|
else {
|
|
4084
|
-
|
|
5670
|
+
Sa(a, e.width, e.height, t, !0, e.hailSpec ? {
|
|
5671
|
+
min: e.hailSpec.sizeMin,
|
|
5672
|
+
max: e.hailSpec.sizeMax
|
|
5673
|
+
} : void 0, e.hailSpec?.speedMul ?? 1);
|
|
4085
5674
|
continue;
|
|
4086
5675
|
}
|
|
4087
|
-
let
|
|
4088
|
-
|
|
5676
|
+
let p = a.drawSize / 2;
|
|
5677
|
+
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
5678
|
}
|
|
4090
5679
|
}
|
|
4091
5680
|
//#endregion
|
|
4092
5681
|
//#region src/components/weatherBackground/scene/draw-sky.ts
|
|
4093
|
-
function
|
|
5682
|
+
function Da(e) {
|
|
4094
5683
|
e.ctx.fillStyle = e.skyGradient, e.ctx.fillRect(0, 0, e.width, e.height);
|
|
4095
5684
|
}
|
|
4096
|
-
function
|
|
4097
|
-
if (e.state.stars.length
|
|
4098
|
-
|
|
4099
|
-
|
|
5685
|
+
function Oa(e) {
|
|
5686
|
+
if (e.state.stars.length === 0) return;
|
|
5687
|
+
let t = 1;
|
|
5688
|
+
if (e.dayCycle) {
|
|
5689
|
+
if (e.dayCycle.isDay) return;
|
|
5690
|
+
t = .35 + (1 - e.dayCycle.twilight) * .65;
|
|
5691
|
+
} else if (!e.activeNight) return;
|
|
5692
|
+
for (let n of e.state.stars) {
|
|
5693
|
+
let r = .35 + (Math.sin(e.state.t * n.speed + n.phase) + 1) * .325;
|
|
5694
|
+
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
5695
|
}
|
|
4101
5696
|
}
|
|
4102
|
-
function
|
|
5697
|
+
function ka(e) {
|
|
4103
5698
|
let t = e.celestial;
|
|
4104
5699
|
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
|
-
|
|
5700
|
+
let { ctx: n, sunX: r, sunY: i, state: a } = e, o = 1 + Math.sin(a.t * t.breathSpeed) * t.breathAmp, s = e.dayCycle ? Kr(e.dayCycle) : {
|
|
5701
|
+
scale: 1,
|
|
5702
|
+
alpha: 1
|
|
5703
|
+
}, c = t.half * o * s.scale, l = c * 2;
|
|
5704
|
+
n.save(), n.globalAlpha = s.alpha, n.drawImage(t.canvas, r - c, i - c, l, l), n.restore();
|
|
4107
5705
|
}
|
|
4108
|
-
function
|
|
5706
|
+
function Aa(e) {
|
|
4109
5707
|
if (e.activeNight) {
|
|
4110
|
-
|
|
5708
|
+
Oa(e), ka(e);
|
|
4111
5709
|
return;
|
|
4112
5710
|
}
|
|
4113
|
-
|
|
5711
|
+
ka(e);
|
|
4114
5712
|
}
|
|
4115
5713
|
//#endregion
|
|
4116
5714
|
//#region src/components/weatherBackground/configs.ts
|
|
4117
|
-
var
|
|
5715
|
+
var ja = {
|
|
4118
5716
|
sunny: {
|
|
4119
5717
|
sky: ["#4a9fe0", "#c8e8fb"],
|
|
4120
5718
|
sun: "full",
|
|
@@ -4166,6 +5764,29 @@ var Wn = {
|
|
|
4166
5764
|
snowCount: 0,
|
|
4167
5765
|
lightning: !1
|
|
4168
5766
|
},
|
|
5767
|
+
rain: {
|
|
5768
|
+
sky: ["#55637a", "#7e8ba0"],
|
|
5769
|
+
sun: "none",
|
|
5770
|
+
cloudCount: 8,
|
|
5771
|
+
cloudColor: [
|
|
5772
|
+
51,
|
|
5773
|
+
65,
|
|
5774
|
+
85
|
|
5775
|
+
],
|
|
5776
|
+
cloudAlpha: .65,
|
|
5777
|
+
cloudSpread: .26,
|
|
5778
|
+
rain: {
|
|
5779
|
+
count: 150,
|
|
5780
|
+
speed: 10,
|
|
5781
|
+
wind: -1.5,
|
|
5782
|
+
alpha: .5,
|
|
5783
|
+
splash: !0
|
|
5784
|
+
},
|
|
5785
|
+
fogBanks: 0,
|
|
5786
|
+
haze: .06,
|
|
5787
|
+
snowCount: 0,
|
|
5788
|
+
lightning: !1
|
|
5789
|
+
},
|
|
4169
5790
|
lightRain: {
|
|
4170
5791
|
sky: ["#6b7a8f", "#9aa7b8"],
|
|
4171
5792
|
sun: "none",
|
|
@@ -4423,9 +6044,7 @@ var Wn = {
|
|
|
4423
6044
|
snowCount: 160,
|
|
4424
6045
|
lightning: !1
|
|
4425
6046
|
}
|
|
4426
|
-
}
|
|
4427
|
-
Wn.snow = Wn.moderateSnow;
|
|
4428
|
-
var Gn = {
|
|
6047
|
+
}, Ma = {
|
|
4429
6048
|
sunny: {
|
|
4430
6049
|
sky: ["#0b1a33", "#27476e"],
|
|
4431
6050
|
stars: 110
|
|
@@ -4438,6 +6057,10 @@ var Gn = {
|
|
|
4438
6057
|
sky: ["#181f2a", "#333e4e"],
|
|
4439
6058
|
stars: 0
|
|
4440
6059
|
},
|
|
6060
|
+
rain: {
|
|
6061
|
+
sky: ["#11161f", "#242c3a"],
|
|
6062
|
+
stars: 0
|
|
6063
|
+
},
|
|
4441
6064
|
lightRain: {
|
|
4442
6065
|
sky: ["#151b26", "#2b3442"],
|
|
4443
6066
|
stars: 0
|
|
@@ -4458,6 +6081,10 @@ var Gn = {
|
|
|
4458
6081
|
sky: ["#1c222b", "#3a434e"],
|
|
4459
6082
|
stars: 0
|
|
4460
6083
|
},
|
|
6084
|
+
snow: {
|
|
6085
|
+
sky: ["#131a26", "#333f4f"],
|
|
6086
|
+
stars: 8
|
|
6087
|
+
},
|
|
4461
6088
|
lightSnow: {
|
|
4462
6089
|
sky: ["#161e2b", "#3a4656"],
|
|
4463
6090
|
stars: 20
|
|
@@ -4485,21 +6112,15 @@ var Gn = {
|
|
|
4485
6112
|
gale: {
|
|
4486
6113
|
sky: ["#101a26", "#2e3d4d"],
|
|
4487
6114
|
stars: 30
|
|
4488
|
-
},
|
|
4489
|
-
snow: {
|
|
4490
|
-
sky: ["#131a26", "#333f4f"],
|
|
4491
|
-
stars: 8
|
|
4492
6115
|
}
|
|
4493
|
-
}
|
|
4494
|
-
Gn.snow = Gn.moderateSnow;
|
|
4495
|
-
var Kn = ([e, t, n]) => [
|
|
6116
|
+
}, Na = ([e, t, n]) => [
|
|
4496
6117
|
Math.round(e * .3 + 18),
|
|
4497
6118
|
Math.round(t * .3 + 24),
|
|
4498
6119
|
Math.round(n * .3 + 42)
|
|
4499
6120
|
];
|
|
4500
6121
|
//#endregion
|
|
4501
6122
|
//#region src/components/weatherBackground/sprites/cloud.ts
|
|
4502
|
-
function
|
|
6123
|
+
function Pa(e, t, n, r) {
|
|
4503
6124
|
let [i, a, o] = n, s = Infinity, c = Infinity, l = -Infinity, u = -Infinity;
|
|
4504
6125
|
for (let n of t) {
|
|
4505
6126
|
let t = n.dx * e, r = n.dy * e, i = n.r * e;
|
|
@@ -4518,12 +6139,12 @@ function qn(e, t, n, r) {
|
|
|
4518
6139
|
oy: f
|
|
4519
6140
|
};
|
|
4520
6141
|
}
|
|
4521
|
-
function
|
|
6142
|
+
function Fa(e, t, n, r, i) {
|
|
4522
6143
|
let a = .7 + Math.random() * .9, o = 4 + Math.floor(Math.random() * 3), s = Array.from({ length: o }, (e, t) => ({
|
|
4523
6144
|
dx: (t - o / 2) * 26 + (Math.random() - .5) * 14,
|
|
4524
6145
|
dy: (Math.random() - .5) * 14,
|
|
4525
6146
|
r: 22 + Math.random() * 20
|
|
4526
|
-
})), { sprite: c, ox: l, oy: u } =
|
|
6147
|
+
})), { sprite: c, ox: l, oy: u } = Pa(a, s, r, i);
|
|
4527
6148
|
return {
|
|
4528
6149
|
x: Math.random() * (e + 240) - 120,
|
|
4529
6150
|
y: t * .06 + Math.random() * t * n,
|
|
@@ -4535,7 +6156,7 @@ function Jn(e, t, n, r, i) {
|
|
|
4535
6156
|
oy: u
|
|
4536
6157
|
};
|
|
4537
6158
|
}
|
|
4538
|
-
function
|
|
6159
|
+
function Ia(e, t = 120) {
|
|
4539
6160
|
let n = t * 2, r = document.createElement("canvas");
|
|
4540
6161
|
r.width = n, r.height = n;
|
|
4541
6162
|
let i = r.getContext("2d"), a = i.createRadialGradient(t, t, 0, t, t, t);
|
|
@@ -4546,7 +6167,7 @@ function Yn(e, t = 120) {
|
|
|
4546
6167
|
}
|
|
4547
6168
|
//#endregion
|
|
4548
6169
|
//#region src/components/weatherBackground/sprites/celestial.ts
|
|
4549
|
-
function
|
|
6170
|
+
function La(e, t) {
|
|
4550
6171
|
let n = e.sun;
|
|
4551
6172
|
if (n === "none") return null;
|
|
4552
6173
|
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 +6195,7 @@ function Xn(e, t) {
|
|
|
4574
6195
|
breathAmp: .018
|
|
4575
6196
|
};
|
|
4576
6197
|
}
|
|
4577
|
-
function
|
|
6198
|
+
function Ra(e, t, n) {
|
|
4578
6199
|
if (e.sun === "none") return null;
|
|
4579
6200
|
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
6201
|
l.width = c, l.height = c;
|
|
@@ -4628,12 +6249,12 @@ function Zn(e, t, n) {
|
|
|
4628
6249
|
}
|
|
4629
6250
|
//#endregion
|
|
4630
6251
|
//#region src/components/weatherBackground/sprites/snow.ts
|
|
4631
|
-
var
|
|
6252
|
+
var za = (e) => {
|
|
4632
6253
|
let t = Math.ceil(e * 2 + 4), n = document.createElement("canvas");
|
|
4633
6254
|
n.width = t, n.height = t;
|
|
4634
6255
|
let r = n.getContext("2d"), i = r.createRadialGradient(t / 2, t / 2, 0, t / 2, t / 2, e + 1);
|
|
4635
6256
|
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
|
-
},
|
|
6257
|
+
}, Ba = (e) => {
|
|
4637
6258
|
let t = Math.ceil(e * 2 + 6), n = document.createElement("canvas");
|
|
4638
6259
|
n.width = t, n.height = t;
|
|
4639
6260
|
let r = n.getContext("2d");
|
|
@@ -4660,22 +6281,22 @@ var Qn = (e) => {
|
|
|
4660
6281
|
r.closePath(), r.stroke();
|
|
4661
6282
|
}
|
|
4662
6283
|
return n;
|
|
4663
|
-
},
|
|
6284
|
+
}, Va = () => ({
|
|
4664
6285
|
dots: [
|
|
4665
6286
|
1.2,
|
|
4666
6287
|
1.6,
|
|
4667
6288
|
2,
|
|
4668
6289
|
2.3
|
|
4669
|
-
].map((e) =>
|
|
6290
|
+
].map((e) => za(e)),
|
|
4670
6291
|
crystals: [
|
|
4671
6292
|
2.6,
|
|
4672
6293
|
3.2,
|
|
4673
6294
|
3.8,
|
|
4674
6295
|
4.4,
|
|
4675
6296
|
5
|
|
4676
|
-
].map((e) =>
|
|
4677
|
-
}),
|
|
4678
|
-
let i = 1 + Math.random() ** 1.6 * 4.2, a = i >= 2.4, o =
|
|
6297
|
+
].map((e) => Ba(e * 2.4))
|
|
6298
|
+
}), Ha = (e) => e[Math.floor(Math.random() * e.length)], Ua = (e, t, n, r) => {
|
|
6299
|
+
let i = 1 + Math.random() ** 1.6 * 4.2, a = i >= 2.4, o = Ha(a ? n.crystals : n.dots), s = a ? i * 4.8 + 6 : i * 2 + 4;
|
|
4679
6300
|
return {
|
|
4680
6301
|
x: Math.random() * e,
|
|
4681
6302
|
y: r ?? Math.random() * t,
|
|
@@ -4689,17 +6310,25 @@ var Qn = (e) => {
|
|
|
4689
6310
|
sprite: o,
|
|
4690
6311
|
drawSize: s
|
|
4691
6312
|
};
|
|
4692
|
-
},
|
|
4693
|
-
function
|
|
4694
|
-
let { ctx: t, width: n, height: r, activeWeather: i,
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
6313
|
+
}, Wa = (e, t) => t ? e === "smog" ? "96, 88, 66" : "138, 150, 168" : e === "smog" ? "168, 155, 126" : "226, 232, 238";
|
|
6314
|
+
function Ga(e) {
|
|
6315
|
+
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 = ja[i], h = (() => {
|
|
6316
|
+
let e = m;
|
|
6317
|
+
return wi(i) && e.rain && (e = {
|
|
6318
|
+
...e,
|
|
6319
|
+
rain: Ai(e.rain, l)
|
|
6320
|
+
}), Ti(i) && (e = {
|
|
6321
|
+
...e,
|
|
6322
|
+
snowCount: ji(u),
|
|
6323
|
+
fogBanks: u >= 7 ? Math.max(e.fogBanks, 3) : e.fogBanks,
|
|
6324
|
+
haze: u >= 7 ? Math.max(e.haze, .12) : e.haze
|
|
6325
|
+
}), Zr(i) && (e = Qr(e, f)), Ri(i) && (e = zi(e, p)), e;
|
|
6326
|
+
})(), g = Ma[i], _ = a ?? null, v = _ ? Rr(s ? Date.now() : o, _) : null, y = v ? !v.isDay : !1, b = v ? Wr(h.sky, g.sky, v) : y ? g.sky : h.sky, x = y ? Na(h.cloudColor) : h.cloudColor, S = Math.min(n, r) * .09, C = n * .72, w = r * .26;
|
|
6327
|
+
if (v) {
|
|
6328
|
+
let e = zr(n, r, v.arcProgress);
|
|
6329
|
+
C = e.x, w = e.y;
|
|
6330
|
+
}
|
|
6331
|
+
let T = Gr(t, r, b), E = [
|
|
4703
6332
|
{
|
|
4704
6333
|
dx: -.32,
|
|
4705
6334
|
dy: .08,
|
|
@@ -4720,158 +6349,215 @@ function ir(e) {
|
|
|
4720
6349
|
dy: .24,
|
|
4721
6350
|
r: .07
|
|
4722
6351
|
}
|
|
4723
|
-
],
|
|
6352
|
+
], D = La(h, S), O = Ra(h, S, E), k = y ? O : D, A = y || _ != null ? Array.from({ length: g.stars }, () => ({
|
|
6353
|
+
x: Math.random() * n,
|
|
6354
|
+
y: Math.random() * r * .72,
|
|
6355
|
+
r: .4 + Math.random() * 1.1,
|
|
6356
|
+
phase: Math.random() * Math.PI * 2,
|
|
6357
|
+
speed: .015 + Math.random() * .035
|
|
6358
|
+
})) : [], j = Array.from({ length: h.cloudCount }, () => Fa(n, r, h.cloudSpread, x, h.cloudAlpha)), M = h.rain ? Array.from({ length: h.rain.count }, () => ({
|
|
4724
6359
|
x: Math.random() * (n + 160) - 80,
|
|
4725
6360
|
y: Math.random() * r,
|
|
4726
6361
|
len: 8 + Math.random() * 10,
|
|
4727
|
-
speed:
|
|
4728
|
-
})) : [],
|
|
6362
|
+
speed: h.rain.speed * (.75 + Math.random() * .5)
|
|
6363
|
+
})) : [], N = [], P = Array.from({ length: h.fogBanks }, (e, t) => ({
|
|
4729
6364
|
x: Math.random() * n,
|
|
4730
|
-
y: t / Math.max(
|
|
6365
|
+
y: t / Math.max(h.fogBanks - 1, 1) * r * .9 + r * .05,
|
|
4731
6366
|
rw: n * (.25 + Math.random() * .3),
|
|
4732
6367
|
rh: r * (.08 + Math.random() * .08),
|
|
4733
6368
|
speed: (.1 + Math.random() * .25) * (t % 2 == 0 ? 1 : -1),
|
|
4734
|
-
alpha: .
|
|
4735
|
-
})),
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
6369
|
+
alpha: (.1 + Math.random() * .1) * (Zr(i) ? $r(f) : Ri(i) ? Bi(p) : 1)
|
|
6370
|
+
})), F = h.fogBanks > 0 ? Ia(Wa(i, y)) : null, I = h.snowCount > 0 ? Va() : null, L = I == null ? [] : Array.from({ length: h.snowCount }, () => Ua(n, r, I)), R = oi(i) ? si(d) : null, ee = R == null ? null : ba(), te = ee != null && R != null ? Array.from({ length: R.count }, () => Ca(n, r, ee, {
|
|
6371
|
+
min: R.sizeMin,
|
|
6372
|
+
max: R.sizeMax
|
|
6373
|
+
}, R.speedMul)) : [], ne = (() => {
|
|
6374
|
+
let { count: e } = sa(c.visualLevel);
|
|
6375
|
+
return e <= 0 ? [] : Array.from({ length: e }, () => ({
|
|
6376
|
+
x: Math.random() * n,
|
|
6377
|
+
y: Math.random() * r,
|
|
6378
|
+
length: 35 + Math.random() * 120,
|
|
6379
|
+
speed: 6 + Math.random() * 10,
|
|
6380
|
+
wave: Math.random() * Math.PI * 2,
|
|
6381
|
+
alpha: .1 + Math.random() * .28,
|
|
6382
|
+
width: .5 + Math.random() * 1.1,
|
|
6383
|
+
phase: Math.random() * Math.PI * 2
|
|
6384
|
+
}));
|
|
6385
|
+
})(), z = [], re = 120 + Math.random() * 240;
|
|
4744
6386
|
return {
|
|
4745
|
-
sky:
|
|
4746
|
-
cloudRgb:
|
|
4747
|
-
cfg:
|
|
4748
|
-
sunX:
|
|
4749
|
-
sunY:
|
|
4750
|
-
sunR:
|
|
4751
|
-
skyGradient:
|
|
4752
|
-
celestial:
|
|
4753
|
-
|
|
6387
|
+
sky: b,
|
|
6388
|
+
cloudRgb: x,
|
|
6389
|
+
cfg: h,
|
|
6390
|
+
sunX: C,
|
|
6391
|
+
sunY: w,
|
|
6392
|
+
sunR: S,
|
|
6393
|
+
skyGradient: T,
|
|
6394
|
+
celestial: k,
|
|
6395
|
+
sunSprite: D,
|
|
6396
|
+
moonSprite: O,
|
|
6397
|
+
fogSprite: F,
|
|
6398
|
+
dayCycleTimes: _,
|
|
6399
|
+
dayCycle: v,
|
|
6400
|
+
sceneTimeMs: o,
|
|
6401
|
+
liveClock: s,
|
|
6402
|
+
hailSpec: R,
|
|
4754
6403
|
state: {
|
|
4755
|
-
stars:
|
|
4756
|
-
moonCraters:
|
|
4757
|
-
clouds:
|
|
4758
|
-
drops:
|
|
4759
|
-
splashes:
|
|
4760
|
-
fogBanks:
|
|
4761
|
-
flakes:
|
|
4762
|
-
hailstones:
|
|
4763
|
-
hailPool:
|
|
4764
|
-
windStreaks:
|
|
6404
|
+
stars: A,
|
|
6405
|
+
moonCraters: E,
|
|
6406
|
+
clouds: j,
|
|
6407
|
+
drops: M,
|
|
6408
|
+
splashes: N,
|
|
6409
|
+
fogBanks: P,
|
|
6410
|
+
flakes: L,
|
|
6411
|
+
hailstones: te,
|
|
6412
|
+
hailPool: ee ?? [],
|
|
6413
|
+
windStreaks: ne,
|
|
4765
6414
|
t: 0,
|
|
4766
6415
|
flashAlpha: 0,
|
|
4767
6416
|
boltLife: 0,
|
|
4768
|
-
boltPoints:
|
|
4769
|
-
nextStrike:
|
|
6417
|
+
boltPoints: z,
|
|
6418
|
+
nextStrike: re
|
|
4770
6419
|
}
|
|
4771
6420
|
};
|
|
4772
6421
|
}
|
|
6422
|
+
function Ka(e, t) {
|
|
6423
|
+
if (!e.dayCycleTimes) return;
|
|
6424
|
+
let n = Rr(e.liveClock ? t ?? Date.now() : e.sceneTimeMs, e.dayCycleTimes), r = Ma[e.activeWeather], i = Wr(e.cfg.sky, r.sky, n), a = zr(e.width, e.height, n.arcProgress);
|
|
6425
|
+
e.dayCycle = n, e.activeNight = !n.isDay, e.sky = i, e.skyGradient = Gr(e.ctx, e.height, i), e.sunX = a.x, e.sunY = a.y, e.celestial = n.isDay ? e.sunSprite : e.moonSprite;
|
|
6426
|
+
}
|
|
4773
6427
|
//#endregion
|
|
4774
6428
|
//#region src/components/weatherBackground/scene/create-weather-scene.ts
|
|
4775
|
-
function
|
|
4776
|
-
t && (e.state.t += 1),
|
|
6429
|
+
function qa(e, t) {
|
|
6430
|
+
t && (e.state.t += 1), e.windField = oa(e.state.t, e.windMotion), e.dayCycleTimes && Ka(e, e.liveClock ? Date.now() : e.sceneTimeMs), Da(e), Aa(e), fa(e), pa(e), ma(e), wa(e), Ta(e), Ea(e), ga(e), _a(e);
|
|
4777
6431
|
}
|
|
4778
|
-
function
|
|
4779
|
-
let { ctx: t, width: n, height: r, activeWeather: i, activeNight: a } = e,
|
|
6432
|
+
function Ja(e) {
|
|
6433
|
+
let { ctx: t, width: n, height: r, activeWeather: i, activeNight: a, windMotion: o } = e, s = Ga(e), c = {
|
|
4780
6434
|
ctx: t,
|
|
4781
6435
|
width: n,
|
|
4782
6436
|
height: r,
|
|
4783
6437
|
activeWeather: i,
|
|
4784
|
-
activeNight: a,
|
|
4785
|
-
|
|
6438
|
+
activeNight: s.dayCycle ? !s.dayCycle.isDay : a,
|
|
6439
|
+
windMotion: o,
|
|
6440
|
+
windField: oa(0, o),
|
|
6441
|
+
...s
|
|
4786
6442
|
};
|
|
4787
|
-
if (typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return
|
|
4788
|
-
let
|
|
4789
|
-
|
|
4790
|
-
}),
|
|
4791
|
-
|
|
6443
|
+
if (c.dayCycleTimes && Ka(c, c.liveClock ? Date.now() : c.sceneTimeMs), typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return qa(c, !1), () => void 0;
|
|
6444
|
+
let l = 0, u = document.hidden, d = v((e) => {
|
|
6445
|
+
u = e;
|
|
6446
|
+
}), f = () => {
|
|
6447
|
+
l = requestAnimationFrame(f), !u && qa(c, !0);
|
|
4792
6448
|
};
|
|
4793
|
-
return
|
|
4794
|
-
cancelAnimationFrame(
|
|
6449
|
+
return f(), () => {
|
|
6450
|
+
cancelAnimationFrame(l), d();
|
|
4795
6451
|
};
|
|
4796
6452
|
}
|
|
4797
|
-
var
|
|
6453
|
+
var Ya = {
|
|
4798
6454
|
weatherBackground: "cos-weatherBackground-Mnm22",
|
|
4799
6455
|
canvas: "cos-canvas-nvqMt",
|
|
4800
6456
|
loadingOverlay: "cos-loadingOverlay-O58B7",
|
|
4801
6457
|
loadingSpinner: "cos-loadingSpinner-NQ9yG",
|
|
4802
6458
|
"weather-loading-spin": "cos-weather-loading-spin-IPFWZ"
|
|
4803
|
-
},
|
|
4804
|
-
let
|
|
4805
|
-
latitude:
|
|
4806
|
-
longitude:
|
|
4807
|
-
} : void 0),
|
|
6459
|
+
}, Xa = ({ 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 }) => {
|
|
6460
|
+
let b = o(null), x = Zi(s, c != null && d != null ? {
|
|
6461
|
+
latitude: c,
|
|
6462
|
+
longitude: d
|
|
6463
|
+
} : void 0), S = xi(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 = ki(S, C, w), k = Lr(i), A = x.current?.sunrise ?? null, j = x.current?.sunset ?? null, M = x.current?.windSpeed ?? null, N = a(() => s && A != null && j != null ? {
|
|
6464
|
+
sunrise: A,
|
|
6465
|
+
sunset: j
|
|
6466
|
+
} : Fr(k), [
|
|
6467
|
+
s,
|
|
6468
|
+
A,
|
|
6469
|
+
j,
|
|
6470
|
+
k
|
|
6471
|
+
]), P = da({
|
|
6472
|
+
live: s,
|
|
6473
|
+
windLevel: f,
|
|
6474
|
+
liveWindKmh: M
|
|
6475
|
+
}), F = a(() => ua(P), [P]), I = s && x.current ? !x.current.isDay : !Rr(k, N).isDay, L = y || s && (x.status === "locating" || x.status === "fetching"), R = o(v);
|
|
4808
6476
|
return n(() => {
|
|
4809
|
-
|
|
6477
|
+
R.current = v;
|
|
4810
6478
|
}), n(() => {
|
|
4811
|
-
|
|
4812
|
-
}, [
|
|
4813
|
-
let n =
|
|
6479
|
+
x.weather && R.current?.(xi(x.weather));
|
|
6480
|
+
}, [x.weather]), n(() => {
|
|
6481
|
+
let n = b.current;
|
|
4814
6482
|
if (!n) return;
|
|
4815
6483
|
let r = window.devicePixelRatio || 1;
|
|
4816
6484
|
n.width = e * r, n.height = t * r;
|
|
4817
6485
|
let i = n.getContext("2d");
|
|
4818
|
-
if (i) return i.setTransform(r, 0, 0, r, 0, 0),
|
|
6486
|
+
if (i) return i.setTransform(r, 0, 0, r, 0, 0), Ja({
|
|
4819
6487
|
ctx: i,
|
|
4820
6488
|
width: e,
|
|
4821
6489
|
height: t,
|
|
4822
|
-
activeWeather:
|
|
4823
|
-
activeNight:
|
|
6490
|
+
activeWeather: O,
|
|
6491
|
+
activeNight: I,
|
|
6492
|
+
dayCycleTimes: N,
|
|
6493
|
+
sceneTimeMs: k,
|
|
6494
|
+
liveClock: s,
|
|
6495
|
+
windMotion: F,
|
|
6496
|
+
rainLevel: C,
|
|
6497
|
+
snowLevel: w,
|
|
6498
|
+
fogLevel: T,
|
|
6499
|
+
hailLevel: E,
|
|
6500
|
+
smogLevel: D
|
|
4824
6501
|
});
|
|
4825
6502
|
}, [
|
|
4826
|
-
|
|
4827
|
-
|
|
6503
|
+
I,
|
|
6504
|
+
O,
|
|
6505
|
+
N,
|
|
6506
|
+
C,
|
|
6507
|
+
w,
|
|
6508
|
+
T,
|
|
6509
|
+
E,
|
|
6510
|
+
D,
|
|
4828
6511
|
t,
|
|
4829
|
-
|
|
6512
|
+
s,
|
|
6513
|
+
k,
|
|
6514
|
+
e,
|
|
6515
|
+
F
|
|
4830
6516
|
]), /* @__PURE__ */ u("div", {
|
|
4831
|
-
className:
|
|
6517
|
+
className: Ya.weatherBackground,
|
|
4832
6518
|
style: {
|
|
4833
6519
|
width: e,
|
|
4834
6520
|
height: t
|
|
4835
6521
|
},
|
|
4836
6522
|
children: [/* @__PURE__ */ l("canvas", {
|
|
4837
|
-
ref:
|
|
4838
|
-
className:
|
|
6523
|
+
ref: b,
|
|
6524
|
+
className: Ya.canvas,
|
|
4839
6525
|
style: {
|
|
4840
6526
|
width: e,
|
|
4841
6527
|
height: t
|
|
4842
6528
|
},
|
|
4843
6529
|
role: "img",
|
|
4844
|
-
"aria-label": `天气背景:${
|
|
4845
|
-
}),
|
|
4846
|
-
className:
|
|
6530
|
+
"aria-label": `天气背景:${S}${I ? "(夜间)" : ""},${F.level}级风`
|
|
6531
|
+
}), L && /* @__PURE__ */ u("div", {
|
|
6532
|
+
className: Ya.loadingOverlay,
|
|
4847
6533
|
role: "status",
|
|
4848
6534
|
"aria-live": "polite",
|
|
4849
6535
|
children: [/* @__PURE__ */ l("div", {
|
|
4850
|
-
className:
|
|
6536
|
+
className: Ya.loadingSpinner,
|
|
4851
6537
|
"aria-hidden": !0
|
|
4852
6538
|
}), /* @__PURE__ */ l("span", { children: "天气加载中…" })]
|
|
4853
6539
|
})]
|
|
4854
6540
|
});
|
|
4855
|
-
},
|
|
6541
|
+
}, Za = {
|
|
4856
6542
|
waveText: "cos-waveText-Zy2Tp",
|
|
4857
6543
|
text: "cos-text-el-KR",
|
|
4858
6544
|
char: "cos-char-Y9-mV",
|
|
4859
6545
|
wave: "cos-wave-jVRCz"
|
|
4860
|
-
},
|
|
4861
|
-
className:
|
|
6546
|
+
}, Qa = ({ text: e = "WAVE", amplitude: t = 12, color: n = "#38bdf8", fontSize: r = 56 }) => /* @__PURE__ */ l("div", {
|
|
6547
|
+
className: Za.waveText,
|
|
4862
6548
|
children: /* @__PURE__ */ l("h1", {
|
|
4863
|
-
className:
|
|
6549
|
+
className: Za.text,
|
|
4864
6550
|
style: {
|
|
4865
6551
|
fontSize: r,
|
|
4866
6552
|
"--wave-color": n,
|
|
4867
6553
|
"--wave-amp": `${t}px`
|
|
4868
6554
|
},
|
|
4869
6555
|
children: e.split("").map((e, t) => /* @__PURE__ */ l("span", {
|
|
4870
|
-
className:
|
|
6556
|
+
className: Za.char,
|
|
4871
6557
|
style: { animationDelay: `${t * .1}s` },
|
|
4872
6558
|
children: e === " " ? "\xA0" : e
|
|
4873
6559
|
}, `${e}-${t}`))
|
|
4874
6560
|
})
|
|
4875
6561
|
});
|
|
4876
6562
|
//#endregion
|
|
4877
|
-
export { x as AudioVisualizer, _ as Aurora, f as BarcodeScan, m as BurnAway, C as CanvasClock, D as Charge, k as ClickSpark,
|
|
6563
|
+
export { x as AudioVisualizer, _ as Aurora, f as BarcodeScan, yn as BubbleField, m as BurnAway, C as CanvasClock, D as Charge, k as ClickSpark, P as Confetti, ae as CountUp, ne as Countdown, fe as CursorTrail, I as CyberGrid, qr as DEFAULT_FOG_LEVEL, ni as DEFAULT_HAIL_LEVEL, di as DEFAULT_RAIN_LEVEL, Pi as DEFAULT_SMOG_LEVEL, fi as DEFAULT_SNOW_LEVEL, ea as DEFAULT_WIND_LEVEL, me as DiceRoll, se as DnaHelix, ge as DoublePendulum, ue as ElectricArc, Jr as FOG_LEVEL_LABELS, Ce as Fireworks, Ee as FlipCounter, Pe as GameOfLife, Ie as GlitchText, ke as GradientFlow, ze as GravityBalls, ri as HAIL_LEVEL_LABELS, Ve as HolographicCard, Ke as LiquidGlass, He as LiquidProgress, We as LorenzAttractor, ui as MAX_PRECIP_LEVEL, li as MIN_PRECIP_LEVEL, Je as MagneticButton, Ze as MatrixRain, tt as MazeGenerator, $e as MetaballPool, rt as MeteorRain, lt as NeonText, st as NetworkGraph, dt as NewtonCradle, mt as OrbitalChart, gt as ParticleNetwork, vt as PlasmaBall, Dn as ProgressChest, yi as RAIN_LEVEL_LABELS, kn as RadarScan, jn as RedPacketRain, Nn as ReturnCity, Gn as RippleWater, Fn as RopeChain, Fi as SMOG_LEVEL_LABELS, bi as SNOW_LEVEL_LABELS, rr as SandFall, Jn as ScrambleText, Xn as ScratchCard, $n as SlotMachine, It as SmokeFog, wn as Snowfall, Sn as SolarSystem, In as Speedometer, or as SplitReveal, cr as SplitText, pr as Spotlight, dr as SpringMass, En as Starfield, Sr as TextMorph, Ln as TimelinePulse, vr as Turntable, Er as Typewriter, Or as WaveButton, Qa as WaveText, Xa as WeatherBackground, ua as buildWindMotion, Yr as clampFogLevel, ii as clampHailLevel, $ as clampPrecipLevel, Ii as clampSmogLevel, $r as fogBankAlphaScale, ti as fogLevelFromVisibility, ei as fogLevelFromWmo, Xr as formatFogLevel, ai as formatHailLevel, Xi as formatLocalHm, vi as formatPrecipLevel, Li as formatSmogLevel, ci as hailLevelFromWmo, si as hailSpec, Qr as intensifyFogConfig, Ai as intensifyRainConfig, zi as intensifySmogConfig, ji as intensifySnowCount, Si as isRainWeather, Ci as isSnowWeather, la as kmhToWindLevel, Ui as mapWmoCodeToWeatherType, xi as normalizeWeatherType, mi as precipBand, _i as precipLabel, Ei as rainLevelFromWeather, Mi as rainLevelFromWmo, ki as resolveSceneWeather, oa as sampleWindField, Bi as smogBankAlphaScale, Vi as smogLevelFromVisibility, Di as snowLevelFromWeather, Ni as snowLevelFromWmo, Zr as supportsFogLevel, oi as supportsHailLevel, wi as supportsRainLevel, Ri as supportsSmogLevel, Ti as supportsSnowLevel, Zi as useLiveWeather, $i as useSunTimes, na as visualWindLevel, ca as windLevelToKmh, sa as windStreakSpec };
|