Pride With Pal (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 Pride2015 by Mark Kriegsman, and the work done by Jason Coon here. Like the original effect, this version draws bands of color and brightness, creating ever-changing waves of color that shift and blend, however, I have adapted the effect to work in 2D using segment lines, and to use a palette for colors (the original effect can still be achieved by using a 1D segment set and rainbow mode).

I have created two versions of this effect. In this version, the color bands and brightness both move together along segment lines. This is closer to the original Pride2015, but expanded into 2D by extended the colors down each segment line. In the other version of the effect, Pride With Palette 2, the brightness waves remain the same, but the colors are "rotated 90 degrees" so that they move across segments instead.

Note that you can change most of the effect's settings on the fly, but doing so will probably cause the effect to "jump".

Inputs guide:

In adapting the effect for segment lines, I've had to change some of the wave inputs from the original "Pride2015" to get a good look. Likewise, I've replaced some of the hard-coded values with variables so you can tweak them if you like. I've also included default and random options for the wave settings. The default will use values hand-picked by me that I think look nice, while the random option will choose them from a set of ranges, making each instance of this effect more unique (but should still look pretty!).

I'll explain the main effect settings below. I will focus on using a palette, since all the variables effect it. The rainbow mode is more of an "as-is", where I don't expect people to change the variables.

Overall the effect has two components:

  1. Waves of varying brightness that rotate around the segment and shift in length/intensity with time.
  2. Waves of palette colors that rotate around the segment and shift in length with time.

Brightness Wave Settings:

The brightness waves can be set to either rotate with or contra to the colors.

  • brightDepthMin and brightDepthMax -- These control the max and min brightness the waves reach. By default the max is 224 and the min 100, which leans more towards the dark side. A lower min value will keep the segments at a "flat" brightness for longer.

  • briThetaInc16Min and briThetaInc16Max -- As the effect runs, the brightness waves divide between smaller, more numerous waves, and larger, but fewer waves. The "briTheta" max and min values indirectly set the maximum and minimum number of waves. The defaults for these values are 20 and 40, which vary the waves from ~2-4. I give you the option to randomize these on effect creation to create a unique effect. You can find the ranges for these in the init() function in the code. Also see randomizeBriInc().

  • briThetaFreq -- Has a default value of 203. Sets how quickly the effect cycles through the brightness waves. I give you the option to randomize this on effect creation to create a unique effect. You can find the ranges for this in init() function in the code, also see randomizeBriFreq(). Higher -> faster.

  • briDirect -- Sets the direction of the brightness waves relative to the color waves. True will have the waves rotate in the same direction, while false will have then reverse. This is a constructor option so there's no default, but the true gives you the original look from Mark's code.

Note that I only have functions for randomizing briThetaInc16Min, briThetaInc16Max, and briThetaFreq. These produce the most dramatic change in the effect, and both have a wide range of inputs where the effect still works. You can vary the other settings, but the effects will be more subtle.

Color Wave Settings:

  • hueChangeMin and hueChangeMax -- Sets the minimum and maximum shifts for colors in the palette. This effects how quickly colors will change and shift, "hueInc". The defaults for these are 5 and 9. The actual shift value will vary between the min and max over time. Lower -> slower shifts.

  • gradLength -- Sets how many steps we take to blend from one color to another. Default is 20. Lower numbers will increase the speed that colors appear, but I wouldn't set it below 10ish, or the shift will become more jagged. The effect of this is pretty subtle, so you may just want to leave it alone. Does not effect the rainbow mode.

Rainbow Mode (prideMode):

If prideMode is set true, the effect will use rainbow colors instead of palette colors, replicating the original "Pride2015" effect. There is a constructor for automatically triggering rainbow mode. Note that all the other effect settings still apply except gradLength (the 255 rainbow length is used instead), so you can customize or randomize the effect as you wish.

Example Calls:

PrideWPalSL prideWPal(mainSegments, true, false, 80);
/*  Will do the effect in rainbow mode, where the brightness waves move with the colors
    The brightness wave values will not be randomized, defaults will be used
    The effect updates at 80ms
    (replicates the original Pride2025 effect) */

PrideWPalSL prideWPal(mainSegments, 4, false, true, 80);
/*  Will do the effect using 4 random colors
    The brightness waves will move opposite to the colors
    The brightness wave values will be randomized, see init() for the ranges
    The effect updates at 80ms */

PrideWPalSL prideWPal(mainSegments, cybPnkPal_PS, true, true, 80);
/*  Will do the effect using colors from the cybPnkPal_PS palette
    The brightness waves will move with the colors
    The brightness wave values will be randomized, see init() for the ranges
    The effect updates at 80ms */

//Big constructor with all the wave settings, for if you really want to experiment!
PrideWPalSL prideWPal(mainSegments, cybPnkPal_PS, true, 20, 120, 250, 350, 20, 40, 3, 7, 60);
/*  Will do the effect using colors from the cybPnkPal_PS palette
    The brightness waves will move with the colors
    Colors will shift using 20 steps to blend the colors
    The brightnessThetaInc16 will vary from 120 to 250
    The briThetaInc16 will vary from 20 to 40 with a briThetaFreq of 350
    The hueInc will vary from 3 to 7
    The effect updates at 60ms */

Constructor Definitions:

//Constructor for rainbow mode
PrideWPalSL(SegmentSetPS &SegSet, bool BriDirect, bool RandomBriInc, uint16_t Rate);

//Constructor for palette input
PrideWPalSL(SegmentSetPS &SegSet, palettePS &Palette, bool BriDirect, bool RandomBriInc, uint16_t Rate);

//Constructor for making a random palette
PrideWPalSL(SegmentSetPS &SegSet, uint8_t numColors, bool BriDirect, bool RandomBriInc, uint16_t Rate);

//Constructor with inputs for all main settings
PrideWPalSL(SegmentSetPS &SegSet, palettePS &Palette, bool BriDirect, uint8_t GradLength, uint8_t BrightDepthMin, 
            uint8_t BrightDepthMax, uint16_t BriThetaFreq, uint8_t BriThetaInc16Min, uint8_t BriThetaInc16Max, 
            uint8_t HueChangeMin, uint8_t HueChangeMax, 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) -- The number of randomly chosen colors for the effect. The colors will be placed into the effect's local palette, paletteTemp for use.

  • bool briDirect -- Sets if the brightness waves move with or against the colors, true is with.

  • bool randomBriInc -- Set to true will randomize briThetaInc16 min and max, and the briThetaFreq. See init() in the code for ranges. You can also randomize the settings later using randomizeBriInc() and randomizeBriFreq().

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

Note that I've not included all the variables used in the constructor with all the settings (I didn't want to make the constructor vars more confusing). You can find the missing settings in "Other Settings" below.

