Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

radiating rainbow colors from center #17

Open
wants to merge 4 commits into
base: experimental
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion RGBShades.ino
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ void setup() {
}

// list of functions that will be displayed
functionList effectList[] = {threeSine,
functionList effectList[] = {radiateCenter,
threeSine,
threeDee,
scrollTextOne,
plasma,
Expand Down
28 changes: 27 additions & 1 deletion effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -388,4 +414,4 @@ void scrollTextOne() {

void scrollTextTwo() {
scrollText(2, NORMAL, CRGB::Green, CRGB(0,0,8));
}
}