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

◆ drawPlasmaWave()

void drawPlasmaWave ( float peak)

Definition at line 422 of file advanced.h.

422 {
423 static float time = 0;
424 time += 0.05f + (peak * 0.2f);
425
426 CRGBPalette16 palette = getCurrentPalette();
427
428 for (int x = 0; x < WIDTH; x++) {
429 for (int y = 0; y < HEIGHT; y++) {
430 float value = sinf(x * 0.1f + time) +
431 sinf(y * 0.1f - time) +
432 sinf((x + y) * 0.1f + time) +
433 sinf(sqrtf(x * x + y * y) * 0.1f - time);
434
435 value = (value + 4) / 8; // Normalize to 0-1
436 value *= audioGain.value() * autoGainValue;
437
438 uint8_t colorIndex = value * 255;
439 int ledIndex = xyMap(x, y);
440 if (ledIndex >= 0 && ledIndex < NUM_LEDS) {
441 leds[ledIndex] = ColorFromPalette(palette, colorIndex + hue);
442 }
443 }
444 }
445}
CRGB leds[NUM_LEDS]
#define NUM_LEDS
uint8_t hue
int y
Definition simple.h:93
int x
Definition simple.h:92
fl::XYMap xyMap
Definition ColorBoost.h:61
UINumberField palette("Palette", 0, 0, 2)
#define WIDTH
Definition advanced.h:36
float autoGainValue
Definition advanced.h:91
UISlider audioGain("Audio Gain", 1.0f, 0.1f, 5.0f, 0.1f)
CRGBPalette16 getCurrentPalette()
Definition advanced.h:103
#define HEIGHT
Definition advanced.h:37
CRGB ColorFromPalette(const CRGBPalette16 &pal, fl::u8 index, fl::u8 brightness, TBlendType blendType)
fl::u32 time()
Universal millisecond timer - returns milliseconds since system startup.
Definition time.cpp:136

References audioGain(), autoGainValue, ColorFromPalette(), getCurrentPalette(), HEIGHT, hue, leds, NUM_LEDS, palette(), fl::time(), WIDTH, x, xyMap, and y.

Referenced by loop().

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