"use strict";var _createClass=function(){function e(e,a){for(var t=0;t<a.length;t++){var n=a[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(a,t,n){return t&&e(a.prototype,t),n&&e(a,n),a}}();function _classCallCheck(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}var Dust=function(){function e(){var a=void 0===arguments[0]?PIXI:arguments[0];if(_classCallCheck(this,e),void 0===a)throw new Error("Please assign a rendering engine in the constructor before using pixiDust.js");this.renderer="",a.ParticleContainer&&(this.Container=a.Container,this.renderer="pixi"),this.globalParticles=[]}return _createClass(e,[{key:"randomFloat",value:function(e,a){return e+Math.random()*(a-e)}},{key:"randomInt",value:function(e,a){return Math.floor(Math.random()*(a-e+1))+e}},{key:"create",value:function(){var e=void 0===arguments[0]?0:arguments[0],a=void 0===arguments[1]?0:arguments[1],t=arguments[2],n=void 0===arguments[3]?function(){return new y.Container}:arguments[3],r=void 0===arguments[4]?20:arguments[4],i=void 0===arguments[5]?0:arguments[5],o=void 0===arguments[6]||arguments[6],l=void 0===arguments[7]?0:arguments[7],s=void 0===arguments[8]?6.28:arguments[8],c=void 0===arguments[9]?16*h5.scaleFactor:arguments[9],d=void 0===arguments[10]?32*h5.scaleFactor:arguments[10],u=void 0===arguments[11]?.3:arguments[11],v=void 0===arguments[12]?3:arguments[12],h=void 0===arguments[13]?.01:arguments[13],p=void 0===arguments[14]?.05:arguments[14],f=void 0===arguments[15]?.02:arguments[15],g=void 0===arguments[16]?.02:arguments[16],y=this,m=void 0===arguments[17]?.01:arguments[17],P=void 0===arguments[18]?.03:arguments[18],b=arguments[19],C=[];this.globalParticles.push(C);for(var x=[],I=void 0,S=(s-l)/(r-1),F=0;F<r;F++)o?(I=this.randomFloat(l,s),x.push(I)):(void 0===I&&(I=l),x.push(I),I+=S);return x.forEach(function(r){return function(r){var o=new function(){var e=new PIXI.Sprite(PIXI.loader.resources[t].texture);return e.tint=b,e};o.totalFrames>0&&o.gotoAndStop(y.randomInt(0,o.totalFrames-1));var l=y.randomInt(c,d);o.width=l,o.height=l,o.anchor.set(.5,.5),o.x=e,o.y=a,o.scaleSpeed=y.randomFloat(h,p),o.alphaSpeed=y.randomFloat(f,g),o.rotationSpeed=y.randomFloat(m,P);var s=y.randomFloat(u,v);o.vx=s*Math.cos(r),o.vy=s*Math.sin(r),C.push(o),n.addChild(o),o.updateParticle=function(){o.vy+=i,o.x+=o.vx,o.y+=o.vy,o.scale.x-o.scaleSpeed>0&&(o.scale.x-=o.scaleSpeed),o.scale.y-o.scaleSpeed>0&&(o.scale.y-=o.scaleSpeed),o.rotation+=o.rotationSpeed,o.alpha-=o.alphaSpeed,o.alpha<=0&&(n.removeChild(o),C.splice(C.indexOf(o),1))}}(r)}),C}},{key:"emitter",value:function(e,a){var t={},n=void 0;return t.playing=!1,t.play=function(){t.playing||(a(),n=setInterval(function(){a()}.bind(this),e),t.playing=!0)},t.stop=function(){t.playing&&(clearInterval(n),t.playing=!1)},t}},{key:"update",value:function(){if(this.globalParticles.length>0)for(var e=this.globalParticles.length-1;e>=0;e--){var a=this.globalParticles[e];if(a.length>0)for(var t=a.length-1;t>=0;t--){a[t].updateParticle()}else this.globalParticles.splice(this.globalParticles.indexOf(a),1)}}}]),e}();