2 lines
37 KiB
JavaScript
2 lines
37 KiB
JavaScript
|
|
this.PIXI=this.PIXI||{},function(t,e,i,s,r,a,n,h){"use strict";class o{constructor(t,e,i){this.value=t,this.time=e,this.next=null,this.isStepped=!1,this.ease=i?"function"==typeof i?i:x(i):null}static createList(t){if("list"in t){const e=t.list;let i;const{value:s,time:r}=e[0],a=i=new o("string"==typeof s?g(s):s,r,t.ease);if(e.length>2||2===e.length&&e[1].value!==s)for(let t=1;t<e.length;++t){const{value:s,time:r}=e[t];i.next=new o("string"==typeof s?g(s):s,r),i=i.next}return a.isStepped=!!t.isStepped,a}const e=new o("string"==typeof t.start?g(t.start):t.start,0);return t.end!==t.start&&(e.next=new o("string"==typeof t.end?g(t.end):t.end,1)),e}}let l=e.Texture.from;const c=!1,d=Math.PI/180;function p(t,e){if(!t)return;const i=Math.sin(t),s=Math.cos(t),r=e.x*s-e.y*i,a=e.x*i+e.y*s;e.x=r,e.y=a}function u(t,e,i){return t<<16|e<<8|i}function m(t){return Math.sqrt(t.x*t.x+t.y*t.y)}function f(t){const e=1/m(t);t.x*=e,t.y*=e}function v(t,e){t.x*=e,t.y*=e}function g(t,e){let i;return e||(e={}),"#"===t.charAt(0)?t=t.substr(1):0===t.indexOf("0x")&&(t=t.substr(2)),8===t.length&&(i=t.substr(0,2),t=t.substr(2)),e.r=parseInt(t.substr(0,2),16),e.g=parseInt(t.substr(2,2),16),e.b=parseInt(t.substr(4,2),16),i&&(e.a=parseInt(i,16)),e}function x(t){const e=t.length,i=1/e;return function(s){const r=e*s|0,a=(s-r*i)*e,n=t[r]||t[e-1];return n.s+a*(2*(1-a)*(n.cp-n.s)+a*(n.e-n.s))}}function C(t){return t?(t=t.toUpperCase().replace(/ /g,"_"),i.BLEND_MODES[t]||i.BLEND_MODES.NORMAL):i.BLEND_MODES.NORMAL}var _,y={__proto__:null,GetTextureFromString:l,verbose:c,DEG_TO_RADS:d,rotatePoint:p,combineRGBComponents:u,length:m,normalize:f,scaleBy:v,hexToRGB:g,generateEase:x,getBlendMode:C,createSteppedGradient:function(t,e=10){("number"!=typeof e||e<=0)&&(e=10);const i=new o(g(t[0].value),t[0].time);i.isStepped=!0;let s=i,r=t[0],a=1,n=t[a];for(let i=1;i<e;++i){let h=i/e;for(;h>n.time;)r=n,n=t[++a];h=(h-r.time)/(n.time-r.time);const l=g(r.value),c=g(n.value),d={r:(c.r-l.r)*h+l.r,g:(c.g-l.g)*h+l.g,b:(c.b-l.b)*h+l.b};s.next=new o(d,i/e),s=s.next}return i}};class P extends s.Sprite{constructor(t){super(),this.prevChild=this.nextChild=null,this.emitter=t,this.config={},this.anchor.x=this.anchor.y=.5,this.maxLife=0,this.age=0,this.agePercent=0,this.oneOverLife=0,this.next=null,this.prev=null,this.init=this.init,this.kill=this.kill}init(t){this.maxLife=t,this.age=this.agePercent=0,this.rotation=0,this.position.x=this.position.y=0,this.scale.x=this.scale.y=1,this.tint=16777215,this.alpha=1,this.oneOverLife=1/this.maxLife,this.visible=!0}kill(){this.emitter.recycle(this)}destroy(){this.parent&&this.parent.removeChild(this),this.emitter=this.next=this.prev=null,super.destroy()}}!function(t){t[t.Spawn=0]="Spawn",t[t.Normal=2]="Normal",t[t.Late=5]="Late"}(_||(_={}));const w=n.Ticker.shared,b=Symbol("Position particle per emitter position");class S{constructor(t,e){this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],this.minLifetime=0,this.maxLifetime=0,this.customEase=null,this._frequency=1,this.spawnChance=1,this.maxParticles=1e3,this.emitterLifetime=-1,this.spawnPos=new a.Point,this.particlesPerWave=1,this.rotation=0,this.ownerPos=new a.Point,this._prevEmitterPos=new a.Point,this._prevPosIsValid=!1,this._posChanged=!1,this._parent=null,this.addAtBack=!1,this.particleCount=0,this._emit=!1,this._spawnTimer=0,this._emitterLife=-1,this._activeParticlesFirst=null,this._activeParticlesLast=null,this._poolFirst=null,this._origConfig=null,this._autoUpdate=!1,this._destroyWhenComplete=!1,this._completeCallback=null,this.parent=t,e&&this.init(e),this.recycle=this.recycle,this.update=this.update,this.rotate=this.rotate,this.updateSpawnPos=this.updateSpawnPos,this.updateOwnerPos=this.updateOwnerPos}static registerBehavior(t){S.knownBehaviors[t.type]=t}get frequency(){return this._frequency}set frequency(t){this._frequency="number"==typeof t&&t>0?t:1}get parent(){return this._parent}set parent(t){this.cleanup(),this._parent=t}init(t){if(!t)return;this.cleanup(),this._origConfig=t,this.minLifetime=t.lifetime.min,this.maxLifetime=t.lifetime.max,t.ease?this.customEa
|
||
|
|
//# sourceMappingURL=pixi-particles.min.js.map
|