particles.min.js
22.2 KB
N2Require("particlesJS",[],[],function(e,a,t){function i(e){var a=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;e=e.replace(a,function(e,a,t,i){return a+a+t+t+i+i});var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}function n(e,a,t){return Math.min(Math.max(e,a),t)}function s(e,a){return a.indexOf(e)>-1}function r(e,a){var t=document.createElement("canvas");t.className="n-particles-js-canvas-el";var i=e.append(t);return i.length?new c(t,a):!1}var c=function(e,a){this.pJS={canvas:{el:e,w:e.offsetWidth,h:e.offsetHeight},particles:{number:{value:400,density:{enable:!0,value_area:800}},color:{value:"#fff"},shape:{type:"circle",stroke:{width:0,color:"#ff0000"},polygon:{nb_sides:5},image:{src:"",width:100,height:100}},opacity:{value:1,random:!1,anim:{enable:!1,speed:2,opacity_min:0,sync:!1}},size:{value:20,random:!1,anim:{enable:!1,speed:20,size_min:0,sync:!1}},line_linked:{enable:!0,distance:100,color:"#fff",opacity:1,width:1},move:{enable:!0,speed:2,direction:"none",random:!1,straight:!1,out_mode:"out",bounce:!1,attract:{enable:!1,rotateX:3e3,rotateY:3e3}},array:[]},interactivity:{detect_on:"canvas",events:{onhover:{enable:!0,mode:"grab"},onclick:{enable:!0,mode:"push"},resize:!0},modes:{grab:{distance:100,line_linked:{opacity:1}},bubble:{distance:200,size:80,duration:.4},repulse:{distance:200,duration:.4},push:{particles_nb:4},remove:{particles_nb:2}},mouse:{}},retina_detect:!1,fn:{interact:{},modes:{},vendors:{}},tmp:{}};var r=this.pJS;a&&Object.deepExtend(r,a),r.tmp.obj={size_value:r.particles.size.value,size_anim_speed:r.particles.size.anim.speed,move_speed:r.particles.move.speed,line_linked_distance:r.particles.line_linked.distance,line_linked_width:r.particles.line_linked.width,mode_grab_distance:r.interactivity.modes.grab.distance,mode_bubble_distance:r.interactivity.modes.bubble.distance,mode_bubble_size:r.interactivity.modes.bubble.size,mode_repulse_distance:r.interactivity.modes.repulse.distance},r.fn.retinaInit=function(){r.retina_detect&&window.devicePixelRatio>1?(r.canvas.pxratio=window.devicePixelRatio,r.tmp.retina=!0):(r.canvas.pxratio=1,r.tmp.retina=!1),r.canvas.w=r.canvas.el.offsetWidth*r.canvas.pxratio,r.canvas.h=r.canvas.el.offsetHeight*r.canvas.pxratio,r.particles.size.value=r.tmp.obj.size_value*r.canvas.pxratio,r.particles.size.anim.speed=r.tmp.obj.size_anim_speed*r.canvas.pxratio,r.particles.move.speed=r.tmp.obj.move_speed*r.canvas.pxratio,r.particles.line_linked.distance=r.tmp.obj.line_linked_distance*r.canvas.pxratio,r.interactivity.modes.grab.distance=r.tmp.obj.mode_grab_distance*r.canvas.pxratio,r.interactivity.modes.bubble.distance=r.tmp.obj.mode_bubble_distance*r.canvas.pxratio,r.particles.line_linked.width=r.tmp.obj.line_linked_width*r.canvas.pxratio,r.interactivity.modes.bubble.size=r.tmp.obj.mode_bubble_size*r.canvas.pxratio,r.interactivity.modes.repulse.distance=r.tmp.obj.mode_repulse_distance*r.canvas.pxratio},r.fn.canvasInit=function(){r.canvas.ctx=r.canvas.el.getContext("2d")},r.fn.canvasSize=function(){r.canvas.el.width=r.canvas.w,r.canvas.el.height=r.canvas.h,r&&r.interactivity.events.resize&&window.addEventListener("resize",function(){r.canvas.w=r.canvas.el.offsetWidth,r.canvas.h=r.canvas.el.offsetHeight,r.tmp.retina&&(r.canvas.w*=r.canvas.pxratio,r.canvas.h*=r.canvas.pxratio),r.canvas.el.width=r.canvas.w,r.canvas.el.height=r.canvas.h,r.particles.move.enable||(r.fn.particlesEmpty(),r.fn.particlesCreate(),r.fn.particlesDraw(),r.fn.vendors.densityAutoParticles()),r.fn.vendors.densityAutoParticles()})},r.fn.resize=function(){r.canvas.w=r.canvas.el.offsetWidth,r.canvas.h=r.canvas.el.offsetHeight,r.tmp.retina&&(r.canvas.w*=r.canvas.pxratio,r.canvas.h*=r.canvas.pxratio),r.canvas.el.width=r.canvas.w,r.canvas.el.height=r.canvas.h,r.particles.move.enable||(r.fn.particlesEmpty(),r.fn.particlesCreate(),r.fn.particlesDraw(),r.fn.vendors.densityAutoParticles()),r.fn.vendors.densityAutoParticles()},r.fn.canvasPaint=function(){r.canvas.ctx.fillRect(0,0,r.canvas.w,r.canvas.h)},r.fn.canvasClear=function(){r.canvas.ctx.clearRect(0,0,r.canvas.w,r.canvas.h)},r.fn.particle=function(e,a,n){if(this.radius=(r.particles.size.random?Math.random():1)*r.particles.size.value,r.particles.size.anim.enable&&(this.size_status=!1,this.vs=r.particles.size.anim.speed/100,r.particles.size.anim.sync||(this.vs=this.vs*Math.random())),this.x=n?n.x:Math.random()*r.canvas.w,this.y=n?n.y:Math.random()*r.canvas.h,this.x>r.canvas.w-2*this.radius?this.x=this.x-this.radius:this.x<2*this.radius&&(this.x=this.x+this.radius),this.y>r.canvas.h-2*this.radius?this.y=this.y-this.radius:this.y<2*this.radius&&(this.y=this.y+this.radius),r.particles.move.bounce&&r.fn.vendors.checkOverlap(this,n),this.color={},"object"==typeof e.value)if(e.value instanceof Array){var s=e.value[Math.floor(Math.random()*r.particles.color.value.length)];this.color.rgb=i(s)}else e.value.r!=t&&e.value.g!=t&&e.value.b!=t&&(this.color.rgb={r:e.value.r,g:e.value.g,b:e.value.b}),e.value.h!=t&&e.value.s!=t&&e.value.l!=t&&(this.color.hsl={h:e.value.h,s:e.value.s,l:e.value.l});else"random"==e.value?this.color.rgb={r:Math.floor(256*Math.random())+0,g:Math.floor(256*Math.random())+0,b:Math.floor(256*Math.random())+0}:"string"==typeof e.value&&(this.color=e,this.color.rgb=i(this.color.value));this.opacity=(r.particles.opacity.random?Math.random():1)*r.particles.opacity.value,r.particles.opacity.anim.enable&&(this.opacity_status=!1,this.vo=r.particles.opacity.anim.speed/100,r.particles.opacity.anim.sync||(this.vo=this.vo*Math.random()));var c={};switch(r.particles.move.direction){case"top":c={x:0,y:-1};break;case"top-right":c={x:.5,y:-.5};break;case"right":c={x:1,y:-0};break;case"bottom-right":c={x:.5,y:.5};break;case"bottom":c={x:0,y:1};break;case"bottom-left":c={x:-.5,y:1};break;case"left":c={x:-1,y:0};break;case"top-left":c={x:-.5,y:-.5};break;default:c={x:0,y:0}}r.particles.move.straight?(this.vx=c.x,this.vy=c.y,r.particles.move.random&&(this.vx=this.vx*Math.random(),this.vy=this.vy*Math.random())):(this.vx=c.x+Math.random()-.5,this.vy=c.y+Math.random()-.5),this.vx_i=this.vx,this.vy_i=this.vy;var o=r.particles.shape.type;if("object"==typeof o){if(o instanceof Array){var l=o[Math.floor(Math.random()*o.length)];this.shape=l}}else this.shape=o;if("image"==this.shape){var v=r.particles.shape;this.img={src:v.image.src,ratio:v.image.width/v.image.height},this.img.ratio||(this.img.ratio=1),"svg"==r.tmp.img_type&&r.tmp.source_svg!=t&&(r.fn.vendors.createSvgImg(this),r.tmp.pushing&&(this.img.loaded=!1))}},r.fn.particle.prototype.draw=function(){function e(){r.canvas.ctx.drawImage(c,a.x-i,a.y-i,2*i,2*i/a.img.ratio)}var a=this;if(a.radius_bubble!=t)var i=a.radius_bubble;else var i=a.radius;if(a.opacity_bubble!=t)var n=a.opacity_bubble;else var n=a.opacity;if(a.color.rgb)var s="rgba("+a.color.rgb.r+","+a.color.rgb.g+","+a.color.rgb.b+","+n+")";else var s="hsla("+a.color.hsl.h+","+a.color.hsl.s+"%,"+a.color.hsl.l+"%,"+n+")";switch(r.canvas.ctx.fillStyle=s,r.canvas.ctx.beginPath(),a.shape){case"circle":r.canvas.ctx.arc(a.x,a.y,i,0,2*Math.PI,!1);break;case"edge":r.canvas.ctx.rect(a.x-i,a.y-i,2*i,2*i);break;case"triangle":r.fn.vendors.drawShape(r.canvas.ctx,a.x-i,a.y+i/1.66,2*i,3,2);break;case"polygon":r.fn.vendors.drawShape(r.canvas.ctx,a.x-i/(r.particles.shape.polygon.nb_sides/3.5),a.y-i/.76,2.66*i/(r.particles.shape.polygon.nb_sides/3),r.particles.shape.polygon.nb_sides,1);break;case"star":r.fn.vendors.drawShape(r.canvas.ctx,a.x-2*i/(r.particles.shape.polygon.nb_sides/4),a.y-i/1.52,2*i*2.66/(r.particles.shape.polygon.nb_sides/3),r.particles.shape.polygon.nb_sides,2);break;case"image":if("svg"==r.tmp.img_type)var c=a.img.obj;else var c=r.tmp.img_obj;c&&e()}r.canvas.ctx.closePath(),r.particles.shape.stroke.width>0&&(r.canvas.ctx.strokeStyle=r.particles.shape.stroke.color,r.canvas.ctx.lineWidth=r.particles.shape.stroke.width,r.canvas.ctx.stroke()),r.canvas.ctx.fill()},r.fn.particlesCreate=function(){for(var e=0;e<r.particles.number.value;e++)r.particles.array.push(new r.fn.particle(r.particles.color,r.particles.opacity.value))},r.fn.particlesUpdate=function(){for(var e=0;e<r.particles.array.length;e++){var a=r.particles.array[e];if(r.particles.move.enable){var t=r.particles.move.speed/2;a.x+=a.vx*t,a.y+=a.vy*t}if(r.particles.opacity.anim.enable&&(1==a.opacity_status?(a.opacity>=r.particles.opacity.value&&(a.opacity_status=!1),a.opacity+=a.vo):(a.opacity<=r.particles.opacity.anim.opacity_min&&(a.opacity_status=!0),a.opacity-=a.vo),a.opacity<0&&(a.opacity=0)),r.particles.size.anim.enable&&(1==a.size_status?(a.radius>=r.particles.size.value&&(a.size_status=!1),a.radius+=a.vs):(a.radius<=r.particles.size.anim.size_min&&(a.size_status=!0),a.radius-=a.vs),a.radius<0&&(a.radius=0)),"bounce"==r.particles.move.out_mode)var i={x_left:a.radius,x_right:r.canvas.w,y_top:a.radius,y_bottom:r.canvas.h};else var i={x_left:-a.radius,x_right:r.canvas.w+a.radius,y_top:-a.radius,y_bottom:r.canvas.h+a.radius};switch(a.x-a.radius>r.canvas.w?(a.x=i.x_left,a.y=Math.random()*r.canvas.h):a.x+a.radius<0&&(a.x=i.x_right,a.y=Math.random()*r.canvas.h),a.y-a.radius>r.canvas.h?(a.y=i.y_top,a.x=Math.random()*r.canvas.w):a.y+a.radius<0&&(a.y=i.y_bottom,a.x=Math.random()*r.canvas.w),r.particles.move.out_mode){case"bounce":a.x+a.radius>r.canvas.w?a.vx=-a.vx:a.x-a.radius<0&&(a.vx=-a.vx),a.y+a.radius>r.canvas.h?a.vy=-a.vy:a.y-a.radius<0&&(a.vy=-a.vy)}if(s("grab",r.interactivity.events.onhover.mode)&&r.fn.modes.grabParticle(a),(s("bubble",r.interactivity.events.onhover.mode)||s("bubble",r.interactivity.events.onclick.mode))&&r.fn.modes.bubbleParticle(a),(s("repulse",r.interactivity.events.onhover.mode)||s("repulse",r.interactivity.events.onclick.mode))&&r.fn.modes.repulseParticle(a),r.particles.line_linked.enable||r.particles.move.attract.enable)for(var n=e+1;n<r.particles.array.length;n++){var c=r.particles.array[n];r.particles.line_linked.enable&&r.fn.interact.linkParticles(a,c),r.particles.move.attract.enable&&r.fn.interact.attractParticles(a,c),r.particles.move.bounce&&r.fn.interact.bounceParticles(a,c)}}},r.fn.particlesDraw=function(){r.canvas.ctx.clearRect(0,0,r.canvas.w,r.canvas.h),r.fn.particlesUpdate();for(var e=0;e<r.particles.array.length;e++){var a=r.particles.array[e];a.draw()}},r.fn.particlesEmpty=function(){r.particles.array=[]},r.fn.particlesRefresh=function(){cancelRequestAnimFrame(r.fn.checkAnimFrame),cancelRequestAnimFrame(r.fn.drawAnimFrame),r.tmp.source_svg=t,r.tmp.img_obj=t,r.tmp.count_svg=0,r.fn.particlesEmpty(),r.fn.canvasClear(),r.fn.vendors.start()},r.fn.interact.linkParticles=function(e,a){var t=e.x-a.x,i=e.y-a.y,n=Math.sqrt(t*t+i*i);if(n<=r.particles.line_linked.distance){var s=r.particles.line_linked.opacity-n/(1/r.particles.line_linked.opacity)/r.particles.line_linked.distance;if(s>0){var c=r.particles.line_linked.color_rgb_line;r.canvas.ctx.strokeStyle="rgba("+c.r+","+c.g+","+c.b+","+s+")",r.canvas.ctx.lineWidth=r.particles.line_linked.width,r.canvas.ctx.beginPath(),r.canvas.ctx.moveTo(e.x,e.y),r.canvas.ctx.lineTo(a.x,a.y),r.canvas.ctx.stroke(),r.canvas.ctx.closePath()}}},r.fn.interact.attractParticles=function(e,a){var t=e.x-a.x,i=e.y-a.y,n=Math.sqrt(t*t+i*i);if(n<=r.particles.line_linked.distance){var s=t/(1e3*r.particles.move.attract.rotateX),c=i/(1e3*r.particles.move.attract.rotateY);e.vx-=s,e.vy-=c,a.vx+=s,a.vy+=c}},r.fn.interact.bounceParticles=function(e,a){var t=e.x-a.x,i=e.y-a.y,n=Math.sqrt(t*t+i*i),s=e.radius+a.radius;s>=n&&(e.vx=-e.vx,e.vy=-e.vy,a.vx=-a.vx,a.vy=-a.vy)},r.fn.modes.pushParticles=function(e,a){r.tmp.pushing=!0;for(var t=0;e>t;t++)r.particles.array.push(new r.fn.particle(r.particles.color,r.particles.opacity.value,{x:a?a.pos_x:Math.random()*r.canvas.w,y:a?a.pos_y:Math.random()*r.canvas.h})),t==e-1&&(r.particles.move.enable||r.fn.particlesDraw(),r.tmp.pushing=!1)},r.fn.modes.removeParticles=function(e){r.particles.array.splice(0,e),r.particles.move.enable||r.fn.particlesDraw()},r.fn.modes.bubbleParticle=function(e){function a(){e.opacity_bubble=e.opacity,e.radius_bubble=e.radius}function i(a,i,n,s,c){if(a!=i)if(r.tmp.bubble_duration_end){if(n!=t){var l=s-d*(s-a)/r.interactivity.modes.bubble.duration,v=a-l;m=a+v,"size"==c&&(e.radius_bubble=m),"opacity"==c&&(e.opacity_bubble=m)}}else if(o<=r.interactivity.modes.bubble.distance){if(n!=t)var p=n;else var p=s;if(p!=a){var m=s-d*(s-a)/r.interactivity.modes.bubble.duration;"size"==c&&(e.radius_bubble=m),"opacity"==c&&(e.opacity_bubble=m)}}else"size"==c&&(e.radius_bubble=t),"opacity"==c&&(e.opacity_bubble=t)}if(r.interactivity.events.onhover.enable&&s("bubble",r.interactivity.events.onhover.mode)){var n=e.x-r.interactivity.mouse.pos_x,c=e.y-r.interactivity.mouse.pos_y,o=Math.sqrt(n*n+c*c),l=1-o/r.interactivity.modes.bubble.distance;if(o<=r.interactivity.modes.bubble.distance){if(l>=0&&"mousemove"==r.interactivity.status){if(r.interactivity.modes.bubble.size!=r.particles.size.value)if(r.interactivity.modes.bubble.size>r.particles.size.value){var v=e.radius+r.interactivity.modes.bubble.size*l;v>=0&&(e.radius_bubble=v)}else{var p=e.radius-r.interactivity.modes.bubble.size,v=e.radius-p*l;v>0?e.radius_bubble=v:e.radius_bubble=0}if(r.interactivity.modes.bubble.opacity!=r.particles.opacity.value)if(r.interactivity.modes.bubble.opacity>r.particles.opacity.value){var m=r.interactivity.modes.bubble.opacity*l;m>e.opacity&&m<=r.interactivity.modes.bubble.opacity&&(e.opacity_bubble=m)}else{var m=e.opacity-(r.particles.opacity.value-r.interactivity.modes.bubble.opacity)*l;m<e.opacity&&m>=r.interactivity.modes.bubble.opacity&&(e.opacity_bubble=m)}}}else a();"mouseleave"==r.interactivity.status&&a()}else if(r.interactivity.events.onclick.enable&&s("bubble",r.interactivity.events.onclick.mode)){if(r.tmp.bubble_clicking){var n=e.x-r.interactivity.mouse.click_pos_x,c=e.y-r.interactivity.mouse.click_pos_y,o=Math.sqrt(n*n+c*c),d=((new Date).getTime()-r.interactivity.mouse.click_time)/1e3;d>r.interactivity.modes.bubble.duration&&(r.tmp.bubble_duration_end=!0),d>2*r.interactivity.modes.bubble.duration&&(r.tmp.bubble_clicking=!1,r.tmp.bubble_duration_end=!1)}r.tmp.bubble_clicking&&(i(r.interactivity.modes.bubble.size,r.particles.size.value,e.radius_bubble,e.radius,"size"),i(r.interactivity.modes.bubble.opacity,r.particles.opacity.value,e.opacity_bubble,e.opacity,"opacity"))}},r.fn.modes.repulseParticle=function(e){function a(){var a=Math.atan2(u,d);if(e.vx=y*Math.cos(a),e.vy=y*Math.sin(a),"bounce"==r.particles.move.out_mode){var t={x:e.x+e.vx,y:e.y+e.vy};t.x+e.radius>r.canvas.w?e.vx=-e.vx:t.x-e.radius<0&&(e.vx=-e.vx),t.y+e.radius>r.canvas.h?e.vy=-e.vy:t.y-e.radius<0&&(e.vy=-e.vy)}}if(r.interactivity.events.onhover.enable&&s("repulse",r.interactivity.events.onhover.mode)&&"mousemove"==r.interactivity.status){var t=e.x-r.interactivity.mouse.pos_x,i=e.y-r.interactivity.mouse.pos_y,c=Math.sqrt(t*t+i*i),o={x:t/c,y:i/c},l=r.interactivity.modes.repulse.distance,v=100,p=n(1/l*(-1*Math.pow(c/l,2)+1)*l*v,0,50),m={x:e.x+o.x*p,y:e.y+o.y*p};"bounce"==r.particles.move.out_mode?(m.x-e.radius>0&&m.x+e.radius<r.canvas.w&&(e.x=m.x),m.y-e.radius>0&&m.y+e.radius<r.canvas.h&&(e.y=m.y)):(e.x=m.x,e.y=m.y)}else if(r.interactivity.events.onclick.enable&&s("repulse",r.interactivity.events.onclick.mode))if(r.tmp.repulse_finish||(r.tmp.repulse_count++,r.tmp.repulse_count==r.particles.array.length&&(r.tmp.repulse_finish=!0)),r.tmp.repulse_clicking){var l=Math.pow(r.interactivity.modes.repulse.distance/6,3),d=r.interactivity.mouse.click_pos_x-e.x,u=r.interactivity.mouse.click_pos_y-e.y,b=d*d+u*u,y=-l/b*1;l>=b&&a()}else 0==r.tmp.repulse_clicking&&(e.vx=e.vx_i,e.vy=e.vy_i)},r.fn.modes.grabParticle=function(e){if(r.interactivity.events.onhover.enable&&"mousemove"==r.interactivity.status){var a=e.x-r.interactivity.mouse.pos_x,t=e.y-r.interactivity.mouse.pos_y,i=Math.sqrt(a*a+t*t);if(i<=r.interactivity.modes.grab.distance){var n=r.interactivity.modes.grab.line_linked.opacity-i/(1/r.interactivity.modes.grab.line_linked.opacity)/r.interactivity.modes.grab.distance;if(n>0){var s=r.particles.line_linked.color_rgb_line;r.canvas.ctx.strokeStyle="rgba("+s.r+","+s.g+","+s.b+","+n+")",r.canvas.ctx.lineWidth=r.particles.line_linked.width,r.canvas.ctx.beginPath(),r.canvas.ctx.moveTo(e.x,e.y),r.canvas.ctx.lineTo(r.interactivity.mouse.pos_x,r.interactivity.mouse.pos_y),r.canvas.ctx.stroke(),r.canvas.ctx.closePath()}}}},r.fn.vendors.eventsListeners=function(){"window"==r.interactivity.detect_on?r.interactivity.el=window:"parent"==r.interactivity.detect_on?r.interactivity.el=r.canvas.el.parentNode:"object"==typeof r.interactivity.detect_on?r.interactivity.el=r.interactivity.detect_on:r.interactivity.el=r.canvas.el,(r.interactivity.events.onhover.enable||r.interactivity.events.onclick.enable)&&(n2(r.interactivity.el).on("mousemove",function(e){if(r.interactivity.el==window)var a=e.clientX,t=e.clientY;else var i=n2(r.interactivity.el).offset(),a=e.pageX-i.left,t=e.pageY-i.top;r.interactivity.mouse.pos_x=a,r.interactivity.mouse.pos_y=t,r.tmp.retina&&(r.interactivity.mouse.pos_x*=r.canvas.pxratio,r.interactivity.mouse.pos_y*=r.canvas.pxratio),r.interactivity.status="mousemove"}),r.interactivity.el.addEventListener("mouseleave",function(e){r.interactivity.mouse.pos_x=null,r.interactivity.mouse.pos_y=null,r.interactivity.status="mouseleave"})),r.interactivity.events.onclick.enable&&r.interactivity.el.addEventListener("click",function(){if(r.interactivity.mouse.click_pos_x=r.interactivity.mouse.pos_x,r.interactivity.mouse.click_pos_y=r.interactivity.mouse.pos_y,r.interactivity.mouse.click_time=(new Date).getTime(),r.interactivity.events.onclick.enable)switch(r.interactivity.events.onclick.mode){case"push":r.particles.move.enable?r.fn.modes.pushParticles(r.interactivity.modes.push.particles_nb,r.interactivity.mouse):1==r.interactivity.modes.push.particles_nb?r.fn.modes.pushParticles(r.interactivity.modes.push.particles_nb,r.interactivity.mouse):r.interactivity.modes.push.particles_nb>1&&r.fn.modes.pushParticles(r.interactivity.modes.push.particles_nb);break;case"remove":r.fn.modes.removeParticles(r.interactivity.modes.remove.particles_nb);break;case"bubble":r.tmp.bubble_clicking=!0;break;case"repulse":r.tmp.repulse_clicking=!0,r.tmp.repulse_count=0,r.tmp.repulse_finish=!1,setTimeout(function(){r.tmp.repulse_clicking=!1},1e3*r.interactivity.modes.repulse.duration)}})},r.fn.vendors.densityAutoParticles=function(){if(r.particles.number.density.enable){var e=r.canvas.el.width*r.canvas.el.height/1e3;r.tmp.retina&&(e/=2*r.canvas.pxratio);var a=e*r.particles.number.value/r.particles.number.density.value_area,t=r.particles.array.length-a;0>t?r.fn.modes.pushParticles(Math.abs(t)):r.fn.modes.removeParticles(t)}},r.fn.vendors.checkOverlap=function(e,a){for(var t=0;t<r.particles.array.length;t++){var i=r.particles.array[t],n=e.x-i.x,s=e.y-i.y,c=Math.sqrt(n*n+s*s);c<=e.radius+i.radius&&(e.x=a?a.x:Math.random()*r.canvas.w,e.y=a?a.y:Math.random()*r.canvas.h,r.fn.vendors.checkOverlap(e))}},r.fn.vendors.createSvgImg=function(e){var a=r.tmp.source_svg,t=/#([0-9A-F]{3,6})/gi,i=a.replace(t,function(a,t,i,n){if(e.color.rgb)var s="rgba("+e.color.rgb.r+","+e.color.rgb.g+","+e.color.rgb.b+","+e.opacity+")";else var s="hsla("+e.color.hsl.h+","+e.color.hsl.s+"%,"+e.color.hsl.l+"%,"+e.opacity+")";return s}),n=new Blob([i],{type:"image/svg+xml;charset=utf-8"}),s=window.URL||window.webkitURL||window,c=s.createObjectURL(n),o=new Image;o.addEventListener("load",function(){e.img.obj=o,e.img.loaded=!0,s.revokeObjectURL(c),r.tmp.count_svg++}),o.src=c},r.fn.vendors.destroypJS=function(){cancelAnimationFrame(r.fn.drawAnimFrame),e.remove(),pJSDom=null},r.fn.vendors.drawShape=function(e,a,t,i,n,s){var r=n*s,c=n/s,o=180*(c-2)/c,l=Math.PI-Math.PI*o/180;e.save(),e.beginPath(),e.translate(a,t),e.moveTo(0,0);for(var v=0;r>v;v++)e.lineTo(i,0),e.translate(i,0),e.rotate(l);e.fill(),e.restore()},r.fn.vendors.exportImg=function(){window.open(r.canvas.el.toDataURL("image/png"),"_blank")},r.fn.vendors.loadImg=function(e){if(r.tmp.img_error=t,""!=r.particles.shape.image.src)if("svg"==e){var a=new XMLHttpRequest;a.open("GET",r.particles.shape.image.src),a.onreadystatechange=function(e){4==a.readyState&&(200==a.status?(r.tmp.source_svg=e.currentTarget.response,r.fn.vendors.checkBeforeDraw()):(console.log("Error pJS - Image not found"),r.tmp.img_error=!0))},a.send()}else{var i=new Image;i.addEventListener("load",function(){r.tmp.img_obj=i,r.fn.vendors.checkBeforeDraw()}),i.src=r.particles.shape.image.src}else console.log("Error pJS - No image.src"),r.tmp.img_error=!0},r.fn.vendors.draw=function(){"image"==r.particles.shape.type?"svg"==r.tmp.img_type?r.tmp.count_svg>=r.particles.number.value?(r.fn.particlesDraw(),r.particles.move.enable?r.fn.drawAnimFrame=requestAnimFrame(r.fn.vendors.draw):cancelRequestAnimFrame(r.fn.drawAnimFrame)):r.tmp.img_error||(r.fn.drawAnimFrame=requestAnimFrame(r.fn.vendors.draw)):r.tmp.img_obj!=t?(r.fn.particlesDraw(),r.particles.move.enable?r.fn.drawAnimFrame=requestAnimFrame(r.fn.vendors.draw):cancelRequestAnimFrame(r.fn.drawAnimFrame)):r.tmp.img_error||(r.fn.drawAnimFrame=requestAnimFrame(r.fn.vendors.draw)):(r.fn.particlesDraw(),r.particles.move.enable?r.fn.drawAnimFrame=requestAnimFrame(r.fn.vendors.draw):cancelRequestAnimFrame(r.fn.drawAnimFrame))},r.fn.vendors.checkBeforeDraw=function(){"image"==r.particles.shape.type?"svg"==r.tmp.img_type&&r.tmp.source_svg==t?r.tmp.checkAnimFrame=requestAnimFrame(check):(cancelRequestAnimFrame(r.tmp.checkAnimFrame),r.tmp.img_error||(r.fn.vendors.init(),r.fn.vendors.draw())):(r.fn.vendors.init(),r.fn.vendors.draw())},r.fn.vendors.init=function(){r.fn.retinaInit(),r.fn.canvasInit(),r.fn.canvasSize(),r.fn.canvasPaint(),r.fn.particlesCreate(),r.fn.vendors.densityAutoParticles(),r.particles.line_linked.color_rgb_line=i(r.particles.line_linked.color)},r.fn.vendors.start=function(){s("image",r.particles.shape.type)?(r.tmp.img_type=r.particles.shape.image.src.substr(r.particles.shape.image.src.length-3),r.fn.vendors.loadImg(r.tmp.img_type)):r.fn.vendors.checkBeforeDraw()},r.fn.vendors.eventsListeners(),r.fn.vendors.start()};return Object.deepExtend=function(e,a){for(var t in a)a[t]&&a[t].constructor&&a[t].constructor===Object?(e[t]=e[t]||{},arguments.callee(e[t],a[t])):e[t]=a[t];return e},window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)}}(),window.cancelRequestAnimFrame=function(){return window.cancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||clearTimeout}(),r});