add opacity parameter
This commit is contained in:
parent
aec19308ab
commit
46770f4da3
@ -21,6 +21,10 @@ function particles(){
|
|||||||
|
|
||||||
let particlesArray;
|
let particlesArray;
|
||||||
speed = (speed !== 0) ? (speed / 100) : 0; // index speed to base 100 = 1
|
speed = (speed !== 0) ? (speed / 100) : 0; // index speed to base 100 = 1
|
||||||
|
opacity = opacity / 100;
|
||||||
|
|
||||||
|
// set overall canvas opacity
|
||||||
|
canvas.style.opacity = opacity;
|
||||||
|
|
||||||
// get mouse position
|
// get mouse position
|
||||||
let mousePosition ={
|
let mousePosition ={
|
||||||
@ -179,6 +183,17 @@ function particles(){
|
|||||||
animate();
|
animate();
|
||||||
|
|
||||||
function checkParams(){
|
function checkParams(){
|
||||||
|
if (typeof opacity == 'undefined'){
|
||||||
|
opacity = 100;
|
||||||
|
}
|
||||||
|
else if (Number.isFinite(opacity) && (0 <= opacity && opacity <= 100)){
|
||||||
|
opacity;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
opacity = 100;
|
||||||
|
console.log("'opacity' must be a finite number between 0 and 100. Using default of '100'.");
|
||||||
|
};
|
||||||
|
|
||||||
if (typeof numParticles == 'undefined'){
|
if (typeof numParticles == 'undefined'){
|
||||||
numParticles = 1;
|
numParticles = 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user