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

◆ draw()

void draw ( uint32_t now)

Definition at line 628 of file FxNoiseRing.h.

628 {
629 // Configure plasma parameters from UI controls with enhanced scaling
630 PlasmaParams plasma_params;
631 plasma_params.time_scale = timescale.as<float>();
632 plasma_params.noise_intensity = scale.as<float>() * 0.8f; // Slightly reduce for better visual balance
633 plasma_params.brightness = brightness.as<float>();
634 plasma_params.time_bitshift = timeBitshift.as<int>();
635 plasma_params.hue_offset = (now / 100) % 256; // Slow hue rotation for extra dynamism
636 plasma_params.noise_amplitude = 0.6f + 0.4f * sin(now * 0.001f); // Breathing noise effect
637
638 // Update palette manager with auto-cycling and manual control
639 palette_manager.update(now, autoPalette.value(), getPaletteIndex(palettes.value()));
640
641 // Update variant manager with enhanced parameters
642 variant_manager.update(now, autoCycle.value(), getVariantIndex(variants.value()), plasma_params);
643
644 // KICKASS rendering with performance optimizations
645 for (int i = 0; i < NUM_LEDS; i++) {
646 RingCoord coord = ring_lut.fastRingCoord(i);
647 CRGB pixel_color = variant_manager.renderPixel(coord, now);
648
649 // Apply global brightness and gamma correction for better visual quality
650 float global_brightness = brightness.as<float>();
651 pixel_color.r = (uint8_t)(pixel_color.r * global_brightness);
652 pixel_color.g = (uint8_t)(pixel_color.g * global_brightness);
653 pixel_color.b = (uint8_t)(pixel_color.b * global_brightness);
654
655 leds[i] = pixel_color;
656 }
657
658 // Optional: Add subtle sparkle overlay for extra visual interest
660 // Add random sparkles to 1% of LEDs
661 int sparkle_count = NUM_LEDS / 100 + 1;
662 for (int s = 0; s < sparkle_count; s++) {
663 int sparkle_pos = random16() % NUM_LEDS;
664 if (random8() > 250) { // Very rare sparkles
665 leds[sparkle_pos] = blend(leds[sparkle_pos], CRGB::White, 128);
666 }
667 }
668 }
669}
CRGB leds[NUM_LEDS]
#define NUM_LEDS
uint8_t getPaletteIndex(uint32_t millis32, int width, int max_width, int height, int max_height, uint32_t y_speed)
ColorPaletteManager palette_manager
UICheckbox autoPalette("Auto Cycle Palettes", true)
UICheckbox autoCycle("Auto Cycle Effects", true)
NoiseVariantManager variant_manager(palette_manager)
uint8_t getVariantIndex(const fl::string &name)
UISlider timescale("Time Scale", 1,.1, 10,.1)
UISlider timeBitshift("Time Bitshift", 5, 0, 16, 1)
RingLUT ring_lut
UIDropdown variants("Noise Variants", variant_names)
UIDropdown palettes("Color Palettes", palette_names)
float noise_intensity
Definition FxNoiseRing.h:93
float brightness
Definition FxNoiseRing.h:97
uint8_t hue_offset
Definition FxNoiseRing.h:96
uint8_t time_bitshift
Definition FxNoiseRing.h:95
float noise_amplitude
Definition FxNoiseRing.h:94
float time_scale
Definition FxNoiseRing.h:92
uint16_t scale
Definition Noise.ino:74
UISlider brightness("Brightness", 128, 0, 255, 1)
LIB8STATIC uint16_t random16()
Generate a 16-bit random number.
Definition random8.h:56
LIB8STATIC uint8_t random8()
Generate an 8-bit random number.
Definition random8.h:46
#define EVERY_N_MILLISECONDS(N)
Alias for EVERY_N_MILLIS.
Definition lib8tion.h:1221
CRGB blend(const CRGB &p1, const CRGB &p2, fract8 amountOfP2)
@ White
<div style='background:#FFFFFF;width:4em;height:4em;'></div>
Definition crgb.h:703
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:86

References autoCycle(), autoPalette(), fl::blend(), brightness(), PlasmaParams::brightness, EVERY_N_MILLISECONDS, getPaletteIndex(), getVariantIndex(), PlasmaParams::hue_offset, leds, PlasmaParams::noise_amplitude, PlasmaParams::noise_intensity, NUM_LEDS, palette_manager, palettes(), random16(), random8(), ring_lut, scale, PlasmaParams::time_bitshift, PlasmaParams::time_scale, timeBitshift(), timescale(), variant_manager(), variants(), and CRGB::White.

Referenced by loop().

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