phaser3-rex-plugins
Version:
2 lines (1 loc) • 22.2 kB
JavaScript
var t,e;t=void 0,e=function(){const t=Phaser.GameObjects.GetCalcMatrix,e=Phaser.Renderer.Canvas.SetTransform;var s={renderWebGL:function(e,s,i,r){s.updateData(),i.addToRenderList(s);var h=e.pipelines.set(s.pipeline),a=t(s,i,r),n=h.calcMatrix.copyFrom(a.calc),o=s._displayOriginX,l=s._displayOriginY,u=i.alpha*s.alpha;e.pipelines.preBatch(s);for(var d,p=s.geom,c=0,v=p.length;c<v;c++)(d=p[c]).visible&&d.webglRender(h,n,u,o,l);e.pipelines.postBatch(s)},renderCanvas:function(t,s,i,r){s.updateData(),i.addToRenderList(s);var h=t.currentContext;if(e(t,h,s,i,r)){for(var a,n=s._displayOriginX,o=s._displayOriginY,l=s.geom,u=0,d=l.length;u<d;u++)(a=l[u]).visible&&a.canvasRender(h,n,o);h.restore()}}},i=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t};const r=Phaser.GameObjects.Shape,h=Phaser.Utils.Array.Remove;class a extends r{constructor(t,e,s,i,r){void 0===e&&(e=0),void 0===s&&(s=0),void 0===i&&(i=2),void 0===r&&(r=i),super(t,"rexShapes",[]),this._width=-1,this._height=-1,this.dirty=!0,this.isSizeChanged=!0,this.shapes={},this.setPosition(e,s),this.setSize(i,r),this.updateDisplayOrigin()}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setDirty(t){return void 0===t&&(t=!0),this.dirty=t,this}setSize(t,e){this.isSizeChanged=this.isSizeChanged||this._width!==t||this._height!==e,this.dirty=this.dirty||this.isSizeChanged,this._width=t,this._height=e,this.updateDisplayOrigin();var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=t,s.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}get fillColor(){return this._fillColor}set fillColor(t){this.setFillStyle(t,this._fillAlpha)}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this.setFillStyle(this._fillColor,t)}setFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.fillColor!==t||this.fillAlpha!==e,this._fillColor=t,this._fillAlpha=e,this}get lineWidth(){return this._lineWidth}set lineWidth(t){this.setStrokeStyle(t,this._strokeColor,this._strokeAlpha)}get strokeColor(){return this._strokeColor}set strokeColor(t){this.setStrokeStyle(this._lineWidth,t,this._strokeAlpha)}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this.setStrokeStyle(this._lineWidth,this._strokeColor,t)}setStrokeStyle(t,e,s){return void 0===s&&(s=1),this.dirty=this.dirty||this.lineWidth!==t||this.strokeColor!==e||this.strokeAlpha!==s,this._lineWidth=t,this._strokeColor=e,this._strokeAlpha=s,this}updateShapes(){}updateData(){if(!this.dirty)return this;this.updateShapes();for(var t=this.geom,e=0,s=t.length;e<s;e++){var i=t[e];i.dirty&&i.updateData()}return this.isSizeChanged=!1,this.dirty=!1,this}clear(){return this.geom.length=0,i(this.shapes),this.dirty=!0,this}getShape(t){return this.shapes[t]}getShapes(){return this.geom}addShape(t){this.geom.push(t);var e=t.name;return e&&(this.shapes[e]=t),this.dirty=!0,this}deleteShape(t){var e=this.getShape(t);return e&&(delete this.shapes[t],h(this.geom,e)),this}}Object.assign(a.prototype,s);var n={setEventEmitter(t,e){return void 0===e&&(e=Phaser.Events.EventEmitter),this._privateEE=!0===t||void 0===t,this._eventEmitter=this._privateEE?new e:t,this},destroyEventEmitter(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter(){return this._eventEmitter},on(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}};const o=Phaser.Scene;var l=function(t){return t instanceof o};const u=Phaser.Game;var d=function(t){return t instanceof u};const p=Phaser.Utils.Objects.GetValue;class c{constructor(t,e){this.setParent(t),this.isShutdown=!1,this.setEventEmitter(p(e,"eventEmitter",!0)),this.parent&&(this.parent===this.scene?this.scene.sys.events.once("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.once("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.once("destroy",this.onParentDestroy,this))}shutdown(t){this.isShutdown||(this.parent&&(this.parent===this.scene?this.scene.sys.events.off("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.off("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.off("destroy",this.onParentDestroy,this)),this.destroyEventEmitter(),this.parent=void 0,this.scene=void 0,this.game=void 0,this.isShutdown=!0)}destroy(t){this.shutdown(t)}onEnvDestroy(){this.destroy(!0)}onParentDestroy(t,e){this.destroy(e)}setParent(t){var e;return this.parent=t,this.scene=null==(e=t)||"object"!=typeof e?null:l(e)?e:e.scene&&l(e.scene)?e.scene:e.parent&&e.parent.scene&&l(e.parent.scene)?e.parent.scene:null,this.game=function(t){return null==t||"object"!=typeof t?null:d(t)?t:d(t.game)?t.game:l(t)?t.sys.game:l(t.scene)?t.scene.sys.game:void 0}(t),this}}Object.assign(c.prototype,n);const v=Phaser.Utils.Objects.GetValue;class y extends c{constructor(t,e){super(t,e),this._isRunning=!1,this.isPaused=!1,this.tickingState=!1,this.setTickingMode(v(e,"tickingMode",1))}boot(){2!==this.tickingMode||this.tickingState||this.startTicking()}shutdown(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),super.shutdown(t))}setTickingMode(t){"string"==typeof t&&(t=g[t]),this.tickingMode=t}startTicking(){this.tickingState=!0}stopTicking(){this.tickingState=!1}get isRunning(){return this._isRunning}set isRunning(t){this._isRunning!==t&&(this._isRunning=t,1===this.tickingMode&&t!=this.tickingState&&(t?this.startTicking():this.stopTicking()))}start(){return this.isPaused=!1,this.isRunning=!0,this}pause(){return this.isRunning&&(this.isPaused=!0,this.isRunning=!1),this}resume(){return this.isPaused&&(this.isPaused=!1,this.isRunning=!0),this}stop(){return this.isPaused=!1,this.isRunning=!1,this}complete(){this.isPaused=!1,this.isRunning=!1,this.emit("complete",this.parent,this)}}const g={no:0,lazy:1,always:2},f=Phaser.Utils.Objects.GetValue;class m extends y{constructor(t,e){super(t,e);var s=this.scene?"update":"step";this.tickEventName=f(e,"tickEventName",s),this.isSceneTicker=!D(this.tickEventName)}startTicking(){super.startTicking(),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this)}stopTicking(){super.stopTicking(),this.isSceneTicker&&this.scene?this.scene.sys.events.off(this.tickEventName,this.update,this):this.game&&this.game.events.off(this.tickEventName,this.update,this)}}var D=function(t){return"step"===t||"poststep"===t};const k=Phaser.Utils.Objects.GetValue,_=Phaser.Math.Clamp;class P{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){this.state=k(t,"state",S),this.timeScale=k(t,"timeScale",1),this.delay=k(t,"delay",0),this.repeat=k(t,"repeat",0),this.repeatCounter=k(t,"repeatCounter",0),this.repeatDelay=k(t,"repeatDelay",0),this.duration=k(t,"duration",0),this.nowTime=k(t,"nowTime",0),this.justRestart=k(t,"justRestart",!1)}toJSON(){return{state:this.state,timeScale:this.timeScale,delay:this.delay,repeat:this.repeat,repeatCounter:this.repeatCounter,repeatDelay:this.repeatDelay,duration:this.duration,nowTime:this.nowTime,justRestart:this.justRestart}}destroy(){}setTimeScale(t){return this.timeScale=t,this}setDelay(t){return void 0===t&&(t=0),this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatInfinity(){return this.repeat=-1,this}setRepeatDelay(t){return this.repeatDelay=t,this}start(){return this.nowTime=this.delay>0?-this.delay:0,this.state=this.nowTime>=0?T:E,this.repeatCounter=0,this}stop(){return this.state=S,this}update(t,e){this.state!==S&&this.state!==C&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter<this.repeat?(this.repeatCounter++,this.justRestart=!0,this.nowTime-=this.duration,this.repeatDelay>0&&(this.nowTime-=this.repeatDelay,this.state=b)):(this.nowTime=this.duration,this.state=C):this.nowTime>=0&&(this.state=T))}get t(){var t;switch(this.state){case S:case E:case b:t=0;break;case T:t=this.nowTime/this.duration;break;case C:t=1}return _(t,0,1)}set t(t){(t=_(t,-1,1))<0?(this.state=E,this.nowTime=-this.delay*t):(this.state=T,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===S}get isDelay(){return this.state===E}get isCountDown(){return this.state===T}get isRunning(){return this.state===E||this.state===T}get isDone(){return this.state===C}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const S=0,E=1,T=2,b=3,C=-1;class w extends m{constructor(t,e){super(t,e),this.timer=new P}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const R=Phaser.Utils.Objects.GetValue,x=Phaser.Utils.Objects.GetAdvancedValue,O=Phaser.Tweens.Builders.GetEaseFunction;class A extends w{resetFromJSON(t){return this.timer.resetFromJSON(R(t,"timer")),this.setEnable(R(t,"enable",!0)),this.setTarget(R(t,"target",this.parent)),this.setDelay(x(t,"delay",0)),this.setDuration(x(t,"duration",1e3)),this.setEase(R(t,"ease","Linear")),this.setRepeat(R(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=O(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var s=this.target,i=this.timer;return i.update(t,e),i.isDelay||this.updateTarget(s,i),this.emit("update",s,this),i.isDone&&this.complete(),this}updateTarget(t,e){}}const j=Phaser.Utils.Objects.GetValue,V=Phaser.Math.Linear;class M extends A{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=j(t,"key","value");var s=e[this.propertyKey];return this.fromValue=j(t,"from",s),this.toValue=j(t,"to",s),this.setEase(j(t,"ease",this.ease)),this.setDuration(j(t,"duration",this.duration)),this.setRepeat(j(t,"repeat",0)),this.setDelay(j(t,"delay",0)),this.setRepeatDelay(j(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var s=e.t;s=this.easeFn(s),t[this.propertyKey]=V(this.fromValue,this.toValue,s)}}var F={start:function(t){return this.easeValueTask||(this.easeValueTask=new M(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const L=Phaser.Utils.Objects.GetValue;class G extends a{constructor(t,e){super(t,L(e,"x",0),L(e,"y",0),L(e,"width",64),L(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),L(e,"start",!0)&&this.start()}resetFromConfig(t,e){var s;return void 0===e&&(e=!1),s=e?1e3:this.duration,this.setDuration(L(t,"duration",s)),s=e?"Linear":this.ease,this.setEase(L(t,"ease",s)),s=e?0:this.delay,this.setDelay(L(t,"delay",s)),s=e?0:this.repeatDelay,this.setRepeatDelay(L(t,"repeatDelay",s)),s=e?16777215:this.color,this.setColor(L(t,"color",s)),s=e?0:this.value,this.setValue(L(t,"value",s)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(G.prototype,F);var N={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,s){return null==t||null==e?this.isStroked=!1:(void 0===s&&(s=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=s),this}},W=function(t,e,s){for(var i=t,r=s,h=0,a=e.length;h<a;h++){var n=e[h];if(!i||"object"!=typeof i&&"function"!=typeof i||!(n in i))return z.found=!1,z;i=r=i[n]}return z.found=!0,z.value=r,z},z={},U={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var s=t;for(t in s)this.data[t]=s[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,s,i){var r=t&&("object"==typeof t||"function"==typeof t),h=i&&("object"==typeof i||"function"==typeof i);if(!r&&!h)return s;var a=String(e);if(r&&a in t)return t[a];if(h&&a in i)return i[a];if(-1===a.indexOf("."))return s;var n=a.split(".");if(r){var o=W(t,n,s);if(o.found)return o.value}if(h){var l=W(i,n,s);if(l.found)return l.value}return s}(this.data,t,e)},incData(t,e,s){return void 0===s&&(s=0),this.enableData(),this.setData(t,this.getData(t,s)+e),this},mulData(t,e,s){return void 0===s&&(s=0),this.enableData(),this.setData(t,this.getData(t,s)*e),this},clearData(){return this.data&&i(this.data),this}};class I{constructor(){this.name=void 0,this.dirty=!0,this.visible=!0,this.data=void 0,this.isFilled=!1,this.fillColor=void 0,this.fillAlpha=1,this.isStroked=!1,this.lineWidth=1,this.strokeColor=void 0,this.strokeAlpha=1}setName(t){return this.name=t,this}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}reset(){return this.setVisible().fillStyle().lineStyle(),this}webglRender(t,e,s,i,r){}canvasRender(t,e,s){}updateData(){this.dirty=!1}}Object.assign(I.prototype,N,U);var X=Phaser.Renderer.WebGL.Utils,Y=Phaser.Renderer.WebGL.Utils;const B=1e-6,J=10,K=.5;var q=function(t,e){return function(t){if(!Array.isArray(t))return null;for(var e=[],s=0,i=t.length;s<i;s++){var r=Number(t[s]);isFinite(r)&&r>0&&e.push(r)}return e.length>0?e:null}(t)||function(t,e){var{segments:s=J,drawRatio:i=K}=t;if(s=Math.round(s),!isFinite(s)||s<=0)return null;if(!(e>B))return null;var r=e/s;if(!(r>B))return null;if((i=Math.max(0,Math.min(1,i)))>=.999999)return null;var h=r*i;h<=B&&(h=B);var a=r-h;return a<=B?null:[h,a]}(t,e)},H=function(t,e,s){if(t&&!(t.length<4)){var i=t.length-1;if(e||(i-=2),!(i<2))for(var r=t[0],h=t[1],a=2;a<i;a+=2){var n=t[a],o=t[a+1];s(r,h,n,o),r=n,h=o}}},Q=function(t,e,s){void 0===e&&(e={}),void 0===s&&(s={});var{closePath:i=!1,dashPattern:r,dashOffset:h=0}=e,a=function(t,e){var s=0;return H(t,e,(function(t,e,i,r){var h=i-t,a=r-e;s+=Math.sqrt(h*h+a*a)})),s}(t,i);if(null===(r=q(r,a)))return null;for(var n=[],o=[],l=0,u=0,d=r.length;u<d;u++)l+=r[u];if(l<=B)return s.strokePathData=t?t.slice():[],s.strokePathMask=void 0,s;for(var p=0,c=!0,v=r[p],y=function(){p=(p+1)%r.length,c=!c,v=r[p]},g=function(t,e){return isFinite(t)||(t=0),(t%=e)<0&&(t+=e),t}(h,l);g>B;)g<v-B?(v-=g,g=0):(g-=v,y());var f=function(t,e,s,i,r){if(0===n.length)n.push(t,e);else{var h=n[n.length-2],a=n[n.length-1];h===t&&a===e||n.push(t,e)}n.push(s,i),o.push(r?1:0)};return H(t,i,(function(t,e,s,i){var r=s-t,h=i-e,a=Math.sqrt(r*r+h*h);if(!(a<=B))for(var n=0;n<a-B;){var o=Math.min(v,a-n);if(o<=B)y();else{var l=n/a,u=(n+o)/a;f(t+r*l,e+h*l,t+r*u,e+h*u,c),n+=o,(v-=o)<=B&&y()}}})),!i&&n.length>=2&&n.push(n[n.length-2],n[n.length-1]),s.strokePathData=n,s.strokePathMask=o,s},Z={setDashPattern:function(t,e){return this.dashPattern=t,this.dashOffset=e||0,this.isDashed=!!t,this},clearDashPattern:function(){return this.setDashPattern(),this},setDashed:function(t){return void 0===t&&(t=!0),this.isDashed=t,this}},$={buildStrokePath:function(){if(this.isDashed){var t=Q(this.pathData,{closePath:this.closePath,dashPattern:this.dashPattern,dashOffset:this.dashOffset},this);t?(this.strokePathData=t.strokePathData,this.strokePathMask=t.strokePathMask):this.isDashed=!1}return this}};Object.assign($,Z);const tt=Phaser.Geom.Polygon.Earcut;class et extends I{constructor(){super(),this.pathData=[],this.isDashed=!1,this.strokePathData=void 0,this.strokePathMask=void 0,this.dashPattern=void 0,this.dashOffset=0,this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=tt(this.pathData),super.updateData(),this.buildStrokePath(),this}webglRender(t,e,s,i,r){this.isFilled&&function(t,e,s,i,r,h){for(var a=X.getTintAppendFloatAlpha(s.fillColor,s.fillAlpha*i),n=s.pathData,o=s.pathIndexes,l=0;l<o.length;l+=3){var u=2*o[l],d=2*o[l+1],p=2*o[l+2],c=n[u+0]-r,v=n[u+1]-h,y=n[d+0]-r,g=n[d+1]-h,f=n[p+0]-r,m=n[p+1]-h,D=e.getX(c,v),k=e.getY(c,v),_=e.getX(y,g),P=e.getY(y,g),S=e.getX(f,m),E=e.getY(f,m);t.batchTri(s,D,k,_,P,S,E,0,0,1,1,a,a,a,2)}}(t,e,this,s,i,r),this.isStroked&&function(t,e,s,i,r){var h=t.strokeTint,a=Y.getTintAppendFloatAlpha(e.strokeColor,e.strokeAlpha*s);h.TL=a,h.TR=a,h.BL=a,h.BR=a;var n,o,l=e.isDashed&&!!e.strokePathData,u=l?e.strokePathData:e.pathData,d=u.length-1,p=e.lineWidth,c=p/2,v=u[0]-i,y=u[1]-r;if(e.closePath||(d-=2),l){var g=e.strokePathMask,f=0,m=0;for(D=2;D<d;D+=2)n=u[D]-i,o=u[D+1]-r,g[f]?(t.batchLine(v,y,n,o,c,c,p,m,!1),m++):m=0,v=n,y=o,f++}else for(var D=2;D<d;D+=2)n=u[D]-i,o=u[D+1]-r,t.batchLine(v,y,n,o,c,c,p,D-2,!!e.closePath&&D===d-1),v=n,y=o}(t,this,s,i,r)}canvasRender(t,e,s){this.isFilled&&function(t,e,s,i){var r=e.pathData;if(r&&!(r.length<4)){var h=r.length-1,a=r[0]-s,n=r[1]-i;t.beginPath(),t.moveTo(a,n),e.closePath||(h-=2);for(var o=2;o<h;o+=2){var l=r[o]-s,u=r[o+1]-i;t.lineTo(l,u)}e.closePath&&t.closePath(),function(t,e,s,i){var r=e.fillColor,h=i||e.fillAlpha,a=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+n+","+o+","+h+")"}(t,e),t.fill()}}(t,this,e,s),this.isStroked&&function(t,e,s,i){var r=e.isDashed&&!!e.strokePathData,h=r?e.strokePathData:e.pathData;if(h&&!(h.length<4)){var a=h.length-1,n=h[0]-s,o=h[1]-i;if(function(t,e,s,i){var r=e.strokeColor,h=i||e.strokeAlpha,a=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+n+","+o+","+h+")",t.lineWidth=e.lineWidth}(t,e),t.beginPath(),e.closePath||(a-=2),r){var l=e.strokePathMask,u=0;for(d=2;d<a;d+=2)p=h[d]-s,c=h[d+1]-i,l[u]&&(t.moveTo(n,o),t.lineTo(p,c)),n=p,o=c,u++}else{t.moveTo(n,o);for(var d=2;d<a;d+=2){var p=h[d]-s,c=h[d+1]-i;t.lineTo(p,c)}e.closePath&&t.closePath()}t.stroke()}}(t,this,e,s)}}Object.assign(et.prototype,$);class st extends et{constructor(t,e,s,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===s&&(s=0),void 0===i&&(i=0),super(),this.setP0(t,e),this.setP1(s,i)}get x0(){return this._x0}set x0(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}get y0(){return this._y0}set y0(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}setP0(t,e){return this.x0=t,this.y0=e,this}get x1(){return this._x1}set x1(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}get y1(){return this._y1}set y1(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}setP1(t,e){return this.x1=t,this.y1=e,this}updateData(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x0,this.y0),super.updateData(),this}}var it=function(t,e){return void 0===e&&(e=.5),t<=e?t/=e:t=1-(t-e)/(1-e),t};const rt=Phaser.Math.Linear,ht=Phaser.Math.Easing.Expo.In;var at={buildShapes(){for(var t=0;t<5;t++){var e=new st;this.addShape(e);var s=it(t/4)/2;e.setData("offset",s)}},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=t-s,r=2*s,h=this.getShapes(),a=h.length,n=2*s/a,o=.7*n,l=0;l<a;l++){var u=h[l],d=(this.value+u.getData("offset"))%1;d=ht(it(d));var p=rt(.4,1,d)*r,c=i+n*(l+.5);u.lineStyle(o,this.color,1).setP0(c,e-p/2).setP1(c,e+p/2)}}};class nt extends G{constructor(t,e){super(t,e),this.type="rexSpinnerBars"}}return Object.assign(nt.prototype,at),nt},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexbarsspinner=e();