remove down-right bias when bouncing normally
This commit is contained in:
parent
81e41b9fd3
commit
5d44e2d93b
@ -131,10 +131,21 @@ function particles(){
|
|||||||
let size = (Math.random() * sizeMultiplier) + 1;
|
let size = (Math.random() * sizeMultiplier) + 1;
|
||||||
// set X
|
// set X
|
||||||
let x = (Math.random() * ((innerWidth - size * 2) - (size * 2)) + size * 2);
|
let x = (Math.random() * ((innerWidth - size * 2) - (size * 2)) + size * 2);
|
||||||
|
if (noBounceH){
|
||||||
directionX = Math.random() * 5;
|
directionX = Math.random() * 5;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
directionX = (Math.random() * 5) - 2.5;
|
||||||
|
}
|
||||||
// set Y
|
// set Y
|
||||||
let y = (Math.random() * ((innerHeight - size * 2) - (size * 2)) + size * 2);
|
let y = (Math.random() * ((innerHeight - size * 2) - (size * 2)) + size * 2);
|
||||||
|
if (noBounceV){
|
||||||
directionY = Math.random() * 5;
|
directionY = Math.random() * 5;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
directionY = (Math.random() * 5) -2.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
particlesArray.push(new Particle(x, y, directionX, directionY, size));
|
particlesArray.push(new Particle(x, y, directionX, directionY, size));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user