FastLED 3.9.15
Loading...
Searching...
No Matches

◆ drawMatrixRain()

void drawMatrixRain ( float peak)

Definition at line 370 of file advanced.h.

370 {
371 // Shift everything down
372 for (int x = 0; x < WIDTH; x++) {
373 for (int y = HEIGHT - 1; y > 0; y--) {
374 int currentIndex = xyMap(x, y);
375 int aboveIndex = xyMap(x, y - 1);
376 if (currentIndex >= 0 && currentIndex < NUM_LEDS &&
377 aboveIndex >= 0 && aboveIndex < NUM_LEDS) {
378 leds[currentIndex] = leds[aboveIndex];
379 leds[currentIndex].fadeToBlackBy(40);
380 }
381 }
382 }
383
384 // Add new drops based on audio
385 int numDrops = peak * WIDTH * audioGain.value() * autoGainValue;
386 for (int i = 0; i < numDrops; i++) {
387 int x = random(WIDTH);
388 int ledIndex = xyMap(x, 0);
389 if (ledIndex >= 0 && ledIndex < NUM_LEDS) {
390 leds[ledIndex] = CHSV(96, 255, 255); // Green
391 }
392 }
393}
CRGB leds[NUM_LEDS]
#define NUM_LEDS
int y
Definition simple.h:93
int x
Definition simple.h:92
fl::XYMap xyMap
Definition ColorBoost.h:57
#define WIDTH
Definition advanced.h:34
float autoGainValue
Definition advanced.h:89
UISlider audioGain("Audio Gain", 1.0f, 0.1f, 5.0f, 0.1f)
#define HEIGHT
Definition advanced.h:35
Representation of an HSV pixel (hue, saturation, value (aka brightness)).
Definition hsv.h:15

References audioGain(), autoGainValue, HEIGHT, leds, NUM_LEDS, WIDTH, x, xyMap, and y.

Referenced by loop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: