Visualization: Matrix Rain
| 380 | |
| 381 | // Visualization: Matrix Rain |
| 382 | void drawMatrixRain(float peak) { |
| 383 | // Shift everything down |
| 384 | for (int x = 0; x < WIDTH; x++) { |
| 385 | for (int y = HEIGHT - 1; y > 0; y--) { |
| 386 | int currentIndex = xyMap(x, y); |
| 387 | int aboveIndex = xyMap(x, y - 1); |
| 388 | if (currentIndex >= 0 && currentIndex < NUM_LEDS && |
| 389 | aboveIndex >= 0 && aboveIndex < NUM_LEDS) { |
| 390 | leds[currentIndex] = leds[aboveIndex]; |
| 391 | leds[currentIndex].fadeToBlackBy(40); |
| 392 | } |
| 393 | } |
| 394 | } |
| 395 | |
| 396 | // Add new drops based on audio |
| 397 | int numDrops = peak * WIDTH * audioGain.value() * autoGainValue; |
| 398 | for (int i = 0; i < numDrops; i++) { |
| 399 | int x = random(WIDTH); |
| 400 | int ledIndex = xyMap(x, 0); |
| 401 | if (ledIndex >= 0 && ledIndex < NUM_LEDS) { |
| 402 | leds[ledIndex] = CHSV(96, 255, 255); // Green |
| 403 | } |
| 404 | } |
| 405 | } |
| 406 | |
| 407 | // Visualization: Fire Effect (simplified for WebAssembly) |
| 408 | void drawFireEffect(float peak) { |