/*! * Proton v4.1.5 * https://github.com/drawcall/Proton * * Copyright 2013-2019, A-JIE * Licensed under the MIT license * http://www.opensource.org/licenses/mit-license * */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Proton=e()}(this,function(){"use strict";function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var e=3.1415926,h={PI:e,PIx2:2*e,PI_2:e/2,PI_180:e/180,N180_PI:180/e,Infinity:-999,isInfinity:function(t){return t===this.Infinity||t===1/0},randomAToB:function(t,e,i){return 2>e;return t+1},d=function(t,e){return[1,0,0,0,1,0,t,e,1]},y=function(t){var e=Math.cos(t),i=Math.sin(t);return[e,-i,0,i,e,0,0,0,1]},p=function(t,e){return[t,0,0,0,e,0,0,0,1]},f=function(t,e){var i=t[0],a=t[1],r=t[2],n=t[3],s=t[4],o=t[5],h=t[6],l=t[7],u=t[8],c=e[0],d=e[1],y=e[2],p=e[3],f=e[4],v=e[5],g=e[6],m=e[7],b=e[8];return[i*c+a*p+r*g,i*d+a*f+r*m,i*y+a*v+r*b,n*c+s*p+o*g,n*d+s*f+o*m,n*y+s*v+o*b,h*c+l*p+u*g,h*d+l*f+u*m,h*y+l*v+u*b]},v={createCanvas:function(t,e,i,a){var r=3",i&&(r+="em speed:"+i.emitSpeed+"
"),i&&(r+="pos:"+this.getEmitterPos(i));break;case 3:i&&(r+="initializes:"+i.initializes.length+"
"),i&&(r+=''+this.concatArr(i.initializes)+"
"),i&&(r+="behaviours:"+i.behaviours.length+"
"),i&&(r+=''+this.concatArr(i.behaviours)+"
");break;case 4:a&&(r+=a.name+"
"),a&&(r+="body:"+this.getCreatedNumber(a)+"
");break;default:r+="particles:"+this.proton.getCount()+"
",r+="pool:"+this.proton.pool.getCount()+"
",r+="total:"+this.proton.pool.total}this.container.innerHTML=r}},{key:"add",value:function(t,e){var i=this;if(!this.container){this.type=1,this.container=document.createElement("div"),this.container.style.cssText=["position:absolute;bottom:0px;left:0;cursor:pointer;","opacity:0.9;z-index:10000;padding:10px;font-size:12px;font-family:Helvetica,Arial,sans-serif;","width:120px;height:50px;background-color:#002;color:#0ff;"].join(""),this.container.addEventListener("click",function(t){i.type++,4this._interval&&(this.dispatchEvent(M.PROTON_UPDATE),this.emittersUpdate(this._interval),this.then=this.now-this.elapsed%this._interval*1e3,this.dispatchEvent(M.PROTON_UPDATE_AFTER)))}},{key:"emittersUpdate",value:function(t){for(var e=this.emitters.length;e--;)this.emitters[e].update(t)}},{key:"amendChangeTabsBug",value:function(){M.amendChangeTabsBug&&.5=this.x&&e<=this.bottom&&e>=this.y}}]),Q);function Q(t,e,i,a){s(this,Q),this.x=t,this.y=e,this.width=i,this.height=a,this.bottom=this.y+this.height,this.right=this.x+this.width}var K=(t(J,[{key:"init",value:function(){this.startTime=0,this.nextTime=this.timePan.getValue()}},{key:"getValue",value:function(t){return this.startTime+=t,this.startTime>=this.nextTime?(this.startTime=0,this.nextTime=this.timePan.getValue(),1===this.numPan.b?.5=this.life||this.dead)this.energy=0,this.dead=!0,this.destroy();else{var i=this.easing(t.age/t.life);this.energy=Math.max(1-i,0)}}},{key:"destroy",value:function(){for(var t=this.parents.length;t--;)this.parents[t].removeBehaviour(this);this.parents.length=0}}]),mt);function mt(t,e){s(this,mt),this.life=P.initValue(t,1/0),this.easing=U.getEasing(e),this.age=0,this.energy=1,this.dead=!1,this.parents=[],this.id="Behaviour_"+mt.id++,this.name="Behaviour"}gt.id=0;var bt=(r(_t,gt),t(_t,[{key:"reset",value:function(t,e,i,a){this.force=this.normalizeForce(new F(t,e)),i&&o(_t.prototype.__proto__||Object.getPrototypeOf(_t.prototype),"reset",this).call(this,i,a)}},{key:"applyBehaviour",value:function(t,e,i){this.calculate(t,e,i),t.a.add(this.force)}}]),_t);function _t(t,e,i,a){s(this,_t);var r=l(this,(_t.__proto__||Object.getPrototypeOf(_t)).call(this,i,a));return r.force=r.normalizeForce(new F(t,e)),r.name="Force",r}var xt=(r(kt,gt),t(kt,[{key:"reset",value:function(t,e,i,a,r){this.targetPosition=P.initValue(t,new F),this.radius=P.initValue(i,1e3),this.force=P.initValue(this.normalizeValue(e),100),this.radiusSq=this.radius*this.radius,this.attractionForce=new F,this.lengthSq=0,a&&o(kt.prototype.__proto__||Object.getPrototypeOf(kt.prototype),"reset",this).call(this,a,r)}},{key:"applyBehaviour",value:function(t,e,i){this.calculate(t,e,i),this.attractionForce.copy(this.targetPosition),this.attractionForce.sub(t.p),this.lengthSq=this.attractionForce.lengthSq(),4e-5=this.delay&&(t.a.addXY(h.randomAToB(-this.panFoce.x,this.panFoce.x),h.randomAToB(-this.panFoce.y,this.panFoce.y)),t.data.time=0)}}]),Et);function Et(t,e,i,a,r){s(this,Et);var n=l(this,(Et.__proto__||Object.getPrototypeOf(Et)).call(this,a,r));return n.reset(t,e,i),n.time=0,n.name="RandomDrift",n}var At=(r(Tt,bt),t(Tt,[{key:"reset",value:function(t,e,i){o(Tt.prototype.__proto__||Object.getPrototypeOf(Tt.prototype),"reset",this).call(this,0,t,e,i)}}]),Tt);function Tt(t,e,i){s(this,Tt);var a=l(this,(Tt.__proto__||Object.getPrototypeOf(Tt)).call(this,0,t,e,i));return a.name="Gravity",a}var Rt=(r(Ot,gt),t(Ot,[{key:"reset",value:function(t,e,i,a,r){this.emitter=P.initValue(t,null),this.mass=P.initValue(e,!0),this.callback=P.initValue(i,null),this.collisionPool=[],this.delta=new F,a&&o(Ot.prototype.__proto__||Object.getPrototypeOf(Ot.prototype),"reset",this).call(this,a,r)}},{key:"applyBehaviour",value:function(t,e,i){var a=this.emitter?this.emitter.particles.slice(i):this.pool.slice(i),r=a.length,n=void 0,s=void 0,o=void 0,h=void 0,l=void 0,u=void 0,c=void 0;for(c=0;c=this.life||this.dead)&&this.destroy(),this.emitting(t),this.integrate(t)}},{key:"integrate",value:function(t){if(this.parent){var e=1-this.damping;this.parent.integrator.calculate(this,t,e);var i=void 0,a=void 0;for(i=this.particles.length-1;0<=i;i--)(a=this.particles[i]).update(t,i),this.parent.integrator.calculate(a,t,e),this.dispatch("PARTICLE_UPDATE",a),a.dead&&(this.dispatch("PARTICLE_DEAD",a),this.parent.pool.expire(a),this.particles.splice(i,1))}}},{key:"dispatch",value:function(t,e){this.parent&&this.parent.dispatchEvent(t,e),this.bindEvent&&this.dispatchEvent(t,e)}},{key:"emitting",value:function(t){if("once"===this.totalTime){var e=void 0,i=this.rate.getValue(99999);for(0this.element.width||i<0||i>this.elementwidth)){var n=4*((i>>0)*t.width+(e>>0));t.data[n]=r.r,t.data[1+n]=r.g,t.data[2+n]=r.b,t.data[3+n]=255*a.alpha}}},{key:"onParticleDead",value:function(){}}]),he);function he(t,e){s(this,he);var i=l(this,(he.__proto__||Object.getPrototypeOf(he)).call(this,t));return i.context=i.element.getContext("2d"),i.imageData=null,i.rectangle=null,i.rectangle=e,i.createImageData(e),i.name="PixelRenderer",i}var le=void 0,ue=(r(ce,$t),t(ce,[{key:"setPIXI",value:function(t){try{le=t||{Sprite:{}},this.createFromImage=le.Sprite.from||le.Sprite.fromImage}catch(t){}}},{key:"onProtonUpdate",value:function(){}},{key:"onParticleCreated",value:function(t){t.body?t.body=this.pool.get(t.body,t):t.body=this.pool.get(this.circleConf,t),this.blendMode&&(t.body.blendMode=this.blendMode),this.element.addChild(t.body)}},{key:"onParticleUpdate",value:function(t){this.transform(t,t.body),!0!==this.setColor&&!0!==this.color||(t.body.tint=H.getHex16FromParticle(t))}},{key:"onParticleDead",value:function(t){this.element.removeChild(t.body),this.pool.expire(t.body),t.body=null}},{key:"destroy",value:function(t){o(ce.prototype.__proto__||Object.getPrototypeOf(ce.prototype),"destroy",this).call(this),this.pool.destroy();for(var e=t.length;e--;){var i=t[e];i.body&&this.element.removeChild(i.body)}}},{key:"transform",value:function(t,e){e.x=t.p.x,e.y=t.p.y,e.alpha=t.alpha,e.scale.x=t.scale,e.scale.y=t.scale,e.rotation=t.rotation*h.PI_180}},{key:"createBody",value:function(t,e){return t.isCircle?this.createCircle(e):this.createSprite(t)}},{key:"createSprite",value:function(t){var e=t.isInner?this.createFromImage(t.src):new le.Sprite(t);return e.anchor.x=.5,e.anchor.y=.5,e}},{key:"createCircle",value:function(t){var e=new le.Graphics;if(this.stroke){var i=this.stroke instanceof String?this.stroke:0;e.beginStroke(i)}return e.beginFill(t.color||36077),e.drawCircle(0,0,t.radius),e.endFill(),e}}]),ce);function ce(t,e){s(this,ce);var i=l(this,(ce.__proto__||Object.getPrototypeOf(ce)).call(this,t));return i.stroke=e,i.color=!1,i.setColor=!1,i.blendMode=null,i.pool.create=function(t,e){return i.createBody(t,e)},i.setPIXI(window.PIXI),i.name="PixiRenderer",i}var de=(t(ye,[{key:"set",value:function(t,e){0===e?X.set(t,this.mats[0]):X.multiply(this.mats[e-1],t,this.mats[e]),this.size=Math.max(this.size,e+1)}},{key:"push",value:function(t){0===this.size?X.set(t,this.mats[0]):X.multiply(this.mats[this.size-1],t,this.mats[this.size]),this.size++}},{key:"pop",value:function(){0=this.minx)return!0}else if(t.p.y<=this.maxy&&t.p.y>=this.miny)return!0;return!1}},{key:"getLength",value:function(){return Math.sqrt(this.dx*this.dx+this.dy*this.dy)}},{key:"crossing",value:function(t){if("dead"===this.crossType)if(">"===this.direction||"R"===this.direction||"right"===this.direction||"down"===this.direction){if(!this.rangeOut(t))return;this.getDirection(t.p.x,t.p.y)&&(t.dead=!0)}else{if(!this.rangeOut(t))return;this.getDirection(t.p.x,t.p.y)||(t.dead=!0)}else if("bound"===this.crossType){if(!this.rangeOut(t))return;this.getDistance(t.p.x,t.p.y)<=t.radius&&(0===this.dx?t.v.x*=-1:0===this.dy?t.v.y*=-1:this.getSymmetric(t.v))}else"cross"===this.crossType&&this.alert&&(console.error("Sorry, LineZone does not support cross method!"),this.alert=!1)}}]),be);function be(t,e,i,a,r){s(this,be);var n=l(this,(be.__proto__||Object.getPrototypeOf(be)).call(this));return 0<=i-t?(n.x1=t,n.y1=e,n.x2=i,n.y2=a):(n.x1=i,n.y1=a,n.x2=t,n.y2=e),n.dx=n.x2-n.x1,n.dy=n.y2-n.y1,n.minx=Math.min(n.x1,n.x2),n.miny=Math.min(n.y1,n.y2),n.maxx=Math.max(n.x1,n.x2),n.maxy=Math.max(n.y1,n.y2),n.dot=n.x2*n.y1-n.x1*n.y2,n.xxyy=n.dx*n.dx+n.dy*n.dy,n.gradient=n.getGradient(),n.length=n.getLength(),n.direction=P.initValue(r,">"),n}var _e=(r(xe,at),t(xe,[{key:"getPosition",value:function(){return this.angle=h.PIx2*Math.random(),this.randomRadius=Math.random()*this.radius,this.vector.x=this.x+this.randomRadius*Math.cos(this.angle),this.vector.y=this.y+this.randomRadius*Math.sin(this.angle),this.vector}},{key:"setCenter",value:function(t,e){this.center.x=t,this.center.y=e}},{key:"crossing",value:function(t){var e=t.p.distanceTo(this.center);"dead"===this.crossType?e-t.radius>this.radius&&(t.dead=!0):"bound"===this.crossType?e+t.radius>=this.radius&&this.getSymmetric(t):"cross"===this.crossType&&this.alert&&(console.error("Sorry, CircleZone does not support cross method!"),this.alert=!1)}},{key:"getSymmetric",value:function(t){var e=t.v.getGradient(),i=2*(this.getGradient(t)-e),a=t.v.x,r=t.v.y;t.v.x=a*Math.cos(i)-r*Math.sin(i),t.v.y=a*Math.sin(i)+r*Math.cos(i)}},{key:"getGradient",value:function(t){return-h.PI_2+Math.atan2(t.p.y-this.center.y,t.p.x-this.center.x)}}]),xe);function xe(t,e,i){s(this,xe);var a=l(this,(xe.__proto__||Object.getPrototypeOf(xe)).call(this));return a.x=t,a.y=e,a.radius=i,a.angle=0,a.center={x:t,y:e},a}var ke=(r(Pe,at),t(Pe,[{key:"getPosition",value:function(){return this.vector.x=this.x+Math.random()*this.width,this.vector.y=this.y+Math.random()*this.height,this.vector}},{key:"crossing",value:function(t){"dead"===this.crossType?(t.p.x+t.radiusthis.x+this.width&&(t.dead=!0),t.p.y+t.radiusthis.y+this.height&&(t.dead=!0)):"bound"===this.crossType?(t.p.x-t.radiusthis.x+this.width&&(t.p.x=this.x+this.width-t.radius,t.v.x*=-1),t.p.y-t.radiusthis.y+this.height&&(t.p.y=this.y+this.height-t.radius,t.v.y*=-1)):"cross"===this.crossType&&(t.p.x+t.radiusthis.x+this.width&&0<=t.v.x&&(t.p.x=this.x-t.radius),t.p.y+t.radiusthis.y+this.height&&0<=t.v.y&&(t.p.y=this.y-t.radius))}}]),Pe);function Pe(t,e,i,a){s(this,Pe);var r=l(this,(Pe.__proto__||Object.getPrototypeOf(Pe)).call(this));return r.x=t,r.y=e,r.width=i,r.height=a,r}var Ee=(r(Ae,at),t(Ae,[{key:"reset",value:function(t,e,i,a){this.imageData=t,this.x=P.initValue(e,0),this.y=P.initValue(i,0),this.d=P.initValue(a,2),this.vectors=[],this.setVectors()}},{key:"setVectors",value:function(){var t=void 0,e=void 0,i=this.imageData.width,a=this.imageData.height;for(t=0;t>0)*i+(t>>0));0>0)*this.imageData.width+(t>>0));return 0>0)*this.imageData.width+(t>>0));return{r:this.imageData.data[i],g:this.imageData.data[1+i],b:this.imageData.data[2+i],a:this.imageData.data[3+i]}}},{key:"crossing",value:function(t){"dead"===this.crossType?this.getBound(t.p.x-this.x,t.p.y-this.y)?t.dead=!0:t.dead=!1:"bound"===this.crossType&&(this.getBound(t.p.x-this.x,t.p.y-this.y)||t.v.negate())}}]),Ae);function Ae(t,e,i,a){s(this,Ae);var r=l(this,(Ae.__proto__||Object.getPrototypeOf(Ae)).call(this));return r.reset(t,e,i,a),r}var Te={addEventListener:function(t,e){t.addEventListener("PROTON_UPDATE_AFTER",function(){return e()})},getStyle:function(t){var e=H.hexToRgb(0