58 for (fl::u32
x = 0;
x <
width;
x++) {
61 leds[idx] =
CRGB(value8, value8, value8);
177 if (
args.crgbMap ==
nullptr) {
179 mCrgbMap = fl::make_shared<WaveCrgbMapDefault>();
182 mCrgbMap = args.crgbMap;
UINumberField palette("Palette", 0, 0, 2)
void setGradient(const Gradient &gradient)
Set or update the color gradient.
fl::GradientInlined Gradient
WaveCrgbGradientMap(const CRGBPalette16 &palette)
Construct with a color palette.
WaveCrgbGradientMap() FL_NOEXCEPT=default
Default constructor with no initial gradient.
void mapWaveToLEDs(const XYMap &xymap, WaveSimulation2D &waveSim, fl::span< CRGB > leds) override
Map wave values to gradient-colored LEDs.
Wave-to-color mapper using gradient/palette coloring.
virtual ~WaveCrgbMap() FL_NOEXCEPT=default
virtual void mapWaveToLEDs(const XYMap &xymap, WaveSimulation2D &waveSim, fl::span< CRGB > leds)=0
Convert wave simulation values to LED colors.
void mapWaveToLEDs(const XYMap &xymap, WaveSimulation2D &waveSim, fl::span< CRGB > leds) override
Map wave values to grayscale LED colors.
Default wave-to-color mapper producing grayscale output.
Abstract base class for mapping wave simulation values to LED colors.
void update()
Manually advance wave simulation by one step.
void setAutoUpdate(bool autoUpdate)
Enable/disable automatic simulation updates.
void setHalfDuplex(bool on)
Enable/disable half-duplex mode.
void setStencil(LaplacianStencil s) FL_NOEXCEPT
Select the discrete Laplacian stencil.
void setSpeed(float speed)
Set wave propagation speed.
void setf(size_t x, size_t y, float value)
Set wave amplitude at a specific grid position.
void setCrgbMap(WaveCrgbMapPtr crgbMap)
Set custom color mapping function.
void draw(DrawContext context) override
Render wave to LED array.
void setEasingMode(U8EasingFunction mode)
Set easing function for wave amplitude calculation.
LaplacianStencil getStencil() const FL_NOEXCEPT
Get the currently active Laplacian stencil.
WaveFx(const XYMap &xymap, Args args=Args())
Construct wave effect with given coordinate mapping and parameters.
void setSuperSample(SuperSample factor)
Set supersampling quality level.
void setUseChangeGrid(bool enabled)
Enable/disable change grid tracking optimization.
u8 getu8(size_t x, size_t y) const
Get wave amplitude as 8-bit value.
void setDampening(float dampening)
Set wave energy dampening.
bool getUseChangeGrid() const
Get current change grid tracking setting.
void addf(size_t x, size_t y, float value)
Add wave amplitude to existing value at a position.
void setXCylindrical(bool on)
Enable/disable cylindrical topology on x-axis.
fl::string fxName() const override
Get effect name.
WaveSimulation2D mWaveSim
2D wave simulation effect with supersampling and gradient coloring
fl::WaveSimulation1D waveSim(NUM_LEDS, fl::SuperSample::SUPER_SAMPLE_2X)
fl::UISlider dampening("Dampening", 6.0f, 0.0f, 10.0f, 0.1f)
FL_DISABLE_WARNING_PUSH U constexpr common_type_t< T, U > min(T a, U b) FL_NOEXCEPT
constexpr int type_rank< T >::value
Base definition for an LED controller.
#define FASTLED_SHARED_PTR(type)
Representation of an 8-bit RGB pixel (Red, Green, Blue)
float speed
Wave propagation speed (0.0-1.0, typical: 0.1-0.3)
bool x_cyclical
If true, waves wrap around the x-axis (cylindrical topology)
WaveCrgbMapPtr crgbMap
Custom color mapper (nullptr uses default grayscale)
bool auto_updates
If true, simulation advances automatically in draw()
WaveFxArgs() FL_NOEXCEPT=default
SuperSample factor
Supersampling quality (SUPER_SAMPLE_2X recommended for balance)
float dampening
Energy dampening factor (higher = faster decay, typical: 3-10)
bool half_duplex
If true, constrains waves to positive values only.
WaveFxArgs & operator=(const WaveFxArgs &) FL_NOEXCEPT=default
WaveFxArgs(const WaveFxArgs &) FL_NOEXCEPT=default
bool use_change_grid
Use change grid tracking for optimization (may reduce visual quality)
Configuration parameters for WaveFx effect.