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

◆ drawMatrixRain()

void drawMatrixRain ( float peak)

Definition at line 372 of file advanced.h.

372 {
373 // Shift everything down
374 for (int x = 0; x < WIDTH; x++) {
375 for (int y = HEIGHT - 1; y > 0; y--) {
376 int currentIndex = xyMap(x, y);
377 int aboveIndex = xyMap(x, y - 1);
378 if (currentIndex >= 0 && currentIndex < NUM_LEDS &&
379 aboveIndex >= 0 && aboveIndex < NUM_LEDS) {
380 leds[currentIndex] = leds[aboveIndex];
381 leds[currentIndex].fadeToBlackBy(40);
382 }
383 }
384 }
385
386 // Add new drops based on audio
387 int numDrops = peak * WIDTH * audioGain.value() * autoGainValue;
388 for (int i = 0; i < numDrops; i++) {
389 int x = random(WIDTH);
390 int ledIndex = xyMap(x, 0);
391 if (ledIndex >= 0 && ledIndex < NUM_LEDS) {
392 leds[ledIndex] = CHSV(96, 255, 255); // Green
393 }
394 }
395}
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:61
#define WIDTH
Definition advanced.h:36
float autoGainValue
Definition advanced.h:91
UISlider audioGain("Audio Gain", 1.0f, 0.1f, 5.0f, 0.1f)
#define HEIGHT
Definition advanced.h:37
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: