diff --git a/RGBShades.ino b/RGBShades.ino index 5583378..9910c48 100644 --- a/RGBShades.ino +++ b/RGBShades.ino @@ -56,7 +56,8 @@ void setup() { } // list of functions that will be displayed -functionList effectList[] = {threeSine, +functionList effectList[] = {radiateCenter, + threeSine, threeDee, scrollTextOne, plasma, diff --git a/effects.h b/effects.h index 6140c2a..1efd526 100644 --- a/effects.h +++ b/effects.h @@ -6,6 +6,32 @@ // * All animation should be controlled with counters and effectDelay, no delay() or loops // * Pixel data should be written using leds[XY(x,y)] to map coordinates to the RGB Shades layout + +// radiating inward rainbow colors +void radiateCenter() { + static byte offset = 9; // counter for radial color wave motion + static int plasVector = 0; // counter for orbiting plasma center + + // startup tasks + if (effectInit == false) { + effectInit = true; + effectDelay = 0; + } + + int xOffset = 0; + int yOffset = 4; + + // Draw one frame of the animation into the LED array + for (int x = 0; x < kMatrixWidth; x++) { + for (int y = 0; y < kMatrixHeight; y++) { + byte color = sin8(sqrt(sq(((float)x - 7.5) * 12 + xOffset) + sq(((float)y - 2) * 12 + yOffset)) + offset); + leds[XY(x, y)] = ColorFromPalette(currentPalette, color, 255); + } + } + offset--; // wraps at 255 for sin8 + plasVector += 1; // using an int for slower orbit (wraps at 65536) +} + // Triple Sine Waves byte sineOffset = 0; // counter for current position of sine waves void threeSine() { @@ -388,4 +414,4 @@ void scrollTextOne() { void scrollTextTwo() { scrollText(2, NORMAL, CRGB::Green, CRGB(0,0,8)); -} \ No newline at end of file +}