Skip to content

Animating Particles #5 ‐ Spritesheets

Syntax-Sculptor edited this page Nov 24, 2026 · 1 revision

Introduction

You might have noticed so far that every particle is a single image throughout its whole life. Under the hood, Palette uses the Image class for rendering particles, meaning .anm2 files are not supported. Fortunately, we can still animate particles by using the SpriteSheet module!

The SpriteSheet module allows for flipbook animations, meaning the particle is animated by its sprite sheet. This opens up countless opportunities for animating particles and breathing life into them.

For this page, we'll use the sprite sheet for the vanilla poof effect:

Save the above image into your mod's resources/gfx folder and name it poof.png. You can also just use any sprite sheet you want and follow along, though you may need to tweak the file path in Palette:CreateParticleEmitter.

Warning

When setting up your sprite sheet, every cell must be the same size! Inconsistent cell sizes will cause visual issues with the particle appearance such as clipping.

Setting up a Sprite Sheet

First, like every other module, set the Enabled field in SpriteSheet to true. Then, set the Columns and Rows fields under SpriteSheet to match how many rows and columns are in your sprite sheet. If you're using the poof sprite sheet from above, set both of them to 4:

local room = Game():GetRoom()
local spawnPos = room:GetCenterPos()
local emitter = Palette:CreateParticleEmitter("gfx/poof.png", spawnPos)
emitter.StartSpeed = 0
emitter.Lifetime = 30
emitter.SpriteSheet.Enabled = true
emitter.SpriteSheet.Columns = 4
emitter.SpriteSheet.Rows = 4
2026-11-23.13-04-28.mp4

Frame Over Time

By default, the emitter's Lifetime determines how fast a particle plays over its sprite sheet. For example, setting Lifetime to 60 plays the animation in 2 seconds. However, there are many situations where you might want to further fine-tune the speed of the animation. Fortunately, the SpriteSheet module offers a FrameOverTime field.

FrameOverTime allows you to control how far through the animation a particle is at each point in its lifetime. Just like the other over-lifetime fields, Value = 0 is the start of the animation, Value = 0.5 is halfway into the animation, Value = 1 is the end of the animation, and so on. By default, its value is:

emitter.SpriteSheet.FrameOverTime.Keys = {
    { Time = 0, Value = 0 },
    { Time = 1, Value = 1 },
}

This causes the particle to play through the entire animation at a constant speed.

We can change the keyframes to have the animation speed be fast before slowing it down near the end:

emitter.SpriteSheet.FrameOverTime.Keys = {
    { Time = 0, Value = 0 },
    { Time = 0.3, Value = 0.6 },
    { Time = 1, Value = 1 }
}
2026-11-23.13-18-29.mp4

Cycles and Start Frame

The SpriteSheet module allows you to control how many times a particle's animation plays and which frame it starts on:

  • Cycles (default: 1): How many times the particle plays through its animation.
  • StartFrame (default: 0): Which frame the animation starts on. If the animation gets past its last frame on the sprite sheet, it will wrap around to the first frame.

Warning

Frame Indexing: Just like how Isaac animations work, the value StartFrame is 0-indexed. So a value of 0 means it's the first frame in the animation, a value of 5 means it's the sixth frame in the animation, and so on.

Animation Types

So far, our animations play through an entire sprite sheet. SpriteSheet offers multiple different ways to animate our particle by allowing you to change AnimationType and RowMode.

AnimationType determines how the particle's animation plays. It accepts two values:

  • "WholeSheet" (default): The entire sprite sheet is treated as one animation.
  • "SingleRow": Each row in the sprite sheet becomes its own animation. Particles will only play through the frames of that row.

RowMode determines how a row is chosen when AnimationType is set to "SingleRow". It accepts two values:

  • "Random" (default): Each particle picks a random row when it spawns.
  • "Custom": Every particle picks the row set in SpriteSheet.Row. Rows start from 0.

Clone this wiki locally