@mingxy/opencode-mascot 0.7.2 → 0.7.4
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
|
@@ -71,14 +71,29 @@ export function HomeMascot(props: HomeMascotProps): JSX.Element {
|
|
|
71
71
|
renderers[currentName()].scatterIn();
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
renderers[currentName()].setCharacterHidden(true);
|
|
75
|
+
renderers[currentName()].setProp(getProp("box") ?? null);
|
|
76
|
+
|
|
77
|
+
const finalY = curY;
|
|
78
|
+
curY = finalY - 15;
|
|
79
|
+
applyPos();
|
|
80
|
+
let fallStep = 0;
|
|
81
|
+
const fallInterval = setInterval(() => {
|
|
82
|
+
fallStep++;
|
|
83
|
+
curY = finalY - 15 + fallStep;
|
|
84
|
+
applyPos();
|
|
85
|
+
if (fallStep >= 15) {
|
|
86
|
+
clearInterval(fallInterval);
|
|
87
|
+
curY = finalY;
|
|
88
|
+
applyPos();
|
|
80
89
|
}
|
|
81
|
-
},
|
|
90
|
+
}, 30);
|
|
91
|
+
|
|
92
|
+
setTimeout(() => {
|
|
93
|
+
renderers[currentName()].setProp(null);
|
|
94
|
+
renderers[currentName()].setCharacterHidden(false);
|
|
95
|
+
renderers[currentName()].scatterIn();
|
|
96
|
+
}, 6000);
|
|
82
97
|
|
|
83
98
|
const stopDrag = () => {
|
|
84
99
|
isDragging = false;
|
|
@@ -217,20 +217,29 @@ export function SidebarMascot(props: SidebarMascotProps): JSX.Element {
|
|
|
217
217
|
renderers[currentName()].scatterIn();
|
|
218
218
|
});
|
|
219
219
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
220
|
+
renderers[currentName()].setCharacterHidden(true);
|
|
221
|
+
renderers[currentName()].setProp(getProp("box") ?? null);
|
|
222
|
+
|
|
223
|
+
const finalY = posY();
|
|
224
|
+
setPosY(finalY - 15);
|
|
225
|
+
let fallStep = 0;
|
|
226
|
+
const fallInterval = setInterval(() => {
|
|
227
|
+
fallStep++;
|
|
228
|
+
setPosY(finalY - 15 + fallStep);
|
|
229
|
+
if (fallStep >= 15) {
|
|
230
|
+
clearInterval(fallInterval);
|
|
231
|
+
setPosY(finalY);
|
|
232
|
+
}
|
|
233
|
+
}, 30);
|
|
225
234
|
|
|
226
235
|
setTimeout(() => {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
236
|
+
renderers[currentName()].setProp(null);
|
|
237
|
+
renderers[currentName()].setCharacterHidden(false);
|
|
238
|
+
if (!scattered) {
|
|
239
|
+
scattered = true;
|
|
240
|
+
renderers[currentName()].scatterIn();
|
|
232
241
|
}
|
|
233
|
-
},
|
|
242
|
+
}, 6000);
|
|
234
243
|
|
|
235
244
|
return (
|
|
236
245
|
<box
|
|
@@ -50,6 +50,7 @@ export function createAnimatedRenderer(pack: MascotPack): {
|
|
|
50
50
|
setState: (s: MascotState) => void;
|
|
51
51
|
toggleWalk: () => void;
|
|
52
52
|
setDragging: (v: boolean) => void;
|
|
53
|
+
setCharacterHidden: (v: boolean) => void;
|
|
53
54
|
celebrateUpdate: (newVersion: string) => void;
|
|
54
55
|
bounce: () => void;
|
|
55
56
|
showVersion: (version: string) => void;
|
|
@@ -77,6 +78,7 @@ export function createAnimatedRenderer(pack: MascotPack): {
|
|
|
77
78
|
const [bomb, setBomb] = createSignal<{ fuse: string; count: string } | null>(null);
|
|
78
79
|
const [scatter, setScatter] = createSignal<{ dx: number; dy: number }[] | null>(null);
|
|
79
80
|
const [activeProp, setActiveProp] = createSignal<PropPack | null>(null);
|
|
81
|
+
const [characterHidden, setCharacterHiddenSignal] = createSignal(false);
|
|
80
82
|
const [propFrameIdx, setPropFrameIdx] = createSignal(0);
|
|
81
83
|
const [propPosition, setPropPosition] = createSignal<PropPosition | null>(null);
|
|
82
84
|
|
|
@@ -344,7 +346,9 @@ export function createAnimatedRenderer(pack: MascotPack): {
|
|
|
344
346
|
const width = rawLines[0]?.length ?? 10;
|
|
345
347
|
const blank = " ".repeat(width);
|
|
346
348
|
|
|
347
|
-
let lines: string[] =
|
|
349
|
+
let lines: string[] = characterHidden()
|
|
350
|
+
? rawLines.map(() => blank)
|
|
351
|
+
: rawLines.map((line, i) => {
|
|
348
352
|
if (!breathPhase()) {
|
|
349
353
|
if (i === 0) return blank;
|
|
350
354
|
return rawLines[i - 1];
|
|
@@ -477,6 +481,10 @@ export function createAnimatedRenderer(pack: MascotPack): {
|
|
|
477
481
|
}
|
|
478
482
|
};
|
|
479
483
|
|
|
484
|
+
const setCharacterHidden = (v: boolean) => {
|
|
485
|
+
setCharacterHiddenSignal(v);
|
|
486
|
+
};
|
|
487
|
+
|
|
480
488
|
const setDragging = (v: boolean) => {
|
|
481
489
|
setDraggingSignal(v);
|
|
482
490
|
if (v) {
|
|
@@ -650,5 +658,5 @@ export function createAnimatedRenderer(pack: MascotPack): {
|
|
|
650
658
|
|
|
651
659
|
const getProp = () => activeProp();
|
|
652
660
|
|
|
653
|
-
return { element, getState: currentState, setState, toggleWalk, setDragging, celebrateUpdate, bounce, showVersion, scatterIn, explode, setProp, getProp };
|
|
661
|
+
return { element, getState: currentState, setState, toggleWalk, setDragging, setCharacterHidden, celebrateUpdate, bounce, showVersion, scatterIn, explode, setProp, getProp };
|
|
654
662
|
}
|