😌 don't draw trails on first drop
This commit is contained in:
parent
cd601b4bfd
commit
bcebde545d
@ -42,6 +42,7 @@ int line_speed[PANEL_WIDTH]; // how fast each line moves
|
|||||||
unsigned long line_last_moved[PANEL_WIDTH];
|
unsigned long line_last_moved[PANEL_WIDTH];
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
bool reached_bottom = false;
|
||||||
int y;
|
int y;
|
||||||
int length;
|
int length;
|
||||||
int speed;
|
int speed;
|
||||||
@ -59,12 +60,7 @@ void setup(){
|
|||||||
raindrops[i].length = random(20, 28);
|
raindrops[i].length = random(20, 28);
|
||||||
raindrops[i].speed = random(25, 100);
|
raindrops[i].speed = random(25, 100);
|
||||||
raindrops[i].last_moved = millis();
|
raindrops[i].last_moved = millis();
|
||||||
//raindrops[i] = rd;
|
//raindrops[i].reached_bottom = false;
|
||||||
|
|
||||||
//line_pos[i] = 0 - random(24);
|
|
||||||
//line_length[i] = random(20, 28);
|
|
||||||
//line_speed[i] = random(25, 100);
|
|
||||||
//line_last_moved[i] = millis();
|
|
||||||
}
|
}
|
||||||
// redefine pins if required
|
// redefine pins if required
|
||||||
HUB75_I2S_CFG::i2s_pins _pins={R1, G1, BL1, R2, G2, BL2, CH_A, CH_B, CH_C, CH_D, CH_E, LAT, OE, CLK};
|
HUB75_I2S_CFG::i2s_pins _pins={R1, G1, BL1, R2, G2, BL2, CH_A, CH_B, CH_C, CH_D, CH_E, LAT, OE, CLK};
|
||||||
@ -100,6 +96,7 @@ void loop() {
|
|||||||
}
|
}
|
||||||
if (raindrops[x].y > PANEL_HEIGHT) {
|
if (raindrops[x].y > PANEL_HEIGHT) {
|
||||||
raindrops[x].y = 0;
|
raindrops[x].y = 0;
|
||||||
|
raindrops[x].reached_bottom = true;
|
||||||
}
|
}
|
||||||
if (raindrops[x].y >= 0) {
|
if (raindrops[x].y >= 0) {
|
||||||
//draw our pixel
|
//draw our pixel
|
||||||
@ -114,7 +111,7 @@ void loop() {
|
|||||||
} else {
|
} else {
|
||||||
matrix->drawPixel(x, trail_y, matrix->color565(0, (255 / raindrops[x].length) * (raindrops[x].length - trail_offset), 0));
|
matrix->drawPixel(x, trail_y, matrix->color565(0, (255 / raindrops[x].length) * (raindrops[x].length - trail_offset), 0));
|
||||||
}
|
}
|
||||||
} else {
|
} else if (raindrops[x].reached_bottom) {
|
||||||
int pixel_num = ((PANEL_HEIGHT + trail_y) * PANEL_WIDTH) + x;
|
int pixel_num = ((PANEL_HEIGHT + trail_y) * PANEL_WIDTH) + x;
|
||||||
if (line_pos[x] >= 0) {
|
if (line_pos[x] >= 0) {
|
||||||
if (overlay[ pixel_num / 8 ] & (1 << (7 - (pixel_num % 8)) )) {
|
if (overlay[ pixel_num / 8 ] & (1 << (7 - (pixel_num % 8)) )) {
|
||||||
|
Loading…
Reference in New Issue
Block a user