diff --git a/src/App/LedLayer.h b/src/App/LedLayer.h index cadd76f6..0705da99 100644 --- a/src/App/LedLayer.h +++ b/src/App/LedLayer.h @@ -46,6 +46,7 @@ enum ProjectionsE p_Spacing, p_Transpose, p_Kaleidoscope, + p_Scrolling, p_count // keep as last entry }; diff --git a/src/App/LedModEffects.h b/src/App/LedModEffects.h index bfc6c090..e6f9d1ec 100644 --- a/src/App/LedModEffects.h +++ b/src/App/LedModEffects.h @@ -138,6 +138,7 @@ class LedModEffects:public SysModule { fixture.projections.push_back(new SpacingProjection); fixture.projections.push_back(new TransposeProjection); fixture.projections.push_back(new KaleidoscopeProjection); + fixture.projections.push_back(new ScrollingProjection); #ifdef STARLIGHT_CLOCKLESS_LED_DRIVER #if !(CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32S2) diff --git a/src/App/LedProjections.h b/src/App/LedProjections.h index 17e9c1f8..8671ed52 100644 --- a/src/App/LedProjections.h +++ b/src/App/LedProjections.h @@ -683,6 +683,45 @@ class KaleidoscopeProjection: public Projection { } }; //KaleidoscopeProjection +class ScrollingProjection: public Projection { + const char * name() {return "Scrolling WIP";} + const char * tags() {return "💫";} + + void setup(LedsLayer &leds, Coord3D &sizeAdjusted, Coord3D &pixelAdjusted, Coord3D &midPosAdjusted, Coord3D &mapped, uint16_t &indexV) { + MirrorProjection mp; + mp.setup(leds, sizeAdjusted, pixelAdjusted, midPosAdjusted, mapped, indexV); + } + + void adjustXYZ(LedsLayer &leds, Coord3D &pixel) { + leds.projectionData.begin(); + bool mirrorX = leds.projectionData.read(); // Not used + bool mirrorY = leds.projectionData.read(); // Not used + bool mirrorZ = leds.projectionData.read(); // Not used + + uint8_t xSpeed = leds.projectionData.read(); + uint8_t ySpeed = leds.projectionData.read(); + uint8_t zSpeed = leds.projectionData.read(); + + if (xSpeed) pixel.x = (pixel.x + (sys->now * xSpeed / 255 / 100)) % leds.size.x; + if (ySpeed) pixel.y = (pixel.y + (sys->now * ySpeed / 255 / 100)) % leds.size.y; + if (zSpeed) pixel.z = (pixel.z + (sys->now * zSpeed / 255 / 100)) % leds.size.z; + } + + void controls(LedsLayer &leds, JsonObject parentVar) { + MirrorProjection mp; + mp.controls(leds, parentVar); + + uint8_t *xSpeed = leds.projectionData.write(0); + uint8_t *ySpeed = leds.projectionData.write(0); + uint8_t *zSpeed = leds.projectionData.write(0); + + ui->initSlider(parentVar, "X Speed", xSpeed, 0, 255, false); + if (leds.projectionDimension >= _2D) ui->initSlider(parentVar, "Y Speed", ySpeed, 0, 255, false); + if (leds.projectionDimension == _3D) ui->initSlider(parentVar, "Z Speed", zSpeed, 0, 255, false); + } + +}; //ScrollingProjection + class TestProjection: public Projection { const char * name() {return "Test";} const char * tags() {return "💡";}