Matrix: ab und zu fällt ein roter Pixel

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mikeandClaude Opus 5.5 committed 2026-11-16 15:12:33 +01:00
1 parent e2fc97fc68
commit bcb33c1dd1
2 files changed
+11 -5

No files matched your search

+10 -4
View File
@@ -295,19 +295,25 @@ void renderFireworks(uint32_t now) {
drawParticles();
}
// --- Matrix: grüne Zeichenketten rieseln herab --------------------------------
// --- Matrix: grüne Zeichenketten rieseln herab, ab und zu ein roter Pixel -------
void renderMatrix(uint32_t now) {
FastLED.clear();
if (random8() < 40)
spawnParticle(random8(CUBE_SIZE), random8(CUBE_SIZE), TOP, 0, 0, -rnd(0.06f, 0.15f), CRGB::Black);
if (random8() < 40) {
bool red = random8(20) == 0; // etwa alle 2-3 s
spawnParticle(random8(CUBE_SIZE), random8(CUBE_SIZE), TOP, 0, 0, -rnd(0.06f, 0.15f), red ? CRGB::Red : CRGB::Black);
}
moveParticles(0, 1, 0);
for (const Particle &p : particles) {
if (!p.life) continue;
if (!p.life || p.color.r) continue;
plot(p.x, p.y, p.z + 2, CRGB(0, brightness / 4, 0));
plot(p.x, p.y, p.z + 1, CRGB(0, brightness, 0));
plot(p.x, p.y, p.z, CRGB(highlight / 2, highlight, highlight / 2));
}
for (const Particle &p : particles) { // rote Pixel zuletzt und ohne Mischen, damit sie rein rot bleiben
int x = lroundf(p.x), y = lroundf(p.y), z = lroundf(p.z);
if (p.life && p.color.r && inCube(x, y, z)) at(x, y, z) = CRGB(highlight, 0, 0);
}
}
// --- Schnee: Flocken taumeln herab und bleiben unten kurz liegen ---------------