Cross Fade Cycle - 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:

Cross fades the entire Segment Set from one solid color to the next, following either a pattern and palette, a palette alone, or using random colors. Each fade is done in a specified number of steps. There are also several random mode settings allowing you to adjust how the next fade color is chosen.

You can set the effect to pause between between fades for a fixed length of time.

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

Does not work with colorModes.

randMode's (uint8_t) (default 0):

  • 0: Colors will be chosen in order from the pattern (not random).
  • 1: Colors will be chosen completely at random.
  • 2: Colors will be chosen randomly from the palette (not allowing repeats).

Example Calls:

uint8_t pattern_arr = {0, 2, 1};
patternPS pattern = {pattern_arr, SIZE(pattern_arr), SIZE(pattern_arr)};

CrossFadeCyclePS crossFadeCycle(mainSegments, pattern, cybPnkPal_PS, 40, 30);
/* Will fade from color 0, to color 2, to color 1 of the cybPnkPal_PS palette
   taking 40 steps for each fade, with 30ms between steps */

CrossFadeCyclePS crossFadeCycle(mainSegments, cybPnkPal_PS, 40, 30);
/* Will fade through the colors of the cybPnkPal_PS palette in order
   taking 40 steps for each fade, with 30ms between steps */

CrossFadeCyclePS crossFadeCycle(mainSegments, 40, 30);
/* Will fade from one random color to the next
   taking 40 steps for each fade, with 30ms between steps */

Constructor Definitions:

//Constructor for pattern and palette
CrossFadeCyclePS(SegmentSetPS &SegSet, patternPS &Pattern, palettePS &Palette, uint8_t Steps, uint16_t Rate);

//Constructor for palette as the pattern
CrossFadeCyclePS(SegmentSetPS &SegSet, palettePS &Palette, uint8_t Steps, uint16_t Rate);

//Constructor for random colors
CrossFadeCyclePS(SegmentSetPS &SegSet, uint8_t Steps, 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.

  • patternPS* pattern (optional, see constructors) -- The color pattern the effect will use. See patterns. It is a pointer. See common vars pattern entry for more details.

  • uint8_t steps -- How many steps for each fade.

  • uint16_t* rate -- Update rate (ms) (time between fade steps). 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:

  • uint8_t randMode (default 0) -- See randMode notes in intro.

  • uint16_t pauseTime (default 0) -- The time that the effect will pause for between fades (ms).

  • 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 setPaletteAsPattern();

    Sets the effect pattern to match the current effect palette. See Common Functions for more.

  • void reset();

    Restarts the effect from its initial state.

  • void update();

    Updates the effect.

Reference Vars:

  • uint16_t fadeCount -- The number of fade cycles we've gone through.

Flags:

  • bool paused -- If true then the effect is paused, it will begin fading again after pauseTime has passed.
⚠️ **GitHub.com Fallback** ⚠️