Install Player-animator, Version 0.9.9 Or Later. [updated] May 2026

// 2. Draw the current frame on each animation tick player.onFrame = (frameIndex) => { const sx = (frameIndex % 4) * 32; // X offset in sprite sheet const sy = 0;

<canvas id="demoCanvas" width="64" height="64"></canvas> import Player from 'player-animator'; const canvas = document.getElementById('demoCanvas'); const ctx = canvas.getContext('2d'); install player-animator, version 0.9.9 or later.

If you’ve ever tried to build a sprite‑based animation system from scratch in JavaScript, you know how quickly it becomes messy: frame counters, manual canvas clearing, speed adjustments, and state management. That’s why I was excited to discover Player‑Animator – a tiny, no‑dependency library that makes sprite sheet animations a breeze. The library is available as an ES module

ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.drawImage( player.image, sx, sy, 32, 32, 0, 0, 64, 64 ); }; Or import directly:

As of its 0.9.9 release, the API is stable, flexible, and perfect for games, interactive avatars, or even animated icons. Let’s install it and write our first animation. You need version 0.9.9 or later . The library is available as an ES module. Using a package manager (npm / yarn) npm install player-animator@^0.9.9 Using a CDN (quick prototyping) <script type="importmap"> { "imports": { "player-animator": "https://unpkg.com/player-animator@0.9.9/index.js" } } </script> Or import directly: