FastLED 3.9.15
Loading...
Searching...
No Matches

◆ draw()

void fl::Particles1d::draw ( DrawContext context)
overridevirtual

Update and render all particles with overdraw technique.

Parameters
contextDraw context containing current time and LED buffer

Implements fl::Fx.

Definition at line 19 of file particles.cpp.hpp.

19 {
20 if (context.leds.empty() || mNumLeds == 0) return;
21
22 u32 now = context.now;
23
24 // Overdraw loop: multiple updates per frame for smooth trails
25 for (int overdraw = 0; overdraw < mOverdrawCount; overdraw++) {
26 // Fade trails
27 for (u16 i = 0; i < mNumLeds; i++) {
28 context.leds[i].nscale8(255 - mFadeRate);
29 }
30
31 // Update and draw all particles
32 for (size_t i = 0; i < mParticles.size(); i++) {
34 mParticles[i].draw(context.leds, now, mNumLeds);
35 }
36 }
37
38 // Soften composite with blur
39 blur1d(context.leds, 64);
40}
u16 mNumLeds
Definition fx.h:53
fl::vector< Particle > mParticles
Particle pool (oldest particle reused when full)
Definition particles.h:137
u8 mFadeRate
Fade amount per frame (0-255, higher = shorter trails)
Definition particles.h:132
u8 mOverdrawCount
Number of update/draw cycles per frame (higher = smoother trails, more CPU)
Definition particles.h:134
float mSpeedMultiplier
Global speed multiplier (1.0 = normal, >1.0 = faster, <1.0 = slower)
Definition particles.h:135
bool mCyclical
Wrap mode: true = wrap around, false = stop at edges.
Definition particles.h:136
void blur1d(fl::span< CRGB > leds, fract8 blur_amount) FL_NOEXCEPT
Definition blur.h:150

References Particles1d(), fl::blur1d(), draw(), mCyclical, mFadeRate, fl::Fx::mNumLeds, mOverdrawCount, mParticles, and mSpeedMultiplier.

Referenced by ~Particles1d(), and draw().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: