Skip to content

Commit 8dfbc0a

Browse files
committed
Tweaks to drip and rain
1 parent f123b8c commit 8dfbc0a

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/MoonLight/Nodes/Effects/E_WLED.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,13 +1010,11 @@ class TetrixEffect : public Node {
10101010
void loop() override {
10111011
if (!drops) return;
10121012

1013-
uint16_t strips = layer->size.x; // allow running on virtual strips (columns in 2D segment)
1014-
10151013
// if (SEGENV.call == 0) layer->fill(SEGCOLOR(1)); // will fill entire segment (1D or 2D), then use drops[x].step = 0 below
10161014

10171015
const uint8_t FRAMETIME = 1000 / 40;
10181016

1019-
for (int x = 0; x < layer->size.x; x++) {
1017+
for (int x = 0; x < nrOfDrops; x++) {
10201018
if (drops[x].step == 0) { // init brick
10211019
// speed calculation: a single brick should reach bottom of strip in X seconds
10221020
// if the speed is set to 1 this should take 5s and at 255 it should take 0.25s
@@ -1773,9 +1771,9 @@ class RainEffect : public Node {
17731771
// } else
17741772
{
17751773
// shift all leds down
1776-
CRGB ctemp = layer->getRGB(Coord3D(0, 0));
1774+
CRGB ctemp = layer->getRGB(Coord3D(x, 0));
17771775
for (int i = 0; i < layer->size.y - 1; i++) {
1778-
layer->setRGB(Coord3D(x, layer->size.y - 1 - i), layer->getRGB(Coord3D(0, layer->size.y - 1 - (i + 1))));
1776+
layer->setRGB(Coord3D(x, layer->size.y - 1 - i), layer->getRGB(Coord3D(x, layer->size.y - 1 - (i + 1))));
17791777
}
17801778
layer->setRGB(Coord3D(x, 0), ctemp); // wrap around
17811779
drops[x].pos++; // increase spark index
@@ -1874,9 +1872,9 @@ class DripEffect : public Node {
18741872

18751873
layer->setRGB(Coord3D(x, layer->size.y - 1 - drops[x][j].pos), dropColor); // needed for bouncing
18761874

1877-
for (int i = 1; i < 7 - drops[x][j].colIndex; i++) { // some minor math so we don't expand bouncing droplets
1878-
uint16_t pos = constrain(drops[x][j].pos + i, layer->size.y - 1, 0); // this is BAD, returns a pos >= layer->size.x occasionally
1879-
layer->setRGB(Coord3D(x, pos), blend(CRGB::Black, dropColor, drops[x][j].col / i)); // spread pixel with fade while falling
1875+
for (int i = 1; i < 7 - drops[x][j].colIndex; i++) { // some minor math so we don't expand bouncing droplets
1876+
uint16_t pos = constrain(drops[x][j].pos + i, 0, layer->size.y - 1); // this is BAD, returns a pos >= layer->size.y occasionally
1877+
layer->setRGB(Coord3D(x, layer->size.y - 1 - pos), blend(CRGB::Black, dropColor, drops[x][j].col / i)); // spread pixel with fade while falling
18801878
}
18811879

18821880
if (drops[x][j].colIndex > falling) { // during bounce, some water is on the floor

0 commit comments

Comments
 (0)