From ff1913ea23b57893247304219f0ae50c9d03bdce Mon Sep 17 00:00:00 2001 From: Noah Date: Mon, 18 Dec 2017 00:19:48 -0800 Subject: [PATCH 1/2] draw inward color --- RGBShades.ino | 3 ++- effects.h | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 67 insertions(+), 2 deletions(-) diff --git a/RGBShades.ino b/RGBShades.ino index 5583378..012769a 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[] = {swirls, + threeSine, threeDee, scrollTextOne, plasma, diff --git a/effects.h b/effects.h index 6140c2a..9a06d24 100644 --- a/effects.h +++ b/effects.h @@ -6,6 +6,70 @@ // * 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 +void swirls() { + static boolean erase = false; + static uint8_t x, y, z = 0; + static uint8_t currentColor = 0; + //startup tasks + if (effectInit == false) { + effectInit = true; + erase = false; + x = 0; + y = 0; + z = 0; + effectDelay = 15; + FastLED.clear(); + currentPalette = RainbowColors_p; + } + + const uint8_t OutlineTable[] = { + 6,5,4,3,2,1,0,29,30,57,58,59,60,61,62,51,36,22,23,24,25,26,27,28,31,56,55,54,53,52,35,34,33,32,31 + }; + const uint8_t OutlineTable2[] = { + 7,8,9,10,11,12,13,14,43,44,67,66,65,64,63,50,37,21,20,19,18,17,16,15,42,45,46,47,48,49,38,39,40,41 + }; + + leds[OutlineTable[x]] = currentPalette[currentColor]; + leds[OutlineTable2[y]] = currentPalette[currentColor]; + if (erase) + leds[OutlineTable[x]] = currentPalette[currentColor]; + leds[OutlineTable2[y]] = currentPalette[currentColor]; + x++; + y++; + if (x == (sizeof(OutlineTable)) || y == (sizeof(OutlineTable2))) { + erase = !erase; + x = 0; + y = 0; + currentColor += random8(3, 6); + if (currentColor > 15) currentColor -= 16; + } +} + +// 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 +452,4 @@ void scrollTextOne() { void scrollTextTwo() { scrollText(2, NORMAL, CRGB::Green, CRGB(0,0,8)); -} \ No newline at end of file +} From 72202caefe3ffb9eb0234c555cec72ed245d2043 Mon Sep 17 00:00:00 2001 From: Noah Date: Mon, 18 Dec 2017 00:21:49 -0800 Subject: [PATCH 2/2] remove previous animation i keep doin that :( sorry --- effects.h | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/effects.h b/effects.h index 9a06d24..56ea7eb 100644 --- a/effects.h +++ b/effects.h @@ -45,31 +45,6 @@ void swirls() { } } -// 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() {