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th) {
|
||
|
x = 0;
|
||
|
y++;
|
||
|
if(y >= cubeDepth) {
|
||
|
y = 0;
|
||
|
z++;
|
||
|
if(z >= cubeHeight) {
|
||
|
z = 0;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
FastLED.clear();
|
||
|
|
||
|
CHSV color = CHSV(gHue, 255, 255);
|
||
|
|
||
|
for(uint8_t i = 0; i < NUM_LEDS; i++) {
|
||
|
uint8_t cx = coordsX[i];
|
||
|
uint8_t cy = coordsY[i];
|
||
|
uint8_t cz = coordsZ[i];
|
||
|
|
||
|
if((cx == x && cy == y) || (cx == x && cz == z) || (cy == y && cz == z)) {
|
||
|
leds[i] = color;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void cubeXPalette() {
|
||
|
uint8_t hues = 8;
|
||
|
|
||
|
for (uint8_t i = 0; i < NUM_LEDS; i++) {
|
||
|
uint8_t x = coordsX[i];
|
||
|
|
||
|
leds[i] = ColorFromPalette(palettes[currentPaletteIndex], beat8(speed) - (x * hues));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void cubeYPalette() {
|
||
|
uint8_t hues = 8;
|
||
|
|
||
|
for (uint8_t i = 0; i < NUM_LEDS; i++) {
|
||
|
uint8_t y = coordsY[i];
|
||
|
|
||
|
leds[i] = ColorFromPalette(palettes[currentPaletteIndex], beat8(speed) - (y * hues));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void cubeZPalette() {
|
||
|
uint8_t hues = 8;
|
||
|
|
||
|
for (uint8_t i = 0; i < NUM_LEDS; i++) {
|
||
|
uint8_t z = coordsZ[i];
|
||
|
|
||
|
leds[i] = ColorFromPalette(palettes[currentPaletteIndex], beat8(speed) - (z * hues));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void cubeXYPalette() {
|
||
|
uint8_t hues = 8;
|
||
|
|
||
|
for (uint8_t i = 0; i < NUM_LEDS; i++) {
|
||
|
uint8_t x = coordsX[i];
|
||
|
uint8_t y = coordsY[i];
|
||
|
|
||
|
leds[i] = ColorFromPalette(palettes[currentPaletteIndex], beat8(speed) - ((x + y) * hues));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void cubeXZPalette() {
|
||
|
uint8_t hues = 8;
|
||
|
|
||
|
for (uint8_t i = 0; i < NUM_LEDS; i++) {
|
||
|
uint8_t x = coordsX[i];
|
||
|
uint8_t z = coordsZ[i];
|
||
|
|
||
|
leds[i] = ColorFromPalette(palettes[currentPaletteIndex], beat8(speed) - ((x + z) * hues));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void cubeYZPalette() {
|
||
|
uint8_t hues = 8;
|
||
|
|
||
|
for (uint8_t i = 0; i < NUM_LEDS; i++) {
|
||
|
uint8_t y = coordsY[i];
|
||
|
uint8_t z = coordsZ[i];
|
||
|
|
||
|
leds[i] = ColorFromPalette(palettes[currentPaletteIndex], beat8(speed) - ((y + z) * hues));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void cubeXYZPalette() {
|
||
|
uint8_t hues = 8;
|
||
|
|
||
|
for (uint8_t i = 0; i < NUM_LEDS; i++) {
|
||
|
uint8_t x = coordsX[i];
|
||
|
uint8_t y = coordsY[i];
|
||
|
uint8_t z = coordsZ[i];
|
||
|
|
||
|
leds[i] = ColorFromPalette(palettes[currentPaletteIndex], beat8(speed) - ((x + y + z) * hues));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void cubeXGradientPalette() {
|
||
|
uint8_t hues = 8;
|
||
|
|
||
|
for (uint8_t i = 0; i < NUM_LEDS; i++) {
|
||
|
uint8_t x = coordsX[i];
|
||
|
|
||
|
leds[i] = ColorFromPalette(gCurrentPalette, beat8(speed) - (x * hues));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void cubeYGradientPalette() {
|
||
|
uint8_t hues = 8;
|
||
|
|
||
|
for (uint8_t i = 0; i < NUM_LEDS; i++) {
|
||
|
uint8_t y = coordsY[i];
|
||
|
|
||
|
leds[i] = ColorFromPalette(gCurrentPalette, beat8(speed) - (y * hues));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void cubeZGradientPalette() {
|
||
|
uint8_t hues = 8;
|
||
|
|
||
|
for (uint8_t i = 0; i < NUM_LEDS; i++) {
|
||
|
uint8_t z = coordsZ[i];
|
||
|
|
||
|
leds[i] = ColorFromPalette(gCurrentPalette, beat8(speed) - (z * hues));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void cubeXYGradientPalette() {
|
||
|
uint8_t hues = 8;
|
||
|
|
||
|
for (uint8_t i = 0; i < NUM_LEDS; i++) {
|
||
|
uint8_t x = coordsX[i];
|
||
|
uint8_t y = coordsY[i];
|
||
|
|
||
|
leds[i] = ColorFromPalette(gCurrentPalette, beat8(speed) - ((x + y) * hues));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void cubeXZGradientPalette() {
|
||
|
uint8_t hues = 8;
|
||
|
|
||
|
for (uint8_t i = 0; i < NUM_LEDS; i++) {
|
||
|
uint8_t x = coordsX[i];
|
||
|
uint8_t z = coordsZ[i];
|
||
|
|
||
|
leds[i] = ColorFromPalette(gCurrentPalette, beat8(speed) - ((x + z) * hues));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void cubeYZGradientPalette() {
|
||
|
uint8_t hues = 8;
|
||
|
|
||
|
for (uint8_t i = 0; i < NUM_LEDS; i++) {
|
||
|
uint8_t y = coordsY[i];
|
||
|
uint8_t z = coordsZ[i];
|
||
|
|
||
|
leds[i] = ColorFromPalette(gCurrentPalette, beat8(speed) - ((y + z) * hues));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void cubeXYZGradientPalette() {
|
||
|
uint8_t hues = 8;
|
||
|
|
||
|
for (uint8_t i = 0; i < NUM_LEDS; i++) {
|
||
|
uint8_t x = coordsX[i];
|
||
|
uint8_t y = coordsY[i];
|
||
|
uint8_t z = coordsZ[i];
|
||
|
|
||
|
leds[i] = ColorFromPalette(gCurrentPalette, beat8(speed) - ((x + y + z) * hues));
|
||
|
}
|
||
|
}
|
||
|
|