84 Effekte in 7 Kategorien: Festtage, Natur, Fraktal und Ruhe neu

- Kategorien Flash, Festtage (Weihnachten + Silvester), Musik, Floating,
  Natur, Fraktal, Ruhe mit je 12 Effekten; 66 neue Effekte, u. a.
  Weihnachtsbaum, Adventskranz, Countdown, Vulkan, Polarlicht, Mandelbrot,
  Lorenz-Attraktor, Leben 3D, Hilbertkurve, Sanduhr, Kerzenschein
- eine Datei je Kategorie (fx_*.cpp), gemeinsame Hilfen in fx.h
  (plotSoft, fresh/fxStart für den Effektstart, ringPos, wrap8)
- Gewitter bleibt der Starteffekt (jetzt in Natur)
- App: Farben für die neuen Kategorien
- README-Tabellen und API-Beispiele angepasst

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mikeandClaude Opus 5.5 committed 2026-11-16 12:31:58 +01:00
1 parent fba1d3faa6
commit 92d507fb0d
15 files changed
+2132 -80

No files matched your search

+17 -8
View File
@@ -1,6 +1,7 @@
#include "cube.h"
#include "fx.h"
const float MID = (CUBE_SIZE - 1) / 2.0f; // Mitte des Würfels
bool fresh = true;
uint32_t fxStart = 0;
float rnd(float a, float b) {
return a + (b - a) * random16() / 65535.0f;
@@ -13,14 +14,20 @@ void plot(float x, float y, float z, const CRGB &c) {
at(ix, iy, iz) += c;
}
// Verteilt einen Punkt anteilig auf die bis zu 8 umliegenden LEDs (weiche Bewegung).
void plotSoft(float x, float y, float z, const CRGB &c) {
int x0 = floorf(x), y0 = floorf(y), z0 = floorf(z);
float fx = x - x0, fy = y - y0, fz = z - z0;
for (uint8_t i = 0; i < 8; i++) {
int xi = x0 + (i & 1), yi = y0 + (i >> 1 & 1), zi = z0 + (i >> 2);
if (!inCube(xi, yi, zi)) continue;
float w = (i & 1 ? fx : 1 - fx) * (i & 2 ? fy : 1 - fy) * (i & 4 ? fz : 1 - fz);
if (w > 0.02f) at(xi, yi, zi) += CRGB(c).nscale8(uint8_t(sqrtf(w) * 255)); // Wurzel: wirkt gleichmäßiger hell
}
}
// --- Partikel (Feuerwerk, Matrix, Schnee) ------------------------------------
struct Particle {
float x, y, z, vx, vy, vz;
CRGB color;
uint8_t life; // 0 = frei, sonst Helligkeit
};
const uint8_t MAX_PARTICLES = 48;
Particle particles[MAX_PARTICLES];
void spawnParticle(float x, float y, float z, float vx, float vy, float vz, const CRGB &color) {
@@ -582,6 +589,8 @@ void drawSpecials(uint32_t now) {
// --- Effektwechsel ---------------------------------------------------------
void resetEffects() {
fresh = true;
fxStart = millis();
for (Particle &p : particles) p.life = 0;
for (Shock &w : shocks) w.start = 0;
audioBeat(); // alten Beat verwerfen