FastLED 3.10.8
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 22 of file flowfield.cpp.hpp.

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

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

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

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