24#define NUM_LEDS ((WIDTH) * (HEIGHT))
25#define IS_SERPINTINE true
82 out.
crgbMap = WaveCrgbGradientMapPtr::New(electricBlueFirePal);
93 out.
crgbMap = WaveCrgbGradientMapPtr::New(electricGreenFirePal);
104 Serial.begin(115200);
105 auto screenmap =
xyMap.toScreenMap();
106 screenmap.setDiameter(.2);
129 uint8_t min_x = perc *
WIDTH;
130 uint8_t max_x = (1 - perc) *
WIDTH;
131 uint8_t min_y = perc *
HEIGHT;
132 uint8_t max_y = (1 - perc) *
HEIGHT;
133 int x = random(min_x, max_x);
134 int y = random(min_y, max_y);
145 pointTransition.
trigger(now, total, 0, 0);
148 if (!pointTransition.
isActive(now)) {
152 int mid_x =
WIDTH / 2;
155 int amount =
WIDTH / 2;
156 int start_x = mid_x - amount;
157 int end_x = mid_x + amount;
158 int start_y = mid_y - amount;
159 int end_y = mid_y + amount;
160 int curr_alpha = pointTransition.
update8(now);
161 int left_x = map(curr_alpha, 0, 255, mid_x, start_x);
162 int down_y = map(curr_alpha, 0, 255, mid_y, start_y);
163 int right_x = map(curr_alpha, 0, 255, mid_x, end_x);
164 int up_y = map(curr_alpha, 0, 255, mid_y, end_y);
166 float curr_alpha_f = curr_alpha / 255.0f;
168 float valuef = (1.0f - curr_alpha_f) *
fancyIntensity.value() / 255.0f;
171 for (
int x = left_x - span;
x < left_x + span;
x++) {
176 for (
int x = right_x - span;
x < right_x + span;
x++) {
181 for (
int y = down_y - span;
y < down_y + span;
y++) {
186 for (
int y = up_y - span;
y < up_y + span;
y++) {
235 static uint32_t nextTrigger = 0;
236 uint32_t trigger_delta = nextTrigger - now;
237 if (trigger_delta > 10000) {
242 if (now >= nextTrigger) {
245 uint32_t min_rand = 400 *
speed;
246 uint32_t max_rand = 2000 *
speed;
248 uint32_t min =
MIN(min_rand, max_rand);
249 uint32_t max =
MAX(min_rand, max_rand);
253 nextTrigger = now + random(min, max);
260 uint32_t now = millis();
UISlider speed("Speed", 1.0f, -20.0f, 20.0f, 0.01f)
XYMap xyMap(WIDTH, HEIGHT, false)
CFastLED FastLED
Global LED strip management instance.
central include file for FastLED, defines the CFastLED class/object
UISlider blurAmount("Global Blur Amount", 0, 0, 172, 1)
XYMap xyMap(WIDTH, HEIGHT, IS_SERPINTINE)
UISlider blurPassesLower("Wave Lower: Blur Passes", 1, 1, 10, 1)
UISlider blurPasses("Global Blur Passes", 1, 1, 10, 1)
UISlider blurAmountLower("Wave Lower: Blur Amount", 0, 0, 172, 1)
UISlider speedLower("Wave Lower: Speed", 0.26f, 0.0f, 1.0f)
UISlider blurPassesUpper("Wave Upper: Blur Passes", 1, 1, 10, 1)
UISlider fancyParticleSpan("Fancy Particle Span", 0.06f, 0.01f, 0.2f, 0.01f)
UICheckbox autoTrigger("Auto Trigger", true)
WaveFx waveFxLower(xyRect, CreateArgsLower())
UICheckbox halfDuplexUpper("Wave Upper: Half Duplex", true)
UISlider speedUpper("Wave Upper: Speed", 0.12f, 0.0f, 1.0f)
UITitle title("FxWave2D Demo")
void processAutoTrigger(uint32_t now)
UIButton button("Trigger")
UISlider fancySpeed("Fancy Speed", 796, 0, 1000, 1)
WaveFx::Args CreateArgsLower()
XYMap xyRect(WIDTH, HEIGHT, false)
UISlider dampeningUpper("Wave Upper: Dampening", 8.9f, 0.0f, 20.0f, 0.1f)
UICheckbox easeModeSqrt("Ease Mode Sqrt", false)
UIButton buttonFancy("Trigger Fancy")
UISlider fancyIntensity("Fancy Intensity", 32, 1, 255, 1)
UISlider triggerSpeed("Trigger Speed",.5f, 0.0f, 1.0f, 0.01f)
UIDescription description("Advanced layered and blended wave effects.")
UISlider blurAmountUpper("Wave Upper: Blur Amount", 95, 0, 172, 1)
SuperSample getSuperSample()
UISlider superSample("SuperSampleExponent", 1.f, 0.f, 3.f, 1.f)
void applyFancyEffect(uint32_t now, bool button_active)
UISlider dampeningLower("Wave Lower: Dampening", 9.0f, 0.0f, 20.0f, 0.1f)
UICheckbox halfDuplexLower("Wave Lower: Half Duplex", true)
WaveFx::Args CreateArgsUpper()
WaveFx waveFxUpper(xyRect, CreateArgsUpper())
LED controller for WS2812 LEDs with GRB color order.
uint8_t update8(uint32_t now) override
Compute current 0–255 output based on how much time has elapsed since trigger().
bool isActive(uint32_t now) const override
void trigger(uint32_t now) override
Call this when you want to (re)start the ramp cycle.
#define DEFINE_GRADIENT_PALETTE(X)
Defines a static RGB palette very compactly using a series of connected color gradients.
Implements a simple red square effect for 2D LED grids.
Representation of an RGB pixel (Red, Green, Blue)