feat: 扩展精灵动画系统并新增 SpriteAnimator 组件

- 新增动画模式: breathe, bounce, walkLeft, walkRight, flip
- 新增 SpriteAnimator 组件,内置 tick 循环和居中渲染
- BuddyPanel 使用 SpriteAnimator 替代手动渲染

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
claude-code-best
2026-04-21 19:23:24 +08:00
parent 52a862e5b4
commit 722aa6c97a
5 changed files with 203 additions and 63 deletions

View File

@@ -18,7 +18,7 @@ import { calculateStats, getCreatureName, getTotalEV, getActiveCreature } from '
import { getXpProgress } from '@claude-code-best/pokemon';
import { getEVSummary } from '@claude-code-best/pokemon';
import { getGenderSymbol } from '@claude-code-best/pokemon';
import { StatBar } from '@claude-code-best/pokemon';
import { StatBar, SpriteAnimator, getFallbackSprite } from '@claude-code-best/pokemon';
import type { LocalJSXCommandContext, LocalJSXCommandOnDone } from '../../types/command.js';
const CYAN: Color = 'ansi:cyan';
@@ -151,10 +151,12 @@ function BuddyTab({
</Box>
{spriteLines && (
<Box flexDirection="column" alignItems="center" marginY={0}>
{spriteLines.map((line, i) => (
<Text key={i}>{line}</Text>
))}
<Box marginY={0}>
<SpriteAnimator
lines={spriteLines}
color={creature.isShiny ? YELLOW : CYAN}
tickMs={500}
/>
</Box>
)}