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

◆ drawElectricStorm()

CRGB drawElectricStorm ( const RingCoord & coord,
uint32_t time_ms,
ColorPaletteManager & palette )

Definition at line 260 of file FxNoiseRing.h.

260 {
261 uint32_t fast_time = time_ms << 3; // 8x time acceleration
262
263 float x_noise = coord.x * 8000;
264 float y_noise = coord.y * 8000;
265
266 uint16_t noise1 = inoise16(x_noise, y_noise, fast_time);
267 uint16_t noise2 = inoise16(x_noise + 10000, y_noise + 10000, fast_time + 5000);
268
269 uint8_t threshold = 200;
270 bool lightning = (noise1 >> 8) > threshold || (noise2 >> 8) > threshold;
271
272 if (lightning) {
273 float lightning_intensity = max((noise1 >> 8) - threshold, (noise2 >> 8) - threshold) / 55.0f;
274 return palette.mapColor(0.7f, lightning_intensity, 1.0f); // Special lightning effect
275 } else {
276 float storm_intensity = (noise1 >> 8) / 1020.0f; // Very low intensity for background
277 return palette.mapColor(0.6f, storm_intensity);
278 }
279}
uint8_t noise2[NUM_LAYERS][WIDTH][HEIGHT]
Definition Fire2023.h:99
UINumberField palette("Palette", 0, 0, 2)
uint16_t inoise16(uint32_t x, uint32_t y, uint32_t z, uint32_t t)
16-bit, fixed point implementation of Perlin's noise.
Definition noise.cpp:420

References inoise16(), noise2, palette(), RingCoord::x, and RingCoord::y.

Referenced by NoiseVariantManager::renderVariant().

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