ParticlesEffect
Source:
ParticlesEffect.h
ParticlesEffect¶
src/light/effects/ParticlesEffect.h:22Inherits:
EffectBase
Particle-system effect with spawned, moving points.
Author: WildCats08 / @Brandon502 (MoonLight), https://github.com/ewowi/MoonLight/blob/main/src/MoonLight/Nodes/Effects/E_MoonLight.h
Points drift, bounce off the walls and leave a fading trail behind them. The physics belong to particles::Pool, and what stays here is the drift rate and the hue map.
Public Attributes¶
uint8_t count = 32
: How many particles are alive.
uint8_t speed = 80
: How fast they drift.
uint8_t fade = 240
: How much of the trail each reference frame keeps.
uint8_t hue_shift = 0
: Walks every particle's color around the palette.
Public Methods¶
virtual inline const char * tags() const override
: Catalog tags: MoonLight origin, David Jupijn and Rising Step.
virtual inline Dim dimensions() const override
: Iterates y and x, so the trail covers the z=0 plane and extrude fills a volume.
virtual inline void defineControls() override
: Publish the population, the drift, the trail and the palette shift.
virtual inline void prepare() override
: Size the trail and the pool, and seed every particle once.
virtual inline void tick() override
: Fade the trail, move the particles, draw them into it, then copy it to the layer.
Public Static Attributes¶
constexpr uint8_t MAX_PARTICLES = 64
: The pool's size, of which count are alive at a time.
More info¶
Both carries exist for the same reason¶
The fade and the motion each spend a fraction of a reference frame per tick. At a high frame rate that fraction truncates to zero, so the remainder accumulates instead. Without it a fade of 240 never decays and the trail turns solid, and a slow speed never moves.