@mingxy/opencode-mascot 0.4.34 → 0.4.36

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mingxy/opencode-mascot",
3
- "version": "0.4.34",
3
+ "version": "0.4.36",
4
4
  "description": "OpenCode TUI mascot plugin framework - customizable ASCII mascots for your terminal",
5
5
  "author": "mingxy",
6
6
  "license": "MIT",
@@ -78,6 +78,7 @@ export function createAnimatedRenderer(pack: MascotPack): {
78
78
  let bounceTimers: ReturnType<typeof setTimeout>[] = [];
79
79
  let celebrateTimers: ReturnType<typeof setTimeout>[] = [];
80
80
  let versionTimer: ReturnType<typeof setTimeout> | null = null;
81
+ let fallTimers: ReturnType<typeof setTimeout>[] = [];
81
82
 
82
83
  const stopFlash = () => {
83
84
  if (flashTimer) { clearInterval(flashTimer); flashTimer = null; }
@@ -90,6 +91,10 @@ export function createAnimatedRenderer(pack: MascotPack): {
90
91
  bounceTimers.forEach(t => { clearTimeout(t); });
91
92
  bounceTimers = [];
92
93
  };
94
+ const stopFall = () => {
95
+ fallTimers.forEach(t => { clearTimeout(t); });
96
+ fallTimers = [];
97
+ };
93
98
  const stopCelebrate = () => {
94
99
  celebrateTimers.forEach(t => { clearTimeout(t); });
95
100
  celebrateTimers = [];
@@ -240,7 +245,12 @@ export function createAnimatedRenderer(pack: MascotPack): {
240
245
  if (currentState() === "idle" && !frameOverride() && walkStep === -1) {
241
246
  setJumpOffset(-2);
242
247
  setTimeout(() => setJumpOffset(-1), 1500);
243
- setTimeout(() => setJumpOffset(0), 2000);
248
+ setTimeout(() => {
249
+ setJumpOffset(0);
250
+ if (Math.random() < 0.4) {
251
+ fallApart();
252
+ }
253
+ }, 2000);
244
254
  }
245
255
  if (currentState() !== "sleeping") {
246
256
  jumpTimeout = scheduleNextJump();
@@ -274,6 +284,7 @@ export function createAnimatedRenderer(pack: MascotPack): {
274
284
  stopCelebrate();
275
285
  stopVersion();
276
286
  stopScatter();
287
+ stopFall();
277
288
  if (zzzTimer) { clearInterval(zzzTimer); zzzTimer = null; }
278
289
  });
279
290
 
@@ -459,8 +470,9 @@ export function createAnimatedRenderer(pack: MascotPack): {
459
470
  dy: i === 0 ? 2 : Math.floor(Math.random() * 3) + 1,
460
471
  }));
461
472
  setScatter(offsets);
462
- bounceTimers.push(setTimeout(() => {
473
+ fallTimers.push(setTimeout(() => {
463
474
  scatterIn();
475
+ fallTimers = [];
464
476
  }, 1500));
465
477
  };
466
478