From bcb33c1dd1b232e983ab20a4de6d970f9cdd5e46 Mon Sep 17 00:00:00 2001 From: Michael Wesemann Date: Mon, 16 Nov 2026 15:12:33 +0100 Subject: [PATCH] =?UTF-8?q?Matrix:=20ab=20und=20zu=20f=C3=A4llt=20ein=20ro?= =?UTF-8?q?ter=20Pixel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- effects.cpp | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 106e276..24eb3b8 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ Nach dem Einschalten läuft das Gewitter. | | Effekt | `id` | Dauer | Beschreibung | | --- | --- | --- | --- | --- | | 🧊 | Würfel im Würfel | `wuerfel` | 20 s | Pulse laufen als Würfelschalen von der Mitte zur Außenhaut | -| 🟩 | Matrix | `matrix` | 20 s | Grüne Zeichenketten rieseln herab | +| 🟩 | Matrix | `matrix` | 20 s | Grüne Zeichenketten rieseln herab, ab und zu fällt ein roter Pixel | | 🏀 | Flummis | `flummis` | 20 s | Zwei Bälle springen durch den Würfel | | 📸 | Blitzlicht | `blitzlicht` | 15 s | Würfel, Etage oder Ebene blitzt in wechselnden Farben (höchstens 2,5 Blitze/s) | | 📡 | Scanner | `scanner` | 20 s | Eine Ebene fegt hin und her, jedes Mal entlang einer anderen Achse | diff --git a/effects.cpp b/effects.cpp index 23b37ce..07e62ac 100644 --- a/effects.cpp +++ b/effects.cpp @@ -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 ---------------