Pride With Pal 2 (Seg Line) - AlbertGBarber/PixelSpork GitHub Wiki

See the Documentation Guide for help understanding each page section.

Effect looks very similar to this video, credit to Jason Coon.

Description:

An effect based on Pride2015 by Mark Kriegsman, and the work done by Jason Coon here. This version of the effect draws bands of color that shift out/in along segment lines, while brightness waves rotate around the segment set (each pixel gets one brightness that changes over time) creating ever-changing waves of color that shift and blend. I have further adapted the effect use a palette for colors (although you can still achieve the original Pride2015 effect using rainbow mode). Overall it looks similar to Jason Coon's Pride version as applied to his fibonacci: here.

I have created two versions of this effect, the other being Pride With Palette. In this version, the brightness waves move along the segment lines, but the colors are "rotated 90 degrees" so that they move across segments instead. This is different than the original Pride2015 effect, where both the brightness and color waves move together. Note that you need a 2D segment set to have this version fully work.

You can change these variables 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 clockwise around the segment set and shift with time.
  2. Waves of palette colors that shift from the center segment to the outer (or visa versa).

These components are largely independent and have their own settings, which I will go over below:

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 250 and the min 120, 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 25 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 350. 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.

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 3 and 7. 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:

PrideWPalSL2 prideWPal2(mainSegments, true, false, 80);
/*  Will do a rainbow effect, where colors shift from the outer to the center segment
    The brightness wave values will not be randomized, defaults will be used
    The effect updates at 80ms */

PrideWPalSL2 prideWPal2(mainSegments, 4, true, true, 80);
/*  Will do the effect using 4 random colors
    Colors will shift from the center to the outer segment
    The brightness wave values will be randomized,
    The effect updates at 80ms */

PrideWPalSL2 prideWPal2(mainSegments, cybPnkPal_PS, false, true, 80);
/*  Will do the effect using colors from the cybPnkPal_PS palette
    Colors will shift from the outer to the center segment
    The brightness wave values will be randomized,
    The effect updates at 80ms */

//Big constructor with all the wave settings, for if you really want to experiment!
PrideWPalSL2 prideWPal2(mainSegments, cybPnkPal_PS, true, 20, 120, 250, 350, 20, 40, 3, 7, 60);
/*  Will do the effect using colors from the cybPnkPal_PS palette
    Colors will shift from the center to the outer segment, using 20 steps to blend the colors
    The brightDepth 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
PrideWPalSL2(SegmentSetPS &SegSet, bool Direct, bool RandomBriInc, uint16_t Rate);

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

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

//Constructor with inputs for all main variables
PrideWPalSL2(SegmentSetPS &SegSet, palettePS &Palette, bool Direct, 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 direct -- The direction the colors move across segments. True is from the center segment to the outer.

  • 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 120) -- The minimum value of brightnessThetaInc16 (See Inputs Guide for notes).

  • uint8_t brightDepthMax (default 250) -- 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 350) -- The frequency that briThetaInc16 changes at (See Inputs Guide for notes).

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

  • uint8_t hueChangeMax (default 7) -- 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.