@mingxy/opencode-mascot 0.7.5 → 0.7.7
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/package.json
CHANGED
|
@@ -74,19 +74,41 @@ export function HomeMascot(props: HomeMascotProps): JSX.Element {
|
|
|
74
74
|
renderers[currentName()].setProp(getProp("box") ?? null);
|
|
75
75
|
|
|
76
76
|
const finalY = curY;
|
|
77
|
-
|
|
77
|
+
const finalX = curX;
|
|
78
|
+
const fallStartY = finalY - 15;
|
|
79
|
+
const fallDuration = 500;
|
|
80
|
+
const fallStartTime = Date.now();
|
|
81
|
+
curY = fallStartY;
|
|
78
82
|
applyPos();
|
|
79
|
-
|
|
83
|
+
|
|
80
84
|
const fallInterval = setInterval(() => {
|
|
81
|
-
|
|
82
|
-
|
|
85
|
+
const elapsed = Date.now() - fallStartTime;
|
|
86
|
+
const t = Math.min(elapsed / fallDuration, 1);
|
|
87
|
+
const eased = t * t;
|
|
88
|
+
curY = Math.round(fallStartY + (finalY - fallStartY) * eased);
|
|
83
89
|
applyPos();
|
|
84
|
-
if (
|
|
90
|
+
if (t >= 1) {
|
|
85
91
|
clearInterval(fallInterval);
|
|
86
92
|
curY = finalY;
|
|
87
93
|
applyPos();
|
|
94
|
+
|
|
95
|
+
setTimeout(() => {
|
|
96
|
+
const shakeSeq = [1, -1, 1, -1, 0];
|
|
97
|
+
let shakeIdx = 0;
|
|
98
|
+
const shakeInterval = setInterval(() => {
|
|
99
|
+
if (shakeIdx >= shakeSeq.length) {
|
|
100
|
+
clearInterval(shakeInterval);
|
|
101
|
+
curX = finalX;
|
|
102
|
+
applyPos();
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
curX = finalX + shakeSeq[shakeIdx];
|
|
106
|
+
applyPos();
|
|
107
|
+
shakeIdx++;
|
|
108
|
+
}, 60);
|
|
109
|
+
}, 2000);
|
|
88
110
|
}
|
|
89
|
-
},
|
|
111
|
+
}, 16);
|
|
90
112
|
|
|
91
113
|
setTimeout(() => {
|
|
92
114
|
renderers[currentName()].setProp(null);
|
|
@@ -221,16 +221,36 @@ export function SidebarMascot(props: SidebarMascotProps): JSX.Element {
|
|
|
221
221
|
renderers[currentName()].setProp(getProp("box") ?? null);
|
|
222
222
|
|
|
223
223
|
const finalY = posY();
|
|
224
|
-
|
|
225
|
-
|
|
224
|
+
const finalX = posX();
|
|
225
|
+
const fallStartY = finalY - 15;
|
|
226
|
+
const fallDuration = 500;
|
|
227
|
+
const fallStartTime = Date.now();
|
|
228
|
+
setPosY(fallStartY);
|
|
229
|
+
|
|
226
230
|
const fallInterval = setInterval(() => {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
231
|
+
const elapsed = Date.now() - fallStartTime;
|
|
232
|
+
const t = Math.min(elapsed / fallDuration, 1);
|
|
233
|
+
const eased = t * t;
|
|
234
|
+
setPosY(Math.round(fallStartY + (finalY - fallStartY) * eased));
|
|
235
|
+
if (t >= 1) {
|
|
230
236
|
clearInterval(fallInterval);
|
|
231
237
|
setPosY(finalY);
|
|
238
|
+
|
|
239
|
+
setTimeout(() => {
|
|
240
|
+
const shakeSeq = [1, -1, 1, -1, 0];
|
|
241
|
+
let shakeIdx = 0;
|
|
242
|
+
const shakeInterval = setInterval(() => {
|
|
243
|
+
if (shakeIdx >= shakeSeq.length) {
|
|
244
|
+
clearInterval(shakeInterval);
|
|
245
|
+
setPosX(finalX);
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
setPosX(finalX + shakeSeq[shakeIdx]);
|
|
249
|
+
shakeIdx++;
|
|
250
|
+
}, 60);
|
|
251
|
+
}, 2000);
|
|
232
252
|
}
|
|
233
|
-
},
|
|
253
|
+
}, 16);
|
|
234
254
|
|
|
235
255
|
setTimeout(() => {
|
|
236
256
|
renderers[currentName()].setProp(null);
|