Other Settings:

  • bool prideMode (default false, set automatically by constructor) -- If true, a rainbow will be used for colors instead of the palette.

  • uint8_t brightDepthMin (default 100) -- The minimum value of brightnessThetaInc16 (See Inputs Guide for notes).

  • uint8_t brightDepthMax (default 224) -- The maximum value of brightnessThetaInc16 (See Inputs Guide for notes).

  • uint8_t briThetaInc16Min (default 25) -- The minimum value of briThetaInc16 (See Inputs Guide for notes).

  • uint8_t briThetaInc16Max (default 40) -- The Maximum value of briThetaInc16 (See Inputs Guide for notes).

  • uint16_t briThetaFreq (default 203) -- The frequency that briThetaInc16 changes at (See Inputs Guide for notes).

  • uint8_t hueChangeMin (default 5) -- The minimum value of hueInc, effects how quickly colors will change (See Inputs Guide for notes).

  • uint8_t hueChangeMax (default 9) -- The maximum value of hueInc, effects how quickly colors will change (See Inputs Guide for notes).

  • uint16_t gradLength (default 20) -- How many gradient steps between palette colors (not used for rainbow).

  • 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 randomizeBriInc( uint8_t briThetaMinMin, uint8_t briThetaMinMax, uint8_t briThetaMaxMin, uint8_t briThetaMaxMax ); 

    Randomizes the range values of briThetaInc16 to between the passed in ranges. First pair of arguments are range for the briThetaInc16Min and second are for briThetaInc16Max. !!Warning, make sure that briThetaMinMax is less than briThetaMaxMin, so that briThetaInc16Min is always less than briThetaInc16Max.

  • void randomizeBriFreq( uint8_t briFreqMin, uint8_t briFreqMax ); 

    Randomizes the briThetaFreq to between the two passed in values.

  • void update();

    Updates the effect.

⚠️ **GitHub.com Fallback** ⚠️