aboutsummaryrefslogtreecommitdiff
path: root/examples/AuroraDemo/PatternFlowField.h
diff options
context:
space:
mode:
authormrcodetastic <12006953+mrcodetastic@users.noreply.github.com>2024-07-28 22:00:45 +0100
committermrcodetastic <12006953+mrcodetastic@users.noreply.github.com>2024-07-28 22:00:45 +0100
commitf2634319ab7ebfe22fc6d2ebabcdd27879f3667e (patch)
treed8834f64f0dc4349bf34cf29a6831a12063b1435 /examples/AuroraDemo/PatternFlowField.h
parentaa28e2a93baaf90083b2d556c0ac80602d9940aa (diff)
Clean-up and fix some examples
Diffstat (limited to 'examples/AuroraDemo/PatternFlowField.h')
-rw-r--r--examples/AuroraDemo/PatternFlowField.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/examples/AuroraDemo/PatternFlowField.h b/examples/AuroraDemo/PatternFlowField.h
index 38f1083..8e41c3d 100644
--- a/examples/AuroraDemo/PatternFlowField.h
+++ b/examples/AuroraDemo/PatternFlowField.h
@@ -37,6 +37,7 @@ class PatternFlowField : public Drawable {
static const int count = 40;
+ unsigned long last_update_hue_ms = 0;
byte hue = 0;
void start() {
@@ -45,7 +46,7 @@ class PatternFlowField : public Drawable {
z = random16();
for (int i = 0; i < count; i++) {
- boids[i] = Boid(random(MATRIX_WIDTH), 0);
+ boids[i] = Boid(random(VPANEL_W), 0);
}
}
@@ -68,14 +69,15 @@ class PatternFlowField : public Drawable {
effects.drawBackgroundFastLEDPixelCRGB(boid->location.x, boid->location.y, effects.ColorFromCurrentPalette(angle + hue)); // color
- if (boid->location.x < 0 || boid->location.x >= MATRIX_WIDTH ||
- boid->location.y < 0 || boid->location.y >= MATRIX_HEIGHT) {
- boid->location.x = random(MATRIX_WIDTH);
+ if (boid->location.x < 0 || boid->location.x >= VPANEL_W ||
+ boid->location.y < 0 || boid->location.y >= VPANEL_H) {
+ boid->location.x = random(VPANEL_W);
boid->location.y = 0;
}
}
- EVERY_N_MILLIS(200) {
+ if (millis() - last_update_hue_ms > 200) {
+ last_update_hue_ms = millis();
hue++;
}