From 7199428c6f3fd92eb35f2245a5c650bb5a1d4313 Mon Sep 17 00:00:00 2001 From: danielhuang Date: Tue, 9 Jul 2019 17:41:30 -0400 Subject: [PATCH] Update index.js --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 845b2d9..95c0be8 100644 --- a/index.js +++ b/index.js @@ -137,12 +137,13 @@ exports.decorateTerm = (Term, { React, notify }) => { // Draw the next frame in the particle simulation. _drawFrame () { - this._particles.length && this._canvasContext.clearRect(0, 0, this._canvas.width, this._canvas.height); + this._canvasContext.clearRect(0, 0, this._canvas.width, this._canvas.height); this._particles.forEach((particle) => { particle.velocity.y += PARTICLE_GRAVITY; particle.x += particle.velocity.x; particle.y += particle.velocity.y; particle.alpha *= PARTICLE_ALPHA_FADEOUT; + if (particle.alpha < 0.1) particle.alpha = 0; this._canvasContext.fillStyle = `rgba(${particle.color.join(',')}, ${particle.alpha})`; this._canvasContext.fillRect(Math.round(particle.x - 1), Math.round(particle.y - 1), 3, 3); });