FastLED 3.9.15
Loading...
Searching...
No Matches
fl::FxEngine Class Reference

Detailed Description

Manages and renders multiple visual effects (Fx) for LED strips.

The FxEngine class is responsible for:

  • Storing and managing a collection of visual effects (Fx objects)
  • Handling transitions between effects
  • Rendering the current effect or transition to an output buffer
Examples
FxEngine.ino.

Definition at line 38 of file fx_engine.h.

#include <fx_engine.h>

+ Collaboration diagram for fl::FxEngine:

Public Types

typedef fl::FixedMap< int, FxPtr, FASTLED_FX_ENGINE_MAX_FXIntFxMap
 

Public Member Functions

 FxEngine (uint16_t numLeds, bool interpolate=true)
 Constructs an FxEngine with the specified number of LEDs.
 
 ~FxEngine ()
 Destructor for FxEngine.
 
IntFxMap_getEffects ()
 
int addFx (Fx &effect)
 Adds a new effect to the engine.
 
int addFx (FxPtr effect)
 Adds a new effect to the engine.
 
bool draw (uint32_t now, CRGB *outputBuffer)
 Renders the current effect or transition to the output buffer.
 
int getCurrentFxId () const
 
FxPtr getFx (int index)
 Retrieves an effect from the engine without removing it.
 
bool nextFx (uint16_t transition_ms=500)
 Transitions to the next effect in the sequence.
 
FxPtr removeFx (int index)
 Requests removal of an effect from the engine, which might not happen immediately (for example the Fx needs to finish a transition).
 
bool setNextFx (int index, uint16_t duration)
 Sets the next effect to transition to.
 
void setSpeed (float scale)
 Sets the speed of the fx engine, which will impact the speed of all effects.
 

Private Attributes

FxCompositor mCompositor
 Handles effect transitions and rendering.
 
int mCounter = 0
 
int mCurrId
 Id of the current effect.
 
uint16_t mDuration = 0
 Duration of the current transition.
 
bool mDurationSet = false
 Flag indicating if a new transition has been set.
 
IntFxMap mEffects
 Collection of effects.
 
bool mInterpolate = true
 
TimeScale mTimeFunction
 

The documentation for this class was generated from the following files: