Skip to content
phaserjs avatar

Animations

Sprite animation toolkit for Phaser 4 covering global definitions, per-sprite playback, and event hooks.

CCM score
75 of 100
skills.sh installs
1.4K
GitHub stars
40.8K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers spritesheet and atlas animations, plus play, stop, chain, reverse, mix, and pause controls for sprites
  • Includes generateFrameNumbers and generateFrameNames helpers, yoyo and repeat options, and events like animationcomplete and animationupdate
  • Separates global AnimationManager definitions from per-sprite AnimationState playback, with local animations taking priority when keys collide
  • Designed for Phaser 4 scenes that need shared or sprite-specific animation timing, frame callbacks, and chained sequences

Install

$ npx -y skills add phaserjs/phaser --skill animations -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Phaser 4 -- Sprite Animations

AnimationManager (global), AnimationState (per-sprite), creating animations from spritesheets and atlases, playing/pausing/chaining, animation events, frame callbacks.

Related skills: ../sprites-and-images/SKILL.md, ../loading-assets/SKILL.md


Quick Start

// In preload -- load a spritesheet
this.load.spritesheet('explosion', 'explosion.png', {
    frameWidth: 64,
    frameHeight: 64
});

// In create -- define a global animation
this.anims.create({
    key: 'explode',
    frames: this.anims.generateFrameNumbers('explosion', { start: 0, end: 11 }),
    frameRate: 24,
    repeat: 0
});

// Play it on a sprite
const sprite = this.add.sprite(400, 300, 'explosion');
sprite.play('explode');

Core Concepts

AnimationManager vs AnimationState

Phaser has two distinct animation objects:

Details

Repository
github.com/phaserjs/phaser
Categories
Game Development, Animation & Motion, Frontend & UI Code
First seen
Jun 3, 2026

Questions

How do I create and play a sprite animation from a spritesheet in Phaser 4?

Load the spritesheet with frame width and height, then register an animation with this.anims.create using generateFrameNumbers for the frame range. Call sprite.play with the animation key to start it on the sprite.

What is the difference between AnimationManager and AnimationState in Phaser 4?

AnimationManager is the global singleton on this.anims that stores animation definitions shared across all scenes. AnimationState lives on each sprite as sprite.anims and controls playback for that one object, so local animations take priority when a key matches.

How do I chain animations or react when one finishes?

Call sprite.chain with one key or an array of keys to queue animations that start after the current one completes or stops. Listen for animationcomplete or animationcomplete-explode events to run your own code when a specific animation finishes.

Which category is the Phaser animations skill in, and what sets it apart?

It sits in the Game Development category on Claude Marketplaces, alongside game-feel, game-ui-ux, level-design and higgsfield-game-generation. It covers spritesheets, atlases, AnimationManager, AnimationState, frame callbacks and animation events for Phaser 4.

More from phaserjs/phaser

All 8

Similar to Animations

More Game Development