make everything one function

This commit is contained in:
Asif Bacchus 2020-04-08 05:00:04 -06:00
parent 89263b1495
commit c0e4424257

View File

@ -1,3 +1,4 @@
function particles() {
/* create particles animation
based on the amazing tutorial by 'Franks Labratory'
https://youtu.be/d620nV6bp0A
@ -55,7 +56,7 @@ class Particle{
if (this.y > canvas.height || this.y < 0){
this.directionY = -this.directionY;
}
/*
// collision detection between mouse and particles
let dx = mousePosition.x - this.x;
let dy = mousePosition.y - this.y;
@ -74,7 +75,7 @@ class Particle{
this.y -= 10;
}
}
*/
// move particle
this.x += this.directionX;
this.y += this.directionY;
@ -157,3 +158,4 @@ window.addEventListener('mouseout', function(){
init();
animate();
}