Animate Bitmap Sprites
Load sprite sheets, configure frame grid, preview animations in real-time, apply onion skinning, and export frames or animated GIFs - all client-side.
About
Sprite sheet animation is the backbone of 2D game rendering and pixel art workflows. A single miscount in your frame grid - wrong column or row value - produces torn frames, offset characters, and hours of debugging. This tool slices any bitmap sprite sheet into its constituent frames by computing each frame's source rectangle as x = col ร frameW and y = row ร frameH, where frameW = Wcols and frameH = Hrows. It then plays them back at a user-defined FPS with delta-time accumulation, guaranteeing frame-rate-independent timing regardless of monitor refresh rate.
Onion skinning overlays prior frames at decreasing opacity - a technique borrowed from traditional cel animation - so you can evaluate motion arcs without scrubbing frame by frame. The GIF exporter encodes frames using a native LZW compressor built into the browser's memory, producing a valid GIF89a binary. No server round-trip, no external dependency. Limitation: color quantization uses a median-cut palette of 256 colors per frame; sprite sheets exceeding that gamut will exhibit banding in the exported GIF. For pixel art with limited palettes this is typically irrelevant.
Formulas
Each frame's source coordinates in the sprite sheet are derived from the linear frame index:
where i is the current frame index (0-based), cols and rows define the grid, and W, H are the full sprite sheet pixel dimensions.
The animation loop uses delta-time accumulation for frame-rate independence:
where ฮt is the elapsed milliseconds since the previous requestAnimationFrame callback and acc is the time accumulator.
Reference Data
| Term | Definition | Typical Value |
|---|---|---|
| Sprite Sheet | Single image containing all animation frames in a grid | Power-of-two dimensions preferred |
| Frame Width | W รท cols | 16 - 256 px |
| Frame Height | H รท rows | 16 - 256 px |
| FPS (Frames Per Second) | Playback speed of animation | 8 - 24 for pixel art |
| Frame Interval | 1000FPS ms | 41.7 - 125 ms |
| Total Frames | cols ร rows | 4 - 64 |
| Onion Skin Depth | Number of previous frames shown transparently | 1 - 5 |
| Delta-Time Accumulation | Sum of elapsed ms since last frame advance | Varies per monitor |
| LZW Min Code Size | Starting bit width for GIF LZW compression | 2 - 8 bits |
| GIF89a | Graphics Interchange Format with animation extension | Max 256 colors per frame |
| Median-Cut Quantization | Palette reduction algorithm splitting color space | 256 output colors |
| Source Rectangle | Region in sheet: (sx, sy, sw, sh) | Pixel coordinates |
| requestAnimationFrame | Browser API syncing rendering to display refresh | 60 Hz typical |
| Ping-Pong Loop | Animation plays forward then reverses | Used for walk cycles |
| Pixel-Perfect Rendering | imageSmoothingEnabled = false | Critical for pixel art |
Frequently Asked Questions
imageSmoothingEnabled on the canvas for pixel-perfect rendering. If your source art is anti-aliased (non-pixel-art), the hard pixels at zoom may look jagged. This is correct behavior for pixel art. For smooth-art sprite sheets, the visual at 1ร zoom is accurate; the zoom feature is designed for pixel inspection.requestAnimationFrame fires at the monitor's refresh rate - typically 60 Hz. Setting FPS above 60 will not produce faster playback on a 60 Hz display. The frame interval formula 1000FPS bottlenecks at 16.67 ms. For 120 Hz displays, values up to 120 FPS are achievable.