|
FastLED 3.9.15
|
2D wave simulation effect with supersampling and gradient coloring
Creates realistic water-like wave effects on LED matrices. Features include:
Example usage:
#include <wave.h>
Inheritance diagram for fl::WaveFx:
Collaboration diagram for fl::WaveFx:Public Types | |
| using | Args = WaveFxArgs |
Public Types inherited from fl::Fx | |
| using | DrawContext = ::fl::DrawContext |
Public Member Functions | |
| WaveFx (const XYMap &xymap, Args args=Args()) | |
| Construct wave effect with given coordinate mapping and parameters. | |
| void | addf (size_t x, size_t y, float value) |
| Add wave amplitude to existing value at a position. | |
| void | draw (DrawContext context) override |
| Render wave to LED array. | |
| fl::string | fxName () const override |
| Get effect name. | |
| LaplacianStencil | getStencil () const FL_NOEXCEPT |
| Get the currently active Laplacian stencil. | |
| u8 | getu8 (size_t x, size_t y) const |
| Get wave amplitude as 8-bit value. | |
| bool | getUseChangeGrid () const |
| Get current change grid tracking setting. | |
| void | setAutoUpdate (bool autoUpdate) |
| Enable/disable automatic simulation updates. | |
| void | setCrgbMap (WaveCrgbMapPtr crgbMap) |
| Set custom color mapping function. | |
| void | setDampening (float dampening) |
| Set wave energy dampening. | |
| void | setEasingMode (U8EasingFunction mode) |
| Set easing function for wave amplitude calculation. | |
| void | setf (size_t x, size_t y, float value) |
| Set wave amplitude at a specific grid position. | |
| void | setHalfDuplex (bool on) |
| Enable/disable half-duplex mode. | |
| void | setSpeed (float speed) |
| Set wave propagation speed. | |
| void | setStencil (LaplacianStencil s) FL_NOEXCEPT |
| Select the discrete Laplacian stencil. | |
| void | setSuperSample (SuperSample factor) |
| Set supersampling quality level. | |
| void | setUseChangeGrid (bool enabled) |
| Enable/disable change grid tracking optimization. | |
| void | setXCylindrical (bool on) |
| Enable/disable cylindrical topology on x-axis. | |
| void | update () |
| Manually advance wave simulation by one step. | |
Public Member Functions inherited from fl::Fx2d | |
| Fx2d (const XYMap &xyMap) | |
| u16 | getHeight () const |
| u16 | getWidth () const |
| XYMap & | getXYMap () |
| const XYMap & | getXYMap () const |
| void | setXYMap (const XYMap &xyMap) |
| u16 | xyMap (u16 x, u16 y) const |
Public Member Functions inherited from fl::Fx | |
| Fx (u16 numLeds) | |
| u16 | getNumLeds () const |
| virtual bool | hasFixedFrameRate (float *fps) const |
| virtual void | pause (fl::u32 now) |
| virtual void | resume (fl::u32 now) |
Public Attributes | |
| bool | mAutoUpdates = true |
| WaveCrgbMapPtr | mCrgbMap |
| WaveSimulation2D | mWaveSim |
Additional Inherited Members | |
Protected Member Functions inherited from fl::Fx | |
| virtual | ~Fx () FL_NOEXCEPT |
Protected Attributes inherited from fl::Fx2d | |
| XYMap | mXyMap |
Protected Attributes inherited from fl::Fx | |
| u16 | mNumLeds |