◀ Make the rainbow move
This commit is contained in:
parent
da0dd90562
commit
f00a164f74
@ -15,6 +15,7 @@ float cell_value(Cell c) {
|
||||
|
||||
Cell cells[PANEL_WIDTH * PANEL_HEIGHT];
|
||||
bool cells_setup = false;
|
||||
uint8_t rainbow_offset = 0;
|
||||
|
||||
void setup_cells() {
|
||||
for(int i = 0; i < PANEL_WIDTH * PANEL_HEIGHT; i++) {
|
||||
@ -37,10 +38,14 @@ void draw_supercomputer(MatrixPanel_I2S_DMA *matrix, Mode mode) {
|
||||
} else {
|
||||
// rainbow
|
||||
float progress = (255.0 / PANEL_WIDTH) * x;
|
||||
CHSV hsv_color((int)round(progress), 255, 255 * cell_value(cells[i]));
|
||||
uint8_t hue = ((int)round(progress) + rainbow_offset);
|
||||
CHSV hsv_color(hue, 255, 255 * cell_value(cells[i]));
|
||||
CRGB rgb;
|
||||
hsv2rgb_rainbow(hsv_color, rgb);
|
||||
matrix->drawPixel(x, i / PANEL_WIDTH, matrix->color565(rgb.r, rgb.g, rgb.b));
|
||||
}
|
||||
}
|
||||
if (mode == HighVis) {
|
||||
rainbow_offset++;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user