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

◆ blur1d()

void 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 454 of file colorutils.cpp.

455{
456 uint8_t keep = 255 - blur_amount;
457 uint8_t seep = blur_amount >> 1;
458 CRGB carryover = CRGB::Black;
459 for( uint16_t i = 0; i < numLeds; ++i) {
460 CRGB cur = leds[i];
461 CRGB part = cur;
462 part.nscale8( seep);
463 cur.nscale8( keep);
464 cur += carryover;
465 if( i) leds[i-1] += part;
466 leds[i] = cur;
467 carryover = part;
468 }
469}
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:72
@ Black
<div style='background:#000000;width:4em;height:4em;'></div>
Definition crgb.h:499
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:54

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

Referenced by loop().

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