@@ -1241,13 +1241,13 @@ class FireworksEffect : public Node {
12411241 static uint8_t dim () { return _2D; }
12421242 static const char * tags () { return " 🐙" ; }
12431243
1244- uint8_t gravityC = 128 ;
1244+ uint8_t gravityControl = 128 ;
12451245 uint8_t firingSide = 128 ;
12461246 uint8_t numSparks = 128 ;
12471247
12481248 void setup () override {
12491249 layer->fadeToBlackBy (16 );
1250- addControl (gravityC , " gravity" , " slider" );
1250+ addControl (gravityControl , " gravity" , " slider" );
12511251 addControl (firingSide, " firingSide" , " slider" );
12521252 addControl (numSparks, " numSparks" , " slider" );
12531253 // PROGMEM = "Fireworks 1D@Gravity,Firing side;!,!;!;12;pal=11,ix=128";
@@ -1272,7 +1272,7 @@ class FireworksEffect : public Node {
12721272
12731273 layer->fadeToBlackBy (252 ); // fade_out(252);
12741274
1275- float gravity = -0 .0004f - (gravityC / 800000 .0f ); // m/s/s
1275+ float gravity = -0 .0004f - (gravityControl / 800000 .0f ); // m/s/s
12761276 gravity *= rows;
12771277
12781278 if (aux0Flare < 2 ) { // FLARE
@@ -1583,7 +1583,7 @@ class DripEffect : public Node {
15831583 uint8_t gravityControl = 128 ;
15841584 uint8_t drips = 4 ;
15851585 uint8_t swell = 4 ;
1586- uint8_t bounce = 128 ;
1586+ uint8_t bounce = 64 ;
15871587
15881588 void setup () override {
15891589 addControl (gravityControl, " gravity" , " slider" , 1 , 255 );
@@ -1616,12 +1616,11 @@ class DripEffect : public Node {
16161616 enum DropState { init = 0 , forming = 1 , falling = 2 , bouncing = 5 };
16171617
16181618 void loop () override {
1619- // layer->fadeToBlackBy(90);
1620- layer->fill_solid (CRGB::Black);
1619+ layer->fadeToBlackBy (90 );
1620+
1621+ float gravity = -(gravityControl / 800000 .0f );
16211622
1622- float gravity = -0 .0005f - (gravityControl / 50000 .0f ); // increased gravity (50000 to 25000)
16231623 gravity *= max (1 , layer->size .x - 1 );
1624- gravity /= 100 ; // don't know why it is falling so fast so slowed it down...
16251624 int sourcedrop = 12 ;
16261625
16271626 for (int y = 0 ; y < dropsSize; y++) {
@@ -1655,8 +1654,10 @@ class DripEffect : public Node {
16551654 if (drops[y][j].pos < 0 ) drops[y][j].pos = 0 ;
16561655 drops[y][j].vel += gravity; // gravity is negative
16571656
1657+ layer->setRGB (Coord3D (drops[y][j].pos , y), dropColor); // needed for bouncing
1658+
16581659 for (int i = 1 ; i < 7 - drops[y][j].colIndex ; i++) { // some minor math so we don't expand bouncing droplets
1659- uint16_t pos = constrain (uint16_t ( drops[y][j].pos ) + i, 0 , layer->size .x - 1 ); // this is BAD, returns a pos >= layer->size.x occasionally
1660+ uint16_t pos = constrain (drops[y][j].pos + i, 0 , layer->size .x - 1 ); // this is BAD, returns a pos >= layer->size.x occasionally
16601661 layer->setRGB (Coord3D (pos, y), blend (CRGB::Black, dropColor, drops[y][j].col / i)); // spread pixel with fade while falling
16611662 }
16621663
@@ -1665,15 +1666,11 @@ class DripEffect : public Node {
16651666 }
16661667 } else { // we hit bottom, pos <= 0
16671668 if (drops[y][j].colIndex > falling) { // bouncing, already hit once, so back to forming
1668- if (drops[y][j].pos <= 0 ) {
1669- drops[y][j].colIndex = init;
1670- }
1669+ drops[y][j].colIndex = init;
16711670 } else {
1672- if (drops[y][j].colIndex == falling) { // init bounce
1673- drops[y][j].vel = -drops[y][j].vel ;// / 4.0; // reverse velocity with damping
1674- // drops[y][j].vel = -drops[y][j].vel / (bounce / 64.0); // reverse velocity with damping
1671+ if (drops[y][j].colIndex == falling) { // init bounce
1672+ drops[y][j].vel = -drops[y][j].vel * bounce / 255 ; // reverse velocity with damping
16751673 drops[y][j].pos += drops[y][j].vel ;
1676- if (drops[y][j].pos <= 1 ) drops[y][j].pos = 1 ;
16771674 }
16781675 drops[y][j].col = sourcedrop * 2 ;
16791676 drops[y][j].colIndex = bouncing;
0 commit comments