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

◆ drawBinaryPulse()

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

Definition at line 389 of file FxNoiseRing.h.

389 {
390 float pulse_period = 2000.0f;
391 float pulse_phase = fmod(time_ms, pulse_period) / pulse_period;
392
393 float distance_from_center = sqrt(coord.x * coord.x + coord.y * coord.y);
394
395 float ring_frequency = 5.0f;
396 float pulse_offset = pulse_phase * 2.0f;
397 float ring_value = sin((distance_from_center * ring_frequency - pulse_offset) * 2 * M_PI);
398
399 uint16_t noise = inoise16(coord.x * 2000, coord.y * 2000, time_ms / 8);
400 float digital_mod = ((noise >> 8) > 128) ? 1.0f : -0.5f;
401
402 float final_value = ring_value * digital_mod;
403
404 if (final_value > 0.3f) {
405 return palette.mapColor(0.8f, final_value, 0.8f); // Active pulse
406 } else if (final_value > -0.2f) {
407 float transition_intensity = (final_value + 0.2f) * 2.0f;
408 return palette.mapColor(0.3f, transition_intensity); // Transition zones
409 } else {
410 return palette.mapColor(0.7f, 0.1f); // Background
411 }
412}
uint8_t noise[NUM_LAYERS][WIDTH][HEIGHT]
Definition Fire2023.h:98
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
#define M_PI
Definition math_macros.h:93

References inoise16(), M_PI, noise, 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: