What problem does it solve?
This skill solves the challenge of creating, controlling, and synchronizing Phaser 4 sprite animations without getting lost in global vs local animation state.
Core Features & Use Cases
- Build animations from spritesheets and atlases: Use
generateFrameNumbers and generateFrameNames to define precise playback sequences for different texture sources.
- Play, chain, mix, and time animations: Manage playback on a per-sprite
AnimationState while using global AnimationManager features like mixes and staggered starts.
- React to animation lifecycle events: Handle
animationstart, animationupdate, animationrepeat, animationcomplete, animationstop, and key-specific events for deterministic gameplay logic.
- Use advanced playback controls: Pause/resume/stop, reverse playback, yoyo, random start frames, and per-frame duration tweaking for nuanced motion.
Quick Start
Define a global animation from a loaded spritesheet using this.anims.create(...), then play it on a sprite with sprite.play('explode') when creating your scene.