test(e2e): add real-browser suite for sprite animation + keyboard-driven movement - #539
Open
stormmuller wants to merge 1 commit into
Open
test(e2e): add real-browser suite for sprite animation + keyboard-driven movement#539stormmuller wants to merge 1 commit into
stormmuller wants to merge 1 commit into
Conversation
…ven movement Adds a character-animation scene/spec exercising the sprite animation system end-to-end: the adventurer sprite sheet sliced into idle/run AnimationClips, keyboard-driven left/right movement via an Axis1dAction, clip switching, and sprite flipping, asserting against both ECS state and actual rendered/centroid-tracked canvas pixels. Also adds a matching documentation-site demo showcasing the same pattern, and fixes two documentation gaps found while building both: an outdated createImageSprite() call signature in the Sprite Animations guide, and a missing step (manually setting SpriteEcsComponent.uvScale from the sprite sheet's frame dimensions) that the guide's example omitted entirely. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAiYXVHjozy4yBLTLgTKfo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
e2e/fixtures/scenes/character-animation.ts+e2e/specs/character-animation.spec.ts: a real-browser Playwright suite exercising the sprite animation system end-to-end. It slices the adventurer sprite sheet (copied intoe2e/fixtures/to keep/e2edependent only on/src) into idle and runAnimationClips, drives left/right movement via a keyboard-boundAxis1dAction, and asserts on both ECS state (clip handle,animationFrameIndex,FlipEcsComponent.flipX, position) and actual rendered canvas pixels (a centroid-tracking measurement that stays robust to the run clip's swinging limbs, and a recentered-patch pixel diff that ties rendered output directly toanimationFrameIndexadvancing).documentation-site/src/pages/demos/sprite-animation/demo, wired into the "Demos" nav dropdown, showing the same idle/run/flip pattern driven by A/D keys.documentation-site/docs/docs/animations/sprite-animations.md) found while building the above:createImageSprite()call used a stale positional signature (new Vector2(32, 32)as a 4th argument) instead of the current options-object API ({ frameDimensions: new Vector2(32, 32) }).SpriteEcsComponent.uvScale, whichcreateImageSprite'sframeDimensionsoption does not set automatically (it only sizes the sprite's world-space quad) - the example rendered the entire sprite sheet squashed into one frame's quad instead of a single cropped frame. Added the missingsprite.uvScale = spriteSheet.frames[0][0].dimensions.clone();step (matching the existing pattern in the space-shooter demo's explosion sprite) plus an explicit troubleshooting note.No
/srcchanges - this is test and documentation-site work, so no CHANGELOG entry per AGENTS.md's excluded-types list.Test plan
npx tsc --noEmit --project e2e/tsconfig.json- passesnpx eslint e2e/fixtures/scenes/character-animation.ts e2e/specs/character-animation.spec.ts- passesnpx playwright test --config e2e/playwright.config.ts -g "character animation"- 5/5 pass, run 3x for flakiness, and verified the frame-advance assertion actually fails whencreateSpriteAnimationEcsSystemis disablednpm run check-types,npm test(1067 tests),npm run lint,npm run cspell,npm run check-exports- all passdocumentation-site:npm run typecheckandnpm run build- both pass/demos/sprite-animationin a browser and confirmed idle/run/flip render correctly with A/D inputGenerated by Claude Code