Rainbow Cycle (Seg Line or Seg) - 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:

A classic effect!

Draws a repeated rainbow of a set length along segment lines, or whole segments, in a set direction. Suggested min length is 5 (ie red, yellow, green, blue, indigo/violet).

This is the 2D version of Rainbow Cycle. It draws rainbows on segment lines or whole segments. For most effects I would combine the two effects, but since this is a very basic effect I wanted to keep it more user friendly, so I kept the 1D version.

segMode:

segMode controls if the rainbow is drawn along segment lines or whole segments:

  • true -- The rainbow will be drawn across whole segments (each segment is a single shifting color).
  • false -- The rainbow will be drawn across segment lines (each line is a single shifting color).

Other Notes:

  • You can change all the effect's settings on the fly, but muse use setLengh() to change the rainbow's length.

  • You can also achieve the same effect by using Pixel Spork's built-in Color Modes, with the Color Mode Fill effect (also allows you to switch to different color modes).

Example Calls:

RainbowCycleSLSeg rainbowCycleSLSeg(mainSegments, 30, true, false, 80); 
/*  Will draw rainbows of length 30, 
    moving towards the end of the segment lines (direct is true), at 80ms.
    The rainbows will be drawn along segment lines (segMode is false). */

RainbowCycleSLSeg rainbowCycleSLSeg(mainSegments, 50, false, true, 80); 
/*  Will draw rainbows of length 50, 
     moving from the last to first segment (direct is false), at 80ms.
    The rainbow colors will be drawn on each segment (segMode is true). */

RainbowCycleSLSeg rainbowCycleSLSeg(mainSegments, false, true, 80); 
/*  Will draw rainbows of length 255 
    (the length is set to 255 by default b/c it is omitted from the constructor), 
    moving from the last to first segment (direct is false), at 80ms.
    The rainbow colors will be drawn on each segment  (segMode is true).*/

Constructor Definitions:

//Constructor for a custom length rainbow cycle
RainbowCycleSLSeg(SegmentSetPS &SegSet, uint16_t Length, bool Direct, bool SegMode, uint16_t Rate);

//Constructor for a full length rainbow (255)
RainbowCycleSLSeg(SegmentSetPS &SegSet, bool Direct, bool SegMode, uint16_t Rate);

Constructor Inputs:

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

  • uint16_t length (optional) -- The length of each rainbow, if omitted, 255 will be used. Can be changed later using setLength().

  • bool direct -- The direction the rainbows will move in (true is forward).

  • bool segMode -- Sets if the rainbows will be drawn along segment lines or whole segments (true will do whole segments).

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

  • uint8_t sat (default 255) -- HSV rainbow saturation value. See Common Vars "sat and hue" entry for more.

  • uint8_t val (default 255) -- HSV rainbow "value" value. See Common Vars "sat and hue" entry for more.

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

  • type var (default 255) -- desc

Class Functions:

  • void setLength(uint16_t newLength);

    Sets a new rainbow length.

  • void update();

    Updates the effect.

Reference Vars:

  • uint16_t length -- The length of the rainbow. Set using setLength().
⚠️ **GitHub.com Fallback** ⚠️