Skip to content

Commit 05570d7

Browse files
committed
fix(pets): keep BitBlob size consistent across actions
1 parent f70d3b8 commit 05570d7

4 files changed

Lines changed: 38 additions & 0 deletions

File tree

‎src/web-ui/public/agent-companion-pets/bitblob/README.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,22 @@ Each state was generated as its own grounded strip: quiet breathing/blinking; ri
1919

2020
Deterministic extraction, registration, composition and edge cleanup use the skill's scripts. Jumping uses the supported shared-viewport extraction to preserve the generated vertical arc; other standard rows use connected-component extraction.
2121

22+
## Consistent state transitions
23+
24+
The packaged atlas re-registers the existing artwork across all states, including
25+
the neutral slot and look directions. Each cell is uniformly scaled against a
26+
15,000-pixel alpha-weighted silhouette area, retaining 15% of its original
27+
within-row area variation for breathing and squash. This avoids using the full
28+
antenna height or a raised hand as a proxy for body size. The lower-body center
29+
is aligned to x=95.5 and the baseline to y=194 in each 192×208 cell. Jump frames
30+
use offsets of 0, 4, 16, 6, 0 pixels from that baseline.
31+
32+
This corrects the former half-sized jump, oversized working/waiting frames and
33+
per-frame size drift during review. The original poses, frame order, v2 layout
34+
and transparency remain intact. BitBlob plays only the atlas animation in the
35+
shared renderer; additional CSS breathing, hover squash and work/drag transforms
36+
are disabled for this built-in pet so they do not compound its authored motion.
37+
2238
## Verification
2339

2440
Validation covers the v2 geometry, populated and unused cells, alpha/chroma cleanup, frame clipping and component extraction. Independent visual review covers all nine animations, every look direction and continuity around the row boundaries. Three isolated reviewers classify the randomized horizontal/vertical direction sheet; cardinal ambiguity blocks packaging. Runtime/transport integration checks belong to the companion feature tests rather than the image pipeline.
-92.8 KB
Loading

‎src/web-ui/src/flow_chat/components/AgentCompanionPet.test.tsx‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,25 @@ function sprite() {
5151
}
5252

5353
describe('pet sprite renderer', () => {
54+
it('keeps built-in BitBlob motion in the atlas across session states', async () => {
55+
const bitblob = { ...pet, id: 'bitblob' };
56+
for (const mood of ['rest', 'hover', 'working', 'waiting', 'analyzing', 'dragging'] as const) {
57+
await act(async () => root.render(<AgentCompanionPet pet={bitblob} mood={mood} />));
58+
expect(sprite().style.animationName).toBe('openbitfun-petdex-walk');
59+
expect(sprite().style.imageRendering).toBe('auto');
60+
}
61+
await act(async () => root.render(<AgentCompanionPet pet={bitblob} mood="rest" action="jumping" />));
62+
expect(sprite().dataset.petAction).toBe('jumping');
63+
expect(sprite().style.animationDuration).toBe('1.2s');
64+
await act(async () => root.render(<AgentCompanionPet pet={bitblob} mood="rest" lookDirection={4} />));
65+
expect(sprite().style.animation).toBe('none');
66+
// A user pet with the same id must retain its own/default presentation.
67+
await act(async () => root.render(<AgentCompanionPet pet={{ ...bitblob, source: 'user' }} mood="working" />));
68+
expect(sprite().style.animationName).toBe('');
69+
await act(async () => root.render(<AgentCompanionPet pet={pet} mood="working" />));
70+
expect(sprite().style.animationName).toBe('');
71+
});
72+
5473
it.each([1, 2])('plays all three standard actions with v%s frame geometry and keeps drag priority', async version => {
5574
vi.useFakeTimers();
5675
vi.stubGlobal('Image', class {

‎src/web-ui/src/flow_chat/components/AgentCompanionPet.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,9 @@ export const AgentCompanionPet: React.FC<AgentCompanionPetProps> = ({
483483
className={`openbitfun-agent-companion-pet__petdex openbitfun-agent-companion-pet__petdex--${mood}`}
484484
style={{
485485
imageRendering: pet.source === 'preset' && pet.id === 'bitblob' ? 'auto' : undefined,
486+
// BitBlob's atlas already contains breathing, squash and movement.
487+
// Extra mood transforms change its apparent size when a session changes state.
488+
animationName: pet.source === 'preset' && pet.id === 'bitblob' ? 'openbitfun-petdex-walk' : undefined,
486489
'--openbitfun-petdex-src': `url("${petSrc}")`,
487490
'--openbitfun-petdex-row': row,
488491
'--openbitfun-petdex-frames': frames,

0 commit comments

Comments
 (0)