Color Melt (Seg Line) - AlbertGBarber/PixelSpork GitHub Wiki

See the Documentation Guide for help understanding each page section.

Effect Sample (see here for sample info)
Color Melt Sample

Description:

An effect based on the "RainbowMelt" pattern in PixelBlaze which produces rainbow bands that shift in an out. Basically a whole mess of rainbows. You can also supply your own colors with a palette. The effect is mostly the same as the original, but I've added the ability to change the melting frequency to speed up or slow down the melts, and also to slowly shift the melts across the strip.

The melt shifting can cause some weirdness, so you can disable it completely with phaseEnable = false or by setting the phaseFreq = 0 in the constructor.

As part of the effect, colors are dimmed in accordance with a wave, leaving large dark areas. I have given you to option to invert the brightness, making the dark areas bright and bright areas dim. (In my opinion, the effect looks better with them inverted).

The effect is adapted to work on segment lines for 2D use. Each line will be a single color.

Example Calls:

ColorMeltSL colorMelt(mainSegments, 15, 3, true, 80);
/*  Will do a melt with a meltFreq of 15 and a phaseFreq of 3
    Rainbow colors will be used
    The brightness waves will be inverted for more color
    The effect updates at 80ms */

ColorMeltSL colorMelt(mainSegments, cybPnkPal_PS, 9, 0, true, 80);
/*  Will do a melt with a meltFreq of 9 and a phaseFreq of 0
    Colors from the cybPnkPal_PS palette will be used
    Because the phaseFreq is 0, phaseEnable will be set false as part of the constructor
    The brightness waves will be inverted for more color
    The effect updates at 80ms */

ColorMeltSL colorMelt(mainSegments, 3, 9, 1, false 80);
/*  Will do a melt with a meltFreq of 9 and a phaseFreq of 1
    A palette of 3 random colors will be used
    The brightness waves will NOT be inverted
    The effect updates at 80ms */

Constructor Definitions:

//Constructor for rainbow mode
ColorMeltSL(SegmentSetPS &SegSet, uint8_t MeltFreq, uint8_t PhaseFreq, bool BriInvert, uint16_t Rate);  

//Constructor for colors from palette
ColorMeltSL(SegmentSetPS &SegSet, palettePS &Palette, uint8_t MeltFreq, uint8_t PhaseFreq, 
            bool BriInvert, uint16_t Rate);

//Constructor for a randomly created palette
ColorMeltSL(SegmentSetPS &SegSet, uint8_t numColors, uint8_t MeltFreq, uint8_t PhaseFreq, 
            bool BriInvert, 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.

  • uint8_t meltFreq -- How fast the melts happen, recommend value of 8 - 20, (min 1) (lower is faster).

  • uint8_t phaseFreq -- How quickly the melts are shifted around, can cause weirdness. Recommend values between 1 - 5. Passing in 0 to constructor will set phaseEnable to false.

  • bool briInvert -- If true, then the brightness wave will be inverted, producing larger areas of color (see intro above).

  • 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:

  • bool phaseEnable (default true) -- Allows the phase to shift over time at the phaseFreq.

  • uint8_t phase (default 0) -- The phase offset. This is changed over time when phaseEnable is true, but you can set it to a specific value if you like.

  • bool rainbowMode (default false) -- If true, colors from the rainbow will be used. This is set automatically to true for the rainbow mode constructor.

  • uint8_t hlDiv (default 2) -- Sets the melt divisions, the default of 2 is taken from the original effect. It's hard to describe what this does, but increasing it sort of shortens the melt waves.

  • 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.
⚠️ **GitHub.com Fallback** ⚠️