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 86 of file fx_engine.cpp.

86 {
87 mTimeFunction.update(now);
88 uint32_t warpedTime = mTimeFunction.time();
89
90 if (mEffects.empty()) {
91 return false;
92 }
93 if (mDurationSet) {
94 FxPtr fx;
95 bool ok = mEffects.get(mCurrId, &fx);
96 if (!ok) {
97 // something went wrong.
98 return false;
99 }
100 mCompositor.startTransition(now, mDuration, fx);
101 mDurationSet = false;
102 }
103 if (!mEffects.empty()) {
104 mCompositor.draw(now, warpedTime, finalBuffer);
105 }
106 return true;
107}
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
TimeScale mTimeFunction
Definition fx_engine.h:120
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

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