Skip to content

Commit

Permalink
Update lifetime and position
Browse files Browse the repository at this point in the history
  • Loading branch information
fmcclean committed Sep 22, 2023
1 parent 3547c2b commit ba3436e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions glittering-sea/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,15 @@
x: Math.random(),
y: -1
};
this.l = rand(0, 20);
// Lifetime of the particle
this.l = rand(0, 500);
this.sl = this.l;
};

Shape.prototype.updateParams = function() {
this.l -= 1;
if (this.l < 0) {
this.init(X * (Math.random() + Math.random()) / 2, rand(0, Y));
this.init(rand(0, X), Y * (Math.random() + Math.random()) / 2);
}
};

Expand Down Expand Up @@ -130,10 +131,6 @@
onResize();
});

window.addEventListener('mousemove', function(e) {
mouseX = e.clientX;
mouseY = e.clientY;
}, false);

});
})();

0 comments on commit ba3436e

Please sign in to comment.