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.
- Base classes:
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) anXMap.fl::Fx2d: base for matrix effects; holds anXYMapto convert(x,y)to LED indices.
- DrawContext:
Fx::DrawContextcarries per‑frame data:now(ms),CRGB* leds, optionalframe_time, and aspeedhint. - Palettes and helpers: Many effects use FastLED’s
CRGB,CHSV,CRGBPalette16, and timing helpers likebeatsin*.
#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));- Use
Blend2dto stack multiple 2D effects and blur/blend them. - The
detail/components (FxLayer,FxCompositor,Transition) support cross‑fading between effects over time.
- The
video/pipeline reads frames from aFileHandleorByteStream, keeps a small buffer, and interpolates between frames to match your output rate.
- FX components may use more memory/CPU than the FastLED core. They are designed for more capable MCUs (e.g., ESP32/Teensy/RP2040), but many examples will still run on modest hardware at smaller sizes.
- Most code follows the standard FastLED license. Animartrix is free for non‑commercial use and paid otherwise. See
src/fx/readmeand 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.
- 1D strip effects:
- Cylon:
examples/FxCylon/FxCylon.ino - DemoReel100:
examples/FxDemoReel100/FxDemoReel100.ino - Fire2012:
examples/FxFire2012/FxFire2012.ino - Pacifica:
examples/FxPacifica/FxPacifica.ino - Pride2015:
examples/FxPride2015/FxPride2015.ino - TwinkleFox:
examples/FxTwinkleFox/FxTwinkleFox.ino
- Cylon:
- 2D matrix effects:
- NoisePalette:
examples/FxNoisePlusPalette/FxNoisePlusPalette.ino - WaveFx layered:
examples/FxWave2d/
- NoisePalette:
- Video pipeline:
- Memory stream:
examples/FxGfx2Video/FxGfx2Video.ino - SD card playback:
examples/FxSdCard/FxSdCard.ino
- Memory stream:
Minimal 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();