Skip to content
Snippets Groups Projects
Commit 551326da authored by Malte Schmitz's avatar Malte Schmitz
Browse files

Use fill

parent ab69cf8a
No related branches found
No related tags found
No related merge requests found
...@@ -101,18 +101,12 @@ int state = STATE_PAUSE; ...@@ -101,18 +101,12 @@ int state = STATE_PAUSE;
void show() { void show() {
pixels.clear(); pixels.clear();
if (state == STATE_PAUSE) { if (state == STATE_PAUSE) {
for (int i = 0; i < greenLength; i++) { pixels.fill(0x00FF00, 0, greenLength);
pixels.setPixelColor(i, 0x00FF00);
}
if (singlePlayer) { if (singlePlayer) {
for (int i = NEOPIXEL_LEN / 2; i < NEOPIXEL_LEN; i++) { pixels.fill(0x0000FF, NEOPIXEL_LEN / 2);
pixels.setPixelColor(i, 0x0000FF);
}
} else { } else {
for (int i = NEOPIXEL_LEN - greenLength - 1; i < NEOPIXEL_LEN; i++) { pixels.fill(0x00FF00, NEOPIXEL_LEN - greenLength - 1);
pixels.setPixelColor(i, 0x00FF00);
}
int points = pointsInternal; int points = pointsInternal;
if (lastPointInternal && hideLastPoint) { if (lastPointInternal && hideLastPoint) {
points = max(0, points - 1); points = max(0, points - 1);
...@@ -131,17 +125,11 @@ void show() { ...@@ -131,17 +125,11 @@ void show() {
} }
} else if (state == STATE_FORWARD || state == STATE_BACKWARD) { } else if (state == STATE_FORWARD || state == STATE_BACKWARD) {
for (int i = 0; i < greenLength; i++) { pixels.fill(0x00FF00, 0, greenLength);
pixels.setPixelColor(i, 0x00FF00);
}
if (singlePlayer) { if (singlePlayer) {
for (int i = NEOPIXEL_LEN / 2; i < NEOPIXEL_LEN; i++) { pixels.fill(0x0000FF, NEOPIXEL_LEN / 2);
pixels.setPixelColor(i, 0x0000FF);
}
} else { } else {
for (int i = NEOPIXEL_LEN - greenLength - 1; i < NEOPIXEL_LEN; i++) { pixels.fill(0x00FF00, NEOPIXEL_LEN - greenLength - 1);
pixels.setPixelColor(i, 0x00FF00);
}
} }
pixels.setPixelColor(position, 0xFFFFFF); pixels.setPixelColor(position, 0xFFFFFF);
} }
...@@ -231,18 +219,14 @@ void handleButton() { ...@@ -231,18 +219,14 @@ void handleButton() {
void handleExternalMissedAnimation() { void handleExternalMissedAnimation() {
int step = (100 - taskExternalMissedAnimation.getIterations()) % 25; int step = (100 - taskExternalMissedAnimation.getIterations()) % 25;
pixels.clear(); pixels.clear();
for (int i = NEOPIXEL_LEN - 1 - 25; i < NEOPIXEL_LEN - 25 + step; i++) { pixels.fill(0xFF0000, NEOPIXEL_LEN - 1 - 25, step + 1);
pixels.setPixelColor(i, 0xFF0000);
}
pixels.show(); pixels.show();
} }
void handleInternalMissedAnimation() { void handleInternalMissedAnimation() {
int step = (100 - taskInternalMissedAnimation.getIterations()) % 25; int step = (100 - taskInternalMissedAnimation.getIterations()) % 25;
pixels.clear(); pixels.clear();
for (int i = 25 - step; i < 25; i++) { pixels.fill(0xFF0000, 25 - step, step + 1);
pixels.setPixelColor(i, 0xFF0000);
}
pixels.show(); pixels.show();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment