Skip to content

FireworksEffect

Source: FireworksEffect.h

FireworksEffect

class FireworksEffect
src/light/effects/FireworksEffect.h:31

Inherits: EffectBase

Effect: shells that rise, stall, and burst into falling sparks.

FireworksEffect card FireworksEffect controls

The particle kernel end to end, where every stage of a firework is one kernel call. The effect itself decides only when to launch and in what color.

Prior art: the WLED Particle System's firework family, where the physics here is the kernel's.

Public Attributes

uint8_t launchRate = 30 : How often a new shell goes up.

uint8_t launchSpeed = 150 : How hard a shell is thrown, and so how high it bursts.

uint8_t gravity = 6 : How fast everything falls.

uint8_t sparks = 20 : How many sparks each burst throws.

uint8_t sparkLife = 200 : How long a spark survives.

uint8_t drag = 3 : Air resistance, which flattens the arc.

uint8_t fade = 25 : Trail length, which is the Layer's decay rather than the pool's.

Public Methods

virtual inline const char * tags() const override : Catalog tags: this effect is the power-function showcase.

virtual inline Dim dimensions() const override : Writes the z=0 slice, which extrude fills through a volume.

virtual inline void defineControls() override : Publish the launch, the physics, the burst and the trail.

virtual inline void prepare() override : Size the spark pool and reset the shell.

virtual inline void tick() override : Simulate this frame's slice of time, then draw the sparks and any rising shell.

More info

Nothing schedules the apex

A shell is spawned with upward velocity, and gravity acts on it every frame. The burst fires when its vertical velocity crosses zero, so the physics decides where. That is why a faster launch bursts higher without a second control.

Each stage is a kernel call

spawn launches, gravity slows the rise, and angleEmit bursts a ring where it stalled. Gravity and drag then shape the fall, and age fades a spark as it dies. Trails come from the Layer's own decay rather than a second one hidden in the pool. Cost is one pass per force over a pool the effect sizes itself, plus a splat per live spark.