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

◆ draw()

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

Handles timing, then delegates to drawImpl().

Caps dt to prevent huge jumps when effect was inactive.

Implements fl::Fx.

Examples
FlowField.ino.

Definition at line 21 of file flowfield.cpp.hpp.

21 {
22 u32 t_ms = mTimeWarp.update(context.now);
23 u32 dt_ms = t_ms - mLastWarpedMs;
24 mLastWarpedMs = t_ms;
25 // Cap dt to prevent huge jumps when effect was inactive (mode switch).
26 if (dt_ms > 500) {
27 dt_ms = 0;
28 }
29 mNoiseBias.update(dt_ms * 0.001f);
30 drawImpl(context, dt_ms, t_ms);
31}
NoiseBias2D mNoiseBias
Definition flowfield.h:287
virtual void drawImpl(DrawContext context, u32 dt_ms, u32 t_ms)=0
Subclasses implement rendering given the time delta and total time.
TimeWarp mTimeWarp
Definition flowfield.h:290

References drawImpl(), mLastWarpedMs, mNoiseBias, mTimeWarp, and fl::DrawContext::now.

Referenced by ~FlowField(), and loop().

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