change particle number calculation

Based on 1% of window width.
numParticles is a straight multiplier, so increment percentage. Simple.
This commit is contained in:
Asif Bacchus 2020-04-10 08:51:16 -06:00
parent d22516867b
commit bbf7e3d2f2

View File

@ -101,7 +101,8 @@ function particles(){
// create particle array
function init(){
particlesArray = [];
let numberOfParticles = (canvas.height * canvas.width) / 9000;
//let numberOfParticles = (canvas.height * canvas.width) / 9000;
let numberOfParticles = canvas.width * 0.01;
for (let i = 0; i < numberOfParticles * numParticles; i++){
let size = (Math.random() * sizeMultiplier) + 1;
let x = (Math.random() * ((innerWidth - size * 2) - (size * 2)) + size * 2);
@ -195,14 +196,14 @@ function particles(){
};
if (typeof numParticles == 'undefined'){
numParticles = 1;
numParticles = 10;
}
else if (Number.isFinite(numParticles)){
numParticles;
}
else{
numParticles = 1;
console.log("'numParticles' must be a finite number. Using default of '1'.");
numParticles = 10;
console.log("'numParticles' must be a finite number. Using default of '5'.");
};
if (typeof sizeMultiplier == 'undefined'){