TheaterChase

The TheaterChase pattern emulates the classic chase pattern from '50s era theater marquees.  In this variation, you can specify the foreground and background colors for the chasing lights.

Initialization:

The TheaterChase() function initializes the NeoPattern object for executing the TheaterChase pattern.

The color1 and color2 parameters specify the foreground and background colors of the pattern.

The increment parameter specifies the number of milliseconds between updates of the pattern and controls the speed of the chase effect.

The direction parameter is optional and allows you to run the pattern in FORWARD (the default) or REVERSE.

TotalSteps is set to the number of pixels in the strip.

// Initialize for a Theater Chase
    void TheaterChase(uint32_t color1, uint32_t color2, uint8_t interval, direction dir = FORWARD)
    {
        ActivePattern = THEATER_CHASE;
        Interval = interval;
        TotalSteps = numPixels();
        Color1 = color1;
        Color2 = color2;
        Index = 0;
        Direction = dir;
   }

Update:

 TheaterChaseUpdate() advances the chase pattern by one pixel.  Every 3rd pixel is drawn in the foreground color (color1).  All the rest are drawn in color2.

After writing the pixel colors to the strip via show(), Increment is called to update Index.

// Update the Theater Chase Pattern
    void TheaterChaseUpdate()
    {
        for(int i=0; i< numPixels(); i++)
        {
            if ((i + Index) % 3 == 0)
            {
                setPixelColor(i, Color1);
            }
            else
            {
                setPixelColor(i, Color2);
            }
        }
        show();
        Increment();
    }
Last updated on 2015-05-04 at 04.27.27 PM Published on 2015-03-02 at 12.29.14 PM