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

◆ draw()

bool fl::FxEngine::draw ( uint32_t now,
CRGB * outputBuffer )

Renders the current effect or transition to the output buffer.

Parameters
nowThe current time in milliseconds.
outputBufferThe buffer to render the effect into.

Definition at line 82 of file fx_engine.cpp.

82 {
83 mTimeFunction.update(now);
84 uint32_t warpedTime = mTimeFunction.time();
85
86 if (mEffects.empty()) {
87 return false;
88 }
89 if (mDurationSet) {
90 FxPtr fx;
91 bool ok = mEffects.get(mCurrId, &fx);
92 if (!ok) {
93 // something went wrong.
94 return false;
95 }
96 mCompositor.startTransition(now, mDuration, fx);
97 mDurationSet = false;
98 }
99 if (!mEffects.empty()) {
100 mCompositor.draw(now, warpedTime, finalBuffer);
101 }
102 return true;
103}
bool mDurationSet
Flag indicating if a new transition has been set.
Definition fx_engine.h:125
FxCompositor mCompositor
Handles effect transitions and rendering.
Definition fx_engine.h:122
int mCurrId
Id of the current effect.
Definition fx_engine.h:123
IntFxMap mEffects
Collection of effects.
Definition fx_engine.h:121
uint16_t mDuration
Duration of the current transition.
Definition fx_engine.h:124
TimeWarp mTimeFunction
Definition fx_engine.h:119

References mCompositor, mCurrId, mDuration, mDurationSet, mEffects, and mTimeFunction.