mirror of
https://github.com/xvvvyz/tilde.git
synced 2026-03-11 14:44:24 +00:00
fully fade out previous rain drop streak
This commit is contained in:
parent
da70da90b7
commit
7acc06baeb
1 changed files with 10 additions and 0 deletions
10
index.html
10
index.html
|
|
@ -812,6 +812,16 @@
|
|||
const x = i * this.#rainWidth;
|
||||
const y = this.#drops[i] * this.#rainHeight;
|
||||
this.#ctx.fillRect(x, y, this.#rainWidth, this.#rainHeight);
|
||||
|
||||
if (this.#drops[i] <= 4) {
|
||||
// fully fade out previous rain drop streak
|
||||
this.#ctx.fillStyle = this.#backgroundColor;
|
||||
this.#ctx.globalAlpha = this.#drops[i] === 4 ? 1 : 0.4;
|
||||
const eraseY = y + this.#rainHeight;
|
||||
const eraseHeight = this.#canvas.height - eraseY;
|
||||
this.#ctx.fillRect(x, eraseY, this.#rainWidth, eraseHeight);
|
||||
}
|
||||
|
||||
const reset = Math.random() > CONFIG.rainResilience;
|
||||
if (reset || y > this.#canvas.height) this.#drops[i] = 0;
|
||||
else this.#drops[i]++;
|
||||
|
|
|
|||
Loading…
Reference in a new issue