From 3a124e68096a3911ca4d37700f3972fc0aaad2a4 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Fri, 10 Apr 2020 04:54:26 -0600 Subject: [PATCH] add line-width parameter --- js/particles.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/js/particles.js b/js/particles.js index f94095a..806598c 100644 --- a/js/particles.js +++ b/js/particles.js @@ -138,7 +138,7 @@ function particles(){ canvasContext.globalAlpha = opacityValue; canvasContext.strokeStyle = strokeColour; } - canvasContext.lineWidth = 1; + canvasContext.lineWidth = width; canvasContext.beginPath(); canvasContext.moveTo(particlesArray[a].x, particlesArray[a].y); canvasContext.lineTo(particlesArray[b].x, particlesArray[b].y); @@ -201,6 +201,17 @@ function particles(){ console.log("'sizeMultiplier' must be a finite number. Using default of '5'."); }; + if (typeof width == 'undefined'){ + width = 1; + } + else if (Number.isInteger(width) && width > 0){ + width; + } + else{ + width = 1; + console.log("'width' must be an integer number of pixels greater than 0. Using default of '1'."); + }; + if (typeof connections == 'undefined'){ connections = true; }