Skip to content

Commit

Permalink
Frizzles 2D with parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
ewowi committed Aug 10, 2023
1 parent 14be5a5 commit 9d38665
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions src/App/AppEffects.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,25 +201,38 @@ class SphereMove3DEffect: public Effect {
}
}; // SphereMove3DEffect

//XY used by blur2d
uint16_t XY( uint8_t x, uint8_t y) {
return x + y * LedsV::widthV;
}

class Frizzles2D: public Effect {
public:
const char * name() {
return "Frizzles 2D";
}
void setup() {}

void setup() {
// fadeToBlackBy( ledsP, LedsV::nrOfLedsP, 100); //like more the gradual change
}

void loop() {
fadeToBlackBy( ledsP, LedsV::nrOfLedsP, 16);
CRGBPalette16 palette = PartyColors_p;

for (size_t i = 8; i > 0; i--) {
uint8_t x = beatsin8(128/8 + i, 0, LedsV::widthV - 1);
uint8_t y = beatsin8(128/8 - i, 0, LedsV::heightV - 1);
uint8_t x = beatsin8(mdl->getValue("speed").as<int>()/8 + i, 0, LedsV::widthV - 1);
uint8_t y = beatsin8(mdl->getValue("intensity").as<int>()/8 - i, 0, LedsV::heightV - 1);
CRGB color = ColorFromPalette(palette, beatsin8(12, 0, 255), 255);
ledsV[x + y * LedsV::widthV] = color;
}
// blur2d(ledsP, LedsV::width, LedsV::height, 255);
// SEGMENT.blur(SEGMENT.custom1>>3);

blur2d(ledsP, LedsV::widthV, LedsV::heightV, mdl->getValue("blur")); //this is tricky as FastLed is not aware of our virtual
}
bool parameters(JsonObject parentVar) {
ui->initSlider(parentVar, "speed", 128, false);
ui->initSlider(parentVar, "intensity", 128, false);
ui->initSlider(parentVar, "blur", 128, false);
return true;
}
}; // Frizzles2D

Expand All @@ -228,7 +241,9 @@ class Lines2D: public Effect {
const char * name() {
return "Lines 2D";
}

void setup() {}

void loop() {
fadeToBlackBy( ledsP, LedsV::nrOfLedsP, 100);
CRGBPalette16 palette = PartyColors_p;
Expand All @@ -245,9 +260,9 @@ class Lines2D: public Effect {
}
}
}

bool parameters(JsonObject parentVar) {
ui->initCheckBox(parentVar, "Vertical", false, false);

return true;
}
}; // Lines2D
Expand Down

0 comments on commit 9d38665

Please sign in to comment.