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

◆ blur1d()

void fl::blur1d ( CRGB * leds,
uint16_t numLeds,
fract8 blur_amount )

One-dimensional blur filter.

Spreads light to 2 line neighbors.

  • 0 = no spread at all
  • 64 = moderate spreading
  • 172 = maximum smooth, even spreading
  • 173..255 = wider spreading, but increasing flicker

Total light is NOT entirely conserved, so many repeated calls to 'blur' will also result in the light fading, eventually all the way to black; this is by design so that it can be used to (slowly) clear the LEDs to black.

Parameters
ledsa pointer to the LED array to blur
numLedsthe number of LEDs to blur
blur_amountthe amount of blur to apply

Definition at line 54 of file blur.cpp.

54 {
55 uint8_t keep = 255 - blur_amount;
56 uint8_t seep = blur_amount >> 1;
57 CRGB carryover = CRGB::Black;
58 for (uint16_t i = 0; i < numLeds; ++i) {
59 CRGB cur = leds[i];
60 CRGB part = cur;
61 part.nscale8(seep);
62 cur.nscale8(keep);
63 cur += carryover;
64 if (i)
65 leds[i - 1] += part;
66 leds[i] = cur;
67 carryover = part;
68 }
69}
CRGB leds[NUM_LEDS]
Definition Apa102.ino:11
CRGB & nscale8(uint8_t scaledown)
Scale down a RGB to N/256ths of its current brightness, using "plain math" dimming rules.
Definition crgb.cpp:88
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Definition crgb.h:504
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:55

References CRGB::Black, leds, and CRGB::nscale8().

+ Here is the call graph for this function: