@mingxy/opencode-mascot 0.7.4 → 0.7.6
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
|
@@ -68,31 +68,49 @@ export function HomeMascot(props: HomeMascotProps): JSX.Element {
|
|
|
68
68
|
});
|
|
69
69
|
|
|
70
70
|
onScatter(() => {
|
|
71
|
-
renderers[currentName()].scatterIn();
|
|
72
71
|
});
|
|
73
72
|
|
|
74
73
|
renderers[currentName()].setCharacterHidden(true);
|
|
75
74
|
renderers[currentName()].setProp(getProp("box") ?? null);
|
|
76
75
|
|
|
77
76
|
const finalY = curY;
|
|
78
|
-
|
|
77
|
+
const finalX = curX;
|
|
78
|
+
const fallStartY = finalY - 15;
|
|
79
|
+
const fallDuration = 500;
|
|
80
|
+
const fallStartTime = Date.now();
|
|
81
|
+
curY = fallStartY;
|
|
79
82
|
applyPos();
|
|
80
|
-
|
|
83
|
+
|
|
81
84
|
const fallInterval = setInterval(() => {
|
|
82
|
-
|
|
83
|
-
|
|
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);
|
|
84
89
|
applyPos();
|
|
85
|
-
if (
|
|
90
|
+
if (t >= 1) {
|
|
86
91
|
clearInterval(fallInterval);
|
|
87
92
|
curY = finalY;
|
|
88
93
|
applyPos();
|
|
94
|
+
|
|
95
|
+
const shakeSeq = [1, -1, 1, -1, 0];
|
|
96
|
+
let shakeIdx = 0;
|
|
97
|
+
const shakeInterval = setInterval(() => {
|
|
98
|
+
if (shakeIdx >= shakeSeq.length) {
|
|
99
|
+
clearInterval(shakeInterval);
|
|
100
|
+
curX = finalX;
|
|
101
|
+
applyPos();
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
curX = finalX + shakeSeq[shakeIdx];
|
|
105
|
+
applyPos();
|
|
106
|
+
shakeIdx++;
|
|
107
|
+
}, 60);
|
|
89
108
|
}
|
|
90
|
-
},
|
|
109
|
+
}, 16);
|
|
91
110
|
|
|
92
111
|
setTimeout(() => {
|
|
93
112
|
renderers[currentName()].setProp(null);
|
|
94
113
|
renderers[currentName()].setCharacterHidden(false);
|
|
95
|
-
renderers[currentName()].scatterIn();
|
|
96
114
|
}, 6000);
|
|
97
115
|
|
|
98
116
|
const stopDrag = () => {
|
|
@@ -209,7 +209,7 @@ export function SidebarMascot(props: SidebarMascotProps): JSX.Element {
|
|
|
209
209
|
setTimeout(() => setZBoost(false), 3500);
|
|
210
210
|
});
|
|
211
211
|
|
|
212
|
-
let scattered =
|
|
212
|
+
let scattered = true;
|
|
213
213
|
|
|
214
214
|
onScatter(() => {
|
|
215
215
|
if (scattered) return;
|
|
@@ -221,24 +221,38 @@ 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
|
+
const shakeSeq = [1, -1, 1, -1, 0];
|
|
240
|
+
let shakeIdx = 0;
|
|
241
|
+
const shakeInterval = setInterval(() => {
|
|
242
|
+
if (shakeIdx >= shakeSeq.length) {
|
|
243
|
+
clearInterval(shakeInterval);
|
|
244
|
+
setPosX(finalX);
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
setPosX(finalX + shakeSeq[shakeIdx]);
|
|
248
|
+
shakeIdx++;
|
|
249
|
+
}, 60);
|
|
232
250
|
}
|
|
233
|
-
},
|
|
251
|
+
}, 16);
|
|
234
252
|
|
|
235
253
|
setTimeout(() => {
|
|
236
254
|
renderers[currentName()].setProp(null);
|
|
237
255
|
renderers[currentName()].setCharacterHidden(false);
|
|
238
|
-
if (!scattered) {
|
|
239
|
-
scattered = true;
|
|
240
|
-
renderers[currentName()].scatterIn();
|
|
241
|
-
}
|
|
242
256
|
}, 6000);
|
|
243
257
|
|
|
244
258
|
return (
|