From 00ddc1e91848f534156de954b34699bfc1c7cf47 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Wed, 8 Apr 2020 08:20:32 -0600 Subject: [PATCH] minify js and use --- .vscode/numbered-bookmarks.json | 3 +++ index.html | 2 +- js/particles.min.js | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .vscode/numbered-bookmarks.json create mode 100644 js/particles.min.js diff --git a/.vscode/numbered-bookmarks.json b/.vscode/numbered-bookmarks.json new file mode 100644 index 0000000..4c08963 --- /dev/null +++ b/.vscode/numbered-bookmarks.json @@ -0,0 +1,3 @@ +{ + "bookmarks": [] +} \ No newline at end of file diff --git a/index.html b/index.html index 59f05fc..afd6c88 100644 --- a/index.html +++ b/index.html @@ -12,7 +12,7 @@ diff --git a/js/particles.min.js b/js/particles.min.js new file mode 100644 index 0000000..2a104b3 --- /dev/null +++ b/js/particles.min.js @@ -0,0 +1 @@ +function particles(){let e,t,i;!function(){"undefined"==typeof numParticles?numParticles=1:Number.isFinite(numParticles)?numParticles:(numParticles=1,console.log("'numParticles' must be a finite number. Using default of '1'."));"undefined"==typeof sizeMultiplier?sizeMultiplier=3:Number.isFinite(sizeMultiplier)?sizeMultiplier:(sizeMultiplier=3,console.log("'sizeMultiplier' must be a finite number. Using default of '3'."));"undefined"==typeof connections?connections=!0:"boolean"==typeof connections?connections:(connections=!0,console.log("'connections' must be either 'true' or 'false'. Using default of 'true'."));"undefined"==typeof connectionDensity?connectionDensity=1/15*100:Number.isFinite(connectionDensity)&&connectionDensity>1?connectionDensity=1/connectionDensity*100:(connectionDensity=1/15*100,console.log("'connectionDensity' must be a finite number greater than 1. Using default of '15'."));"undefined"==typeof speed&&(speed=50);Number.isInteger(speed)&&0<=speed&&speed<=1e3?speed:(speed=50,console.log("'speed' must be an integer between 1-1000. Using default of '50'."));"undefined"==typeof avoidMouse?avoidMouse=!0:"boolean"==typeof avoidMouse?avoidMouse:(avoidMouse=!0,console.log("'avoidMouse' must be either 'true' or 'false'. Using default of 'true'."));"undefined"==typeof hover?hover=!0:"boolean"==typeof hover?hover:(hover=!0,console.log("'hover' must be either 'true' or 'false'. Using default of 'true'."))}(),function(){0===getComputedStyle(document.documentElement).getPropertyValue("--col-particle").length?(e="#000000",console.log("CSS variable '--col-particle' is not set. Using 'black' (#000000).")):e=getComputedStyle(document.documentElement).getPropertyValue("--col-particle");0===getComputedStyle(document.documentElement).getPropertyValue("--col-particle-stroke").length?(t="#000000",console.log("CSS variable '--col-particle-stroke' is not set. Using 'black' (#000000).")):t=getComputedStyle(document.documentElement).getPropertyValue("--col-particle-stroke");!0===hover&&0===getComputedStyle(document.documentElement).getPropertyValue("--col-particle-stroke-hover").length?(i="#ff0000",console.log("CSS variable '--col-particle-stroke-hover' is not set. Using 'red' (#ff0000).")):i=getComputedStyle(document.documentElement).getPropertyValue("--col-particle-stroke-hover")}();const n=document.getElementById("particles"),o=n.getContext("2d");let s;n.width=window.innerWidth,n.height=window.innerHeight,speed=0!==speed?speed/100:0;let l={x:void 0,y:void 0,radius:n.height/80*(n.width/80)};window.addEventListener("mousemove",function(e){l.x=e.x,l.y=e.y});class r{constructor(e,t,i,n,o,s){this.x=e,this.y=t,this.directionX=i,this.directionY=n,this.size=o,this.colour=s}draw(){o.beginPath(),o.arc(this.x,this.y,this.size,0,2*Math.PI,!1),o.fillStyle=e,o.fill()}update(){if((this.x>n.width||this.x<0)&&(this.directionX=-this.directionX),(this.y>n.height||this.y<0)&&(this.directionY=-this.directionY),avoidMouse){let e=l.x-this.x,t=l.y-this.y;Math.sqrt(e*e+t*t)this.x&&this.x>10*this.size&&(this.x-=10),l.ythis.y&&this.y>10*this.size&&(this.y-=10))}0!==speed&&(this.x+=this.directionX*speed,this.y+=this.directionY*speed),this.draw()}}function c(){s=[];let e=n.height*n.width/9e3;for(let t=0;t