src/fx/README.md
src/fx)The FX library adds optional, higher‑level visual effects and a small runtime around FastLED. It includes ready‑to‑use animations for strips (1D) and matrices (2D), utilities to layer/up‑scale/blend effects, and a simple video playback pipeline.
If you’re new to FastLED and C++: an effect is an object that you construct once and call draw(...) on every frame, passing time and your LED buffer. Start with the 1D/2D examples, then explore composition and video as needed.
1d/: Strip effects like Cylon, DemoReel100, Fire2012, NoiseWave, Pacifica, Pride2015, and TwinkleFox.2d/: Matrix effects including NoisePalette, WaveFx, ScaleUp, Blend2d (compositing effects), and Animartrix integrations.video/: Read frames from files/streams, buffer, and interpolate for smooth playback on your LEDs.detail/: Internal helpers for draw context, layering, transitions, and compositing.fl::Fx: abstract base with a single method to implement: void draw(DrawContext ctx).fl::Fx1d: base for strip effects; holds LED count and (optionally) an XMap.fl::Fx2d: base for matrix effects; holds an XYMap to convert (x,y) to LED indices.Fx::DrawContext carries per‑frame data: now (ms), CRGB* leds, optional frame_time, and a speed hint.CRGB, CHSV, CRGBPalette16, and timing helpers like beatsin*.#include "fx/1d/cylon.h"
fl::Cylon fx(num_leds);
...
fx.draw(fl::Fx::DrawContext(millis(), leds));
#include "fx/2d/noisepalette.h"
fl::XYMap xy(width, height, /* your mapper */);
fl::NoisePalette fx(xy);
...
fx.draw(fl::Fx::DrawContext(millis(), leds));
Blend2d to stack multiple 2D effects and blur/blend them.detail/ components (FxLayer, FxCompositor, Transition) support cross‑fading between effects over time.video/ pipeline reads frames from a FileHandle or ByteStream, keeps a small buffer, and interpolates between frames to match your output rate.src/fx/readme and headers for details.Explore each subfolder’s README to find the effect you want, then copy the corresponding header into your project and call draw(...) every frame.
examples/Fx*)examples/FxCylon/FxCylon.inoexamples/FxDemoReel100/FxDemoReel100.inoexamples/FxFire2012/FxFire2012.inoexamples/FxPacifica/FxPacifica.inoexamples/FxPride2015/FxPride2015.inoexamples/FxTwinkleFox/FxTwinkleFox.inoexamples/FxNoisePlusPalette/FxNoisePlusPalette.inoexamples/FxWave2d/examples/FxGfx2Video/FxGfx2Video.inoexamples/FxSdCard/FxSdCard.inoMinimal 1D call pattern:
fx.draw(fl::Fx::DrawContext(millis(), leds));
FastLED.show();
Minimal 2D call pattern (requires XYMap):
fl::NoisePalette fx(xyMap);
fx.draw(fl::Fx::DrawContext(millis(), leds));
FastLED.show();