MCPcopy Create free account
hub / github.com/FastLED/FastLED / drawFireEffect

Function drawFireEffect

examples/Audio/advanced/advanced.h:408–429  ·  view source on GitHub ↗

Visualization: Fire Effect (simplified for WebAssembly)

Source from the content-addressed store, hash-verified

406
407// Visualization: Fire Effect (simplified for WebAssembly)
408void drawFireEffect(float peak) {
409 // Simple fire effect without buffer
410 clearDisplay();
411
412 // Add heat at bottom based on audio
413 int heat = 100 + (peak * 155 * audioGain.value() * autoGainValue);
414 heat = fl::min(heat, 255);
415
416 for (int x = 0; x < WIDTH; x++) {
417 for (int y = 0; y < HEIGHT; y++) {
418 // Simple gradient from bottom to top
419 int heatLevel = heat * (HEIGHT - y) / HEIGHT;
420 heatLevel = heatLevel * random(80, 120) / 100; // Add randomness
421 heatLevel = fl::min(heatLevel, 255);
422
423 int ledIndex = xyMap(x, y);
424 if (ledIndex >= 0 && ledIndex < NUM_LEDS) {
425 leds[ledIndex] = HeatColor(heatLevel);
426 }
427 }
428 }
429}
430
431// Visualization: Plasma Wave
432void drawPlasmaWave(float peak) {

Callers 1

loopFunction · 0.85

Calls 4

clearDisplayFunction · 0.85
HeatColorFunction · 0.85
randomClass · 0.50
valueMethod · 0.45

Tested by

no test coverage detected