src/fx/1d/README.md
This folder contains one-dimensional (strip) visual effects. All effects derive from fl::Fx1d and render into a linear CRGB* leds buffer using a common DrawContext.
If you’re new to FastLED and C++: think of an effect as a small object you construct once and then call draw(...) every frame with the current time and your LED buffer.
cylon.h): A single dot sweeps back and forth (Larson scanner). Tunable fade_amount, delay_ms.demoreel100.h): Classic demo with rotating patterns (rainbow, glitter, confetti, sinelon, bpm, juggle). Auto-advances every ~10 seconds.fire2012.h): Procedural fire simulation with parameters cooling and sparking, optional reverse direction and palette.noisewave.h): Smooth noise-driven red/blue waves across the strip.pacifica.h): Gentle blue-green ocean waves layered for depth.pride2015.h): Ever-changing rainbow animation.twinklefox.h): Twinkling holiday-style lights using palettes; compile-time knobs for speed/density and incandescent-style cooling.fl::Cylon fx(num_leds);).fx.draw(fl::Fx::DrawContext(now, leds));.Fire2012(num_leds, cooling, sparking)), or have internal timing based on now from DrawContext.nullptr and zero length, but you should pass a valid CRGB* and correct num_leds to see output.CRGBPalette16 to customize colors.CHSV, beatsin*, nblend, palettes, and random noise.fl::Fx1d: Base class for 1D effects.fl::Fx::DrawContext: Carries now (time in ms), CRGB* leds, and optional per-frame hints.CRGB / CHSV: FastLED’s color types.Explore the headers to see per-effect parameters and internal logic; everything here is self-contained and ready to drop into your render loop.
examples/FxCylon/FxCylon.ino):
#include <FastLED.h>
#include "fx/1d/cylon.h"
using namespace fl;
#define NUM_LEDS 64
CRGB leds[NUM_LEDS];
Cylon cylon(NUM_LEDS);
void setup() {
FastLED.addLeds<WS2812, 2, RGB>(leds, NUM_LEDS);
}
void loop() {
cylon.draw(Fx::DrawContext(millis(), leds));
FastLED.show();
delay(cylon.delay_ms);
}
examples/FxDemoReel100/FxDemoReel100.ino):
#include <FastLED.h>
#include "fx/1d/demoreel100.h"
using namespace fl;
#define NUM_LEDS 64
CRGB leds[NUM_LEDS];
DemoReel100Ptr fx = fl::make_shared<DemoReel100>(NUM_LEDS);
void setup() { FastLED.addLeds<WS2811, 3, GRB>(leds, NUM_LEDS); }
void loop() {
fx->draw(Fx::DrawContext(millis(), leds));
FastLED.show();
FastLED.delay(1000/120);
}
examples/FxFire2012/FxFire2012.ino):
#include <FastLED.h>
#include "fx/1d/fire2012.h"
using namespace fl;
#define NUM_LEDS 92
CRGB leds[NUM_LEDS];
Fire2012Ptr fire = fl::make_shared<Fire2012>(NUM_LEDS, 55, 120, false);
void setup() { FastLED.addLeds<WS2811, 5, GRB>(leds, NUM_LEDS); }
void loop() {
fire->draw(Fx::DrawContext(millis(), leds));
FastLED.show();
FastLED.delay(1000/30);
}
examples/FxPacifica/FxPacifica.ino):
#include <FastLED.h>
#include "fx/1d/pacifica.h"
using namespace fl;
#define NUM_LEDS 60
CRGB leds[NUM_LEDS];
Pacifica pacifica(NUM_LEDS);
void setup() { FastLED.addLeds<WS2812B, 3, GRB>(leds, NUM_LEDS); }
void loop() {
pacifica.draw(Fx::DrawContext(millis(), leds));
FastLED.show();
}
examples/FxPride2015/FxPride2015.ino):
#include <FastLED.h>
#include "fx/1d/pride2015.h"
using namespace fl;
#define NUM_LEDS 200
CRGB leds[NUM_LEDS];
Pride2015 pride(NUM_LEDS);
void setup() { FastLED.addLeds<WS2811, 3, GRB>(leds, NUM_LEDS); }
void loop() {
pride.draw(Fx::DrawContext(millis(), leds));
FastLED.show();
}
examples/FxTwinkleFox/FxTwinkleFox.ino):
#include <FastLED.h>
#include "fx/1d/twinklefox.h"
using namespace fl;
#define NUM_LEDS 100
CRGB leds[NUM_LEDS];
TwinkleFox fx(NUM_LEDS);
void setup() { FastLED.addLeds<WS2811, 3, GRB>(leds, NUM_LEDS).setRgbw(); }
void loop() {
EVERY_N_SECONDS(SECONDS_PER_PALETTE) { fx.chooseNextColorPalette(fx.targetPalette); }
fx.draw(Fx::DrawContext(millis(), leds));
FastLED.show();
}