|
FastLED 3.9.15
|
Fx2dTo1d samples a 2D effect into a 1D LED strip using a ScreenMap.
This class wraps any Fx2d effect and samples it into a 1D LED strip based on a ScreenMap that defines the coordinate mapping. This is useful for creating effects like sampling a circle from a rectangular grid, or any other arbitrary path through 2D space.
Example usage:
Definition at line 36 of file fx2d_to_1d.h.
#include <fx2d_to_1d.h>
Inheritance diagram for fl::Fx2dTo1d:
Collaboration diagram for fl::Fx2dTo1d:Public Types | |
| enum | InterpolationMode { NEAREST = int(SampleMode::SAMPLE_NEAREST) , BILINEAR = int(SampleMode::SAMPLE_BILINEAR) } |
| Interpolation mode for sampling the 2D grid. More... | |
Public Types inherited from fl::Fx | |
| using | DrawContext = ::fl::DrawContext |
Public Member Functions | |
| Fx2dTo1d (u16 numLeds, Fx2dPtr fx2d, const ScreenMap &screenMap, InterpolationMode mode=BILINEAR) | |
| Construct a 2D-to-1D sampling effect. | |
| void | draw (DrawContext context) override |
| fl::string | fxName () const override |
| Fx2dPtr | getFx2d () const |
| Get the underlying 2D effect. | |
| bool | hasFixedFrameRate (float *fps) const override |
| void | pause (u32 now) override |
| void | resume (u32 now) override |
| void | setFx2d (Fx2dPtr fx2d) |
| Replace the underlying 2D effect. | |
| void | setInterpolationMode (InterpolationMode mode) |
| Set the interpolation mode. | |
| void | setScreenMap (const ScreenMap &screenMap) |
| Set the screen map for coordinate mapping. | |
Public Member Functions inherited from fl::Fx1d | |
| Fx1d (u16 numLeds) | |
| void | setXmap (const XMap &xMap) |
| u16 | xyMap (u16 x) const |
Public Member Functions inherited from fl::Fx | |
| Fx (u16 numLeds) | |
| u16 | getNumLeds () const |
| virtual void | pause (fl::u32 now) |
| virtual void | resume (fl::u32 now) |
Private Attributes | |
| Fx2dPtr | mFx2d |
| fl::unique_ptr< CRGB[]> | mGrid |
| InterpolationMode | mInterpolationMode |
| ScreenMap | mScreenMap |
Additional Inherited Members | |
Protected Member Functions inherited from fl::Fx | |
| virtual | ~Fx () FL_NOEXCEPT |
Protected Attributes inherited from fl::Fx1d | |
| XMap | mXMap |
Protected Attributes inherited from fl::Fx | |
| u16 | mNumLeds |