Skip to content

PaletteOverLifetime API

Syntax-Sculptor edited this page Nov 24, 2026 · 3 revisions

PaletteOverLifetime

A generic class used by modules that modify particle properties throughout their lifetime.

This class is accessible through:

  • ParticleEmitter.RotationOverLifetime
  • ParticleEmitter.ScaleOverLifetime
  • ParticleEmitter.ForceOverLifetime (see ForceOverLifetime)
  • ParticleEmitter.SpriteSheet.FrameOverTime
  • ParticleEmitter.ScaleBySpeed.Scale
  • ParticleEmitter.RotationBySpeed.Rotation

Properties

Property Type Default Description
CurveMode "Single" | "TwoCurves" "Single" Determines how the interpolation curves are handled.
DefaultValue Varies Depends on module The fallback value used in the case there are no keyframes
Enabled boolean false Whether the module is enabled.
Keys Keyframe<T>[] Depends on module. An array of keyframes used when CurveMode is set to "Single". The keyframes must be sorted by their Time values in ascending order.
KeysMin Keyframe<T>[] Depends on module. An array of keyframes used when CurveMode is set to "TwoCurves". The resulting value is interpolated with the value from KeysMax using a random factor assigned when each particle spawns. The keyframes must be sorted by their Time values in ascending order.
KeysMax Keyframe<T>[] Depends on module. An array of keyframes used when CurveMode is set to "TwoCurves". The resulting value is interpolated with the value from KeysMin using a random factor assigned when each particle spawns. The keyframes must be sorted by their Time values in ascending order.
Mode "Blend" | "Fixed" "Blend" Determines how the particular particle's property interpolates between keyframes.

Interpolation Mode

The Mode field determines how a particular value interpolates between two neighboring keyframes throughout the particle's lifetime:

  • "Blend": Linearly interpolates between the two neighboring keyframes.
  • "Fixed": Holds the previous keyframe's value until the next keyframe's timestamp is reached.

CurveMode

The CurveMode field determines how keyframes are evaluated to produce the final value throughout the particle's lifetime:

  • "Single": Evaluates Keys.
  • "TwoCurves": Evaluates both KeysMin and KeysMax. The final value is interpolated between the two results using a random factor assigned when the particle is spawned.

For exact interpolation behavior with keyframes, read the "Interpolation Mode" section.

Example: TwoCurves Demo

Demonstrates how setting CurveMode to "TwoCurves" affects the particle's size using ParticleEmitter.ScaleOverLifetime. Each particle receives a random interpolation factor when spawned, producing unique size behaviors for each particle between KeysMin and KeysMax:

local room = Game():GetRoom()

local emitter = Palette:CreateParticleEmitter("gfx/particle.png", room:GetCenterPos())
emitter.DirectionSpread = 10

local size = emitter.ScaleOverLifetime
size.Enabled = true
size.Mode = "Blend"
size.CurveMode = "TwoCurves"
size.KeysMin = {
    { Time = 0, Value = Vector(1, 1) },
    { Time = 1, Value = Vector(0, 0) }
}
size.KeysMax = {
    { Time = 0, Value = Vector(1, 1) },
    { Time = 1, Value = Vector(2, 2) }
}
2026-10-17.15-22-16.mp4

Clone this wiki locally