Edge Burst (Seg Line) - AlbertGBarber/PixelSpork GitHub Wiki

See the Documentation Guide for help understanding each page section.

Effect Sample (see here for sample info)
Effect Sample Gif

Description:

An effect based on the "EdgeBurst" pattern in PixelBlaze that produces a rainbow burst half-way along the strip, that then expands and reflects back. The effect is mostly the same as the original, but I've set the start point of the waves to be picked randomly (a random segment line) for each wave by default. This adds some nice variation to the effect. You can also set your own start point using userOffset.

I've also added the ability to use a palette for the wave colors. You can also have them be chosen randomly for each wave, or mapped to a rainbow (set by rainbowMode).

You can also adjust the pause time factor between waves. I have this set to 2 (the original was 4), which makes the pause time very short.

The effect is adapted to work on segment lines for 2D use.

Random Palettes:

The randomize palette option is set by randomizePal. Note that the effect stores a *palette pointer and a local palette, paletteTemp. If you pass in your own palette, *palette is bound to your palette, otherwise I bind it to paletteTemp (which is set to a random set of colors). Randomizing a palette changes the colors in a palette directly, so you probably don't want it happening to your passed in palette. So I've coded the randomize to only work on the paletteTemp. If you always want a random palette, this is no problem, just call the random palette constructor, but if you wanted to switch from your palette to random palettes you need to:

<your effect instance name>.paletteTemp = paletteUtilsPS::makeRandomPalette(<num colors in temp palette>);
<your effect instance name>.palette = <your effect instance name>.&paletteTemp;

This fills in paletteTemp, and binds *palette to paletteTemp.

Random Start Points:

The original PixelBlaze effect locked the wave start point to halfway along the strip. IMO this is a bit too repetitive, so I added a random offset so the waves can spawn from any point on the strip. This is controlled by randomizeStart, and is turned on by default. If randomizeStart is false, it defaults to the strip's midpoint, but you can also set your own start point by adjusting userOffset. Note that this is added to the halfway point, and wraps.

Example Calls:

EdgeBurstSL edgeBurst(mainSegments, 15, 80);
/* Will do a a rainbow edge burst with a burst freq of 15
   The effect updates at 80ms */

EdgeBurstSL edgeBurst(mainSegments, cybPnkPal_PS, 10, 80);
/* Will do a an edge burst using colors from the cybPnkPal_PS palette,
   with a burst freq of 10
   The effect updates at 80ms */

EdgeBurstSL edgeBurst(mainSegments, 3, true, true, 10, 80);
/* Will do a an edge burst using a palette of 3 random colors with a burst freq of 10
   The palette colors will be randomly picked for each wave
   The waves will have random start points
   The effect updates at 80ms */

Constructor Definitions:

//Constructor for rainbow mode
EdgeBurstSL(SegmentSetPS &SegSet, uint8_t BurstFreq, uint16_t Rate);

//Constructor for colors from palette
EdgeBurstSL(SegmentSetPS &SegSet, palettePS &Palette, uint8_t BurstFreq, uint16_t Rate);

//Constructor for all random options
//(passing 0 for numColors turns on rainbowMode)
EdgeBurstSL(SegmentSetPS &SegSet, uint8_t numColors, bool RandomizePal, bool RandomizeStart,
            uint8_t BurstFreq, uint16_t Rate);

Constructor Inputs:

  • SegmentSetPS segSet -- The Segment Set the effect will draw on. See common vars segSet entry for more details.

  • palettePS palette (optional, see constructors) -- The set of colors the effect will use. See palettes. It is a pointer. See common vars palette entry for more details.

  • uint8_t numColors (optional, see constructors) -- How many colors will be in the randomly created palette. Only for the random options constructor. Passing 0 will turn rainbowMode on.

  • bool randomizePal (optional, see constructors, default true) -- Only for the random options constructor. If true, random palette colors will be chosen for each wave (see randomize notes in intro).

  • bool randomizeStart (optional, see constructors, default true) -- Only for the random options constructor. If true, then the starting point for each burst will be picked at random, if false, the point will be locked to the center of the strip.

  • uint8_t burstFreq (min value 1) -- How fast the bursts happen and move, recommend value of 5 - 30. Higher -> faster.

  • uint16_t rate -- Update rate (ms). Is a pointer, allowing you to bind it to an external variable. By default it's bound the effect's local variable, rateOrig. See common vars rate entry for more.

Other Settings:

  • uin8t_ burstPause (default 2, original code value was 4) -- Adjusts how long there is between bursts. Factors of 2 work best. 2 is almost no time, while 4 is roughly equal time between on and off. Note that higher values also increase wave speed, so you'll want to reduce your burstFreq.

  • bool rainbowMode (default false) -- If true, colors from the rainbow will be used. This is set automatically to true for the rainbow mode constructor, and can be set in the random options constructor by passing 0 for numColors.

  • uint16_t userOffset (default 0) -- A fixed, user controlled offset for the wave start points. Only useful if randomizeStart is false, (see randomize notes in intro).

  • bool showNow (default true) -- Controls if the effect "draws" during each update cycle by calling FastLED.show(). Common to all effects. See common vars showNow entry for more details.

Class Functions:

  • void update();
    Updates the effect.

Reference Vars:

  • uint16_t burstCount -- The number of bursts we've done. Not automatically reset.
⚠️ **GitHub.com Fallback** ⚠️