11 mInterpolate(interpolate) {
18 if (mInterpolate && effect->hasFixedFrameRate(&fps)) {
21 effect = VideoFxWrapperPtr::New(effect);
23 bool auto_set = mEffects.empty();
24 bool ok = mEffects.insert(mCounter, effect).first;
30 mCompositor.startTransition(0, 0, effect);
36 bool ok = mEffects.next(mCurrId, &mCurrId,
true);
45 if (!mEffects.has(index)) {
55 if (!mEffects.has(index)) {
60 bool ok = mEffects.get(index, &removedFx);
65 if (mCurrId == index) {
67 mEffects.next(mCurrId, &mCurrId,
true);
76 if (mEffects.has(
id)) {
78 mEffects.get(
id, &fx);
85 mTimeFunction.update(now);
86 uint32_t warpedTime = mTimeFunction.time();
88 if (mEffects.empty()) {
93 bool ok = mEffects.get(mCurrId, &fx);
98 mCompositor.startTransition(now, mDuration, fx);
101 if (!mEffects.empty()) {
102 mCompositor.draw(now, warpedTime, finalBuffer);
int addFx(FxPtr effect)
Adds a new effect to the engine.
~FxEngine()
Destructor for FxEngine.
bool nextFx(uint16_t transition_ms=500)
Transitions to the next effect in the sequence.
bool setNextFx(int index, uint16_t duration)
Sets the next effect to transition to.
FxEngine(uint16_t numLeds, bool interpolate=true)
Constructs an FxEngine with the specified number of LEDs.
bool draw(uint32_t now, CRGB *outputBuffer)
Renders the current effect or transition to the output buffer.
FxPtr removeFx(int index)
Requests removal of an effect from the engine, which might not happen immediately (for example the Fx...
FxPtr getFx(int index)
Retrieves an effect from the engine without removing it.
Implements a simple red square effect for 2D LED grids.
Representation of an RGB pixel (Red, Green, Blue)