@eva/plugin-transition 1.2.7-editor.7 → 1.2.8-fix.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{};var _EVA_IIFE_transition=function(t,e){"use strict";var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},i(t,e)};function n(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var r,o={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}},Back:{In:function(t){var e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-o.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*o.Bounce.In(2*t):.5*o.Bounce.Out(2*t-1)+.5}}},s="undefined"==typeof self&&"undefined"!=typeof process&&process.hrtime?function(){var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:"undefined"!=typeof self&&void 0!==self.performance&&void 0!==self.performance.now?self.performance.now.bind(self.performance):void 0!==Date.now?Date.now:function(){return(new Date).getTime()},a=function(){function t(){this._tweens={},this._tweensAddedDuringUpdate={}}return t.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map((function(e){return t._tweens[e]}))},t.prototype.removeAll=function(){this._tweens={}},t.prototype.add=function(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},t.prototype.remove=function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},t.prototype.update=function(t,e){void 0===t&&(t=s()),void 0===e&&(e=!1);var i=Object.keys(this._tweens);if(0===i.length)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var n=0;n<i.length;n++){var r=this._tweens[i[n]],o=!e;r&&!1===r.update(t,o)&&!e&&delete this._tweens[i[n]]}i=Object.keys(this._tweensAddedDuringUpdate)}return!0},t}(),u={Linear:function(t,e){var i=t.length-1,n=i*e,r=Math.floor(n),o=u.Utils.Linear;return e<0?o(t[0],t[1],n):e>1?o(t[i],t[i-1],i-n):o(t[r],t[r+1>i?i:r+1],n-r)},Bezier:function(t,e){for(var i=0,n=t.length-1,r=Math.pow,o=u.Utils.Bernstein,s=0;s<=n;s++)i+=r(1-e,n-s)*r(e,s)*t[s]*o(n,s);return i},CatmullRom:function(t,e){var i=t.length-1,n=i*e,r=Math.floor(n),o=u.Utils.CatmullRom;return t[0]===t[i]?(e<0&&(r=Math.floor(n=i*(1+e))),o(t[(r-1+i)%i],t[r],t[(r+1)%i],t[(r+2)%i],n-r)):e<0?t[0]-(o(t[0],t[0],t[1],t[1],-n)-t[0]):e>1?t[i]-(o(t[i],t[i],t[i-1],t[i-1],n-i)-t[i]):o(t[r?r-1:0],t[r],t[i<r+1?i:r+1],t[i<r+2?i:r+2],n-r)},Utils:{Linear:function(t,e,i){return(e-t)*i+t},Bernstein:function(t,e){var i=u.Utils.Factorial;return i(t)/i(e)/i(t-e)},Factorial:(r=[1],function(t){var e=1;if(r[t])return r[t];for(var i=t;i>1;i--)e*=i;return r[t]=e,e}),CatmullRom:function(t,e,i,n,r){var o=.5*(i-t),s=.5*(n-e),a=r*r;return(2*e-2*i+o+s)*(r*a)+(-3*e+3*i-2*o-s)*a+o*r+e}}},h=function(){function t(){}return t.nextId=function(){return t._nextId++},t._nextId=0,t}(),p=new a,c=function(){function t(t,e){void 0===e&&(e=p),this._object=t,this._group=e,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=o.Linear.None,this._interpolationFunction=u.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=h.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return t.prototype.getId=function(){return this._id},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isPaused=function(){return this._isPaused},t.prototype.to=function(t,e){return this._valuesEnd=Object.create(t),void 0!==e&&(this._duration=e),this},t.prototype.duration=function(t){return this._duration=t,this},t.prototype.start=function(t){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var e in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(e),this._valuesStart[e]=this._valuesStartRepeat[e];return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=void 0!==t?"string"==typeof t?s()+parseFloat(t):t:s(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},t.prototype._setupProperties=function(t,e,i,n){for(var r in i){var o=t[r],s=Array.isArray(o),a=s?"array":typeof o,u=!s&&Array.isArray(i[r]);if("undefined"!==a&&"function"!==a){if(u){var h=i[r];if(0===h.length)continue;h=h.map(this._handleRelativeValue.bind(this,o)),i[r]=[o].concat(h)}if("object"!==a&&!s||!o||u)void 0===e[r]&&(e[r]=o),s||(e[r]*=1),n[r]=u?i[r].slice().reverse():e[r]||0;else{for(var p in e[r]=s?[]:{},o)e[r][p]=o[p];n[r]=s?[]:{},this._setupProperties(o,e[r],i[r],n[r])}}}},t.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},t.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},t.prototype.pause=function(t){return void 0===t&&(t=s()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=t,this._group&&this._group.remove(this)),this},t.prototype.resume=function(t){return void 0===t&&(t=s()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},t.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},t.prototype.group=function(t){return this._group=t,this},t.prototype.delay=function(t){return this._delayTime=t,this},t.prototype.repeat=function(t){return this._initialRepeat=t,this._repeat=t,this},t.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},t.prototype.yoyo=function(t){return this._yoyo=t,this},t.prototype.easing=function(t){return this._easingFunction=t,this},t.prototype.interpolation=function(t){return this._interpolationFunction=t,this},t.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},t.prototype.onStart=function(t){return this._onStartCallback=t,this},t.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},t.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},t.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},t.prototype.onStop=function(t){return this._onStopCallback=t,this},t.prototype.update=function(t,e){if(void 0===t&&(t=s()),void 0===e&&(e=!0),this._isPaused)return!0;var i,n,r=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(t>r)return!1;e&&this.start(t)}if(this._goToEnd=!1,t<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),n=(t-this._startTime)/this._duration,n=0===this._duration||n>1?1:n;var o=this._easingFunction(n);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,o),this._onUpdateCallback&&this._onUpdateCallback(this._object,n),1===n){if(this._repeat>0){for(i in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[i]||(this._valuesStartRepeat[i]=this._valuesStartRepeat[i]+parseFloat(this._valuesEnd[i])),this._yoyo&&this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i];return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=t+this._repeatDelayTime:this._startTime=t+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var a=0,u=this._chainedTweens.length;a<u;a++)this._chainedTweens[a].start(this._startTime+this._duration);return this._isPlaying=!1,!1}return!0},t.prototype._updateProperties=function(t,e,i,n){for(var r in i)if(void 0!==e[r]){var o=e[r]||0,s=i[r],a=Array.isArray(t[r]),u=Array.isArray(s);!a&&u?t[r]=this._interpolationFunction(s,n):"object"==typeof s&&s?this._updateProperties(t[r],o,s,n):"number"==typeof(s=this._handleRelativeValue(o,s))&&(t[r]=o+(s-o)*n)}},t.prototype._handleRelativeValue=function(t,e){return"string"!=typeof e?e:"+"===e.charAt(0)||"-"===e.charAt(0)?t+parseFloat(e):parseFloat(e)},t.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],i=this._valuesEnd[t];this._valuesStartRepeat[t]="string"==typeof i?this._valuesStartRepeat[t]+parseFloat(i):this._valuesEnd[t],this._valuesEnd[t]=e},t}(),l=p;l.getAll.bind(l),l.removeAll.bind(l),l.add.bind(l),l.remove.bind(l),l.update.bind(l);var f={linear:o.Linear.None,"ease-in":o.Quadratic.In,"ease-out":o.Quadratic.Out,"ease-in-out":o.Quadratic.InOut,"bounce-in":o.Bounce.In,"bounce-out":o.Bounce.Out,"bounce-in-out":o.Bounce.InOut,none:function(t){return~~t}},_=function(){function t(t,e){this.tweens=[],this.timelines=[],this.finishCount=0,this.callbacks=new Map,this.objectCache={},this.currIteration=0,this.timelines=t,this.tweenGroup=e}return t.prototype.on=function(t,e){this.callbacks[t]||this.callbacks.set(t,[]),this.callbacks.get(t).push(e)},t.prototype.emit=function(t){var e=this.callbacks.get(t);e&&e.length&&e.forEach((function(t){return t()}))},t.prototype.checkFinish=function(){if(++this.finishCount==this.tweens.length)if(++this.currIteration==this.iteration)this.emit("finish");else{if(this.stoped)return;this.start()}},t.prototype.getObjectCache=function(t,e){var i=""+t.gameObject.id+t.name;if(this.objectCache[i]||(this.objectCache[i]={}),this.objectCache[i][e])return this.objectCache[i][e];for(var n=e.split("."),r=n.length-1,o=t,s=0;s<r;s++)o=o[n[s]];return this.objectCache[i][e]={property:o,key:n[r]},this.objectCache[i][e]},t.prototype.doAnim=function(t){var e=t.component,i=t.name,n=t.value,r=this.getObjectCache(e,i);r.property[r.key]=n},t.prototype.init=function(){var t,e=this;this.checkFinishFunc=this.checkFinish.bind(this),this.timelines.forEach((function(i,n){for(var r=0;r<i.values.length-1;r++){var o=i.values[r],s=i.values[r+1],a=new c({value:o.value},e.tweenGroup).to({value:s.value}).duration(s.time-o.time).easing(f[o.tween]).onUpdate((function(t){e.doAnim({component:i.component,name:i.name,value:t.value})}));0===r?e.tweens[n]=a:t.chain(a),t=a}t&&t.onComplete((function(){return e.checkFinishFunc()}))}))},t.prototype.play=function(t,e){void 0===t&&(t=1),this.currentTime=e,this.stoped=!1,this.start(),this.currIteration=0,this.iteration=t},t.prototype.start=function(){var t=this;this.finishCount=0,this.tweens.length=0,this.init(),this.tweens.forEach((function(e){return e.start(t.currentTime)}))},t.prototype.pause=function(){var t=this;this.tweens.forEach((function(e){return e.pause(t.currentTime)}))},t.prototype.resume=function(){var t=this;this.tweens.forEach((function(e){return e.resume(t.currentTime)}))},t.prototype.stop=function(){this.stoped=!0,this.tweens.forEach((function(t){return t.stop()}))},t.prototype.destroy=function(){this.stop(),this.tweens=null,this.timelines=null,this.objectCache=null,this.callbacks.clear(),this.callbacks=null},t}(),d=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.animations={},e.group={},e.currentTime=0,e.needPlay=[],e}return n(e,t),e.prototype.init=function(t){var e=(void 0===t?{group:{}}:t).group;this.group=e,this.tweenGroup=new a},e.prototype.awake=function(){for(var t in this.group)this.newAnimation(t)},e.prototype.play=function(t,e){t||(t=Object.keys(this.group)[0]),t&&!this.animations[t]&&this.group[t]&&this.newAnimation(t),t&&this.animations[t]&&this.needPlay.push({name:t,iteration:e})},e.prototype.stop=function(t){var e,i;if(t)null===(i=this.animations[t])||void 0===i||i.stop();else for(var n in this.animations)null===(e=this.animations[n])||void 0===e||e.stop()},e.prototype.onPause=function(){var t;for(var e in this.animations)null===(t=this.animations[e])||void 0===t||t.pause()},e.prototype.onResume=function(){var t;for(var e in this.animations)null===(t=this.animations[e])||void 0===t||t.resume()},e.prototype.onDestroy=function(){var t;for(var e in this.animations)null===(t=this.animations[e])||void 0===t||t.destroy();this.tweenGroup.removeAll(),this.tweenGroup=null,this.group=null,this.animations=null,this.removeAllListeners()},e.prototype.update=function(t){var e,i,n;for(var r in this.currentTime=t.time,this.animations)this.animations[r].currentTime=t.time;this.tweenGroup.update(t.time);try{for(var o=function(t){var e="function"==typeof Symbol&&Symbol.iterator,i=e&&t[e],n=0;if(i)return i.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(this.needPlay),s=o.next();!s.done;s=o.next()){var a=s.value;null===(n=this.animations[a.name])||void 0===n||n.play(a.iteration,this.currentTime)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}this.needPlay.length=0},e.prototype.newAnimation=function(t){var e=this,i=new _(this.group[t],this.tweenGroup);i.on("finish",(function(){return e.emit("finish",t)})),this.animations[t]=i},e.componentName="Transition",e}(e.Component),y=d,v=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="transition",e}return n(e,t),e.systemName="transition",e}(e.System),m=v;return t.Transition=y,t.TransitionSystem=m,Object.defineProperty(t,"__esModule",{value:!0}),t}({},EVA);window.EVA.plugin.transition=window.EVA.plugin.transition||_EVA_IIFE_transition;
1
+ window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{};var _EVA_IIFE_transition=function(t,e){"use strict";var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)};function n(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var r,o={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}},Back:{In:function(t){var e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-o.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*o.Bounce.In(2*t):.5*o.Bounce.Out(2*t-1)+.5}}},s="undefined"==typeof self&&"undefined"!=typeof process&&process.hrtime?function(){var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:"undefined"!=typeof self&&void 0!==self.performance&&void 0!==self.performance.now?self.performance.now.bind(self.performance):void 0!==Date.now?Date.now:function(){return(new Date).getTime()},a=function(){function t(){this._tweens={},this._tweensAddedDuringUpdate={}}return t.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map((function(e){return t._tweens[e]}))},t.prototype.removeAll=function(){this._tweens={}},t.prototype.add=function(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},t.prototype.remove=function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},t.prototype.update=function(t,e){void 0===t&&(t=s()),void 0===e&&(e=!1);var i=Object.keys(this._tweens);if(0===i.length)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var n=0;n<i.length;n++){var r=this._tweens[i[n]],o=!e;r&&!1===r.update(t,o)&&!e&&delete this._tweens[i[n]]}i=Object.keys(this._tweensAddedDuringUpdate)}return!0},t}(),u={Linear:function(t,e){var i=t.length-1,n=i*e,r=Math.floor(n),o=u.Utils.Linear;return e<0?o(t[0],t[1],n):e>1?o(t[i],t[i-1],i-n):o(t[r],t[r+1>i?i:r+1],n-r)},Bezier:function(t,e){for(var i=0,n=t.length-1,r=Math.pow,o=u.Utils.Bernstein,s=0;s<=n;s++)i+=r(1-e,n-s)*r(e,s)*t[s]*o(n,s);return i},CatmullRom:function(t,e){var i=t.length-1,n=i*e,r=Math.floor(n),o=u.Utils.CatmullRom;return t[0]===t[i]?(e<0&&(r=Math.floor(n=i*(1+e))),o(t[(r-1+i)%i],t[r],t[(r+1)%i],t[(r+2)%i],n-r)):e<0?t[0]-(o(t[0],t[0],t[1],t[1],-n)-t[0]):e>1?t[i]-(o(t[i],t[i],t[i-1],t[i-1],n-i)-t[i]):o(t[r?r-1:0],t[r],t[i<r+1?i:r+1],t[i<r+2?i:r+2],n-r)},Utils:{Linear:function(t,e,i){return(e-t)*i+t},Bernstein:function(t,e){var i=u.Utils.Factorial;return i(t)/i(e)/i(t-e)},Factorial:(r=[1],function(t){var e=1;if(r[t])return r[t];for(var i=t;i>1;i--)e*=i;return r[t]=e,e}),CatmullRom:function(t,e,i,n,r){var o=.5*(i-t),s=.5*(n-e),a=r*r;return(2*e-2*i+o+s)*(r*a)+(-3*e+3*i-2*o-s)*a+o*r+e}}},h=function(){function t(){}return t.nextId=function(){return t._nextId++},t._nextId=0,t}(),p=new a,c=function(){function t(t,e){void 0===e&&(e=p),this._object=t,this._group=e,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=o.Linear.None,this._interpolationFunction=u.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=h.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return t.prototype.getId=function(){return this._id},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isPaused=function(){return this._isPaused},t.prototype.to=function(t,e){return this._valuesEnd=Object.create(t),void 0!==e&&(this._duration=e),this},t.prototype.duration=function(t){return this._duration=t,this},t.prototype.start=function(t){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var e in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(e),this._valuesStart[e]=this._valuesStartRepeat[e];return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=void 0!==t?"string"==typeof t?s()+parseFloat(t):t:s(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},t.prototype._setupProperties=function(t,e,i,n){for(var r in i){var o=t[r],s=Array.isArray(o),a=s?"array":typeof o,u=!s&&Array.isArray(i[r]);if("undefined"!==a&&"function"!==a){if(u){var h=i[r];if(0===h.length)continue;h=h.map(this._handleRelativeValue.bind(this,o)),i[r]=[o].concat(h)}if("object"!==a&&!s||!o||u)void 0===e[r]&&(e[r]=o),s||(e[r]*=1),n[r]=u?i[r].slice().reverse():e[r]||0;else{for(var p in e[r]=s?[]:{},o)e[r][p]=o[p];n[r]=s?[]:{},this._setupProperties(o,e[r],i[r],n[r])}}}},t.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},t.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},t.prototype.pause=function(t){return void 0===t&&(t=s()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=t,this._group&&this._group.remove(this)),this},t.prototype.resume=function(t){return void 0===t&&(t=s()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},t.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},t.prototype.group=function(t){return this._group=t,this},t.prototype.delay=function(t){return this._delayTime=t,this},t.prototype.repeat=function(t){return this._initialRepeat=t,this._repeat=t,this},t.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},t.prototype.yoyo=function(t){return this._yoyo=t,this},t.prototype.easing=function(t){return this._easingFunction=t,this},t.prototype.interpolation=function(t){return this._interpolationFunction=t,this},t.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},t.prototype.onStart=function(t){return this._onStartCallback=t,this},t.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},t.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},t.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},t.prototype.onStop=function(t){return this._onStopCallback=t,this},t.prototype.update=function(t,e){if(void 0===t&&(t=s()),void 0===e&&(e=!0),this._isPaused)return!0;var i,n,r=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(t>r)return!1;e&&this.start(t)}if(this._goToEnd=!1,t<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),n=(t-this._startTime)/this._duration,n=0===this._duration||n>1?1:n;var o=this._easingFunction(n);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,o),this._onUpdateCallback&&this._onUpdateCallback(this._object,n),1===n){if(this._repeat>0){for(i in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[i]||(this._valuesStartRepeat[i]=this._valuesStartRepeat[i]+parseFloat(this._valuesEnd[i])),this._yoyo&&this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i];return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=t+this._repeatDelayTime:this._startTime=t+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var a=0,u=this._chainedTweens.length;a<u;a++)this._chainedTweens[a].start(this._startTime+this._duration);return this._isPlaying=!1,!1}return!0},t.prototype._updateProperties=function(t,e,i,n){for(var r in i)if(void 0!==e[r]){var o=e[r]||0,s=i[r],a=Array.isArray(t[r]),u=Array.isArray(s);!a&&u?t[r]=this._interpolationFunction(s,n):"object"==typeof s&&s?this._updateProperties(t[r],o,s,n):"number"==typeof(s=this._handleRelativeValue(o,s))&&(t[r]=o+(s-o)*n)}},t.prototype._handleRelativeValue=function(t,e){return"string"!=typeof e?e:"+"===e.charAt(0)||"-"===e.charAt(0)?t+parseFloat(e):parseFloat(e)},t.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],i=this._valuesEnd[t];this._valuesStartRepeat[t]="string"==typeof i?this._valuesStartRepeat[t]+parseFloat(i):this._valuesEnd[t],this._valuesEnd[t]=e},t}(),l=p;l.getAll.bind(l),l.removeAll.bind(l),l.add.bind(l),l.remove.bind(l),l.update.bind(l);var f={linear:o.Linear.None,"ease-in":o.Quadratic.In,"ease-out":o.Quadratic.Out,"ease-in-out":o.Quadratic.InOut,"bounce-in":o.Bounce.In,"bounce-out":o.Bounce.Out,"bounce-in-out":o.Bounce.InOut,none:function(t){return~~t}},_=function(){function t(t,e){this.tweens=[],this.timelines=[],this.finishCount=0,this.callbacks=new Map,this.objectCache={},this.currIteration=0,this.timelines=t,this.tweenGroup=e}return t.prototype.on=function(t,e){this.callbacks[t]||this.callbacks.set(t,[]),this.callbacks.get(t).push(e)},t.prototype.emit=function(t){var e=this.callbacks.get(t);e&&e.length&&e.forEach((function(t){return t()}))},t.prototype.checkFinish=function(){if(++this.finishCount==this.tweens.length)if(++this.currIteration==this.iteration)this.emit("finish");else{if(this.stoped)return;this.start()}},t.prototype.getObjectCache=function(t,e){var i=""+t.gameObject.id+t.name;if(this.objectCache[i]||(this.objectCache[i]={}),this.objectCache[i][e])return this.objectCache[i][e];for(var n=e.split("."),r=n.length-1,o=t,s=0;s<r;s++)o=o[n[s]];return this.objectCache[i][e]={property:o,key:n[r]},this.objectCache[i][e]},t.prototype.doAnim=function(t){var e=t.component,i=t.name,n=t.value,r=this.getObjectCache(e,i);r.property[r.key]=n},t.prototype.init=function(){var t,e=this;this.checkFinishFunc=this.checkFinish.bind(this),this.timelines.forEach((function(i,n){for(var r=0;r<i.values.length-1;r++){var o=i.values[r],s=i.values[r+1],a=new c({value:o.value},e.tweenGroup).to({value:s.value}).duration(s.time-o.time).easing(f[o.tween]).onUpdate((function(t){e.doAnim({component:i.component,name:i.name,value:t.value})}));0===r?e.tweens[n]=a:t.chain(a),t=a}t&&t.onComplete((function(){return e.checkFinishFunc()}))}))},t.prototype.play=function(t,e){void 0===t&&(t=1),this.currentTime=e,this.stoped=!1,this.start(),this.currIteration=0,this.iteration=t},t.prototype.start=function(){var t=this;this.finishCount=0,this.tweens.length=0,this.init(),this.tweens.forEach((function(e){return e.start(t.currentTime)}))},t.prototype.pause=function(){var t=this;this.tweens.forEach((function(e){return e.pause(t.currentTime)}))},t.prototype.resume=function(){var t=this;this.tweens.forEach((function(e){return e.resume(t.currentTime)}))},t.prototype.stop=function(){this.stoped=!0,this.tweens.forEach((function(t){return t.stop()}))},t.prototype.destroy=function(){this.stop(),this.tweens=null,this.timelines=null,this.objectCache=null,this.callbacks.clear(),this.callbacks=null},t}(),d=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.animations={},e.group={},e.currentTime=0,e.needPlay=[],e}return n(e,t),e.prototype.init=function(t){var e=(void 0===t?{group:{}}:t).group;this.group=e,this.tweenGroup=new a},e.prototype.awake=function(){for(var t in this.group)this.newAnimation(t)},e.prototype.play=function(t,e){t||(t=Object.keys(this.group)[0]),t&&!this.animations[t]&&this.group[t]&&this.newAnimation(t),t&&this.animations[t]&&this.needPlay.push({name:t,iteration:e})},e.prototype.stop=function(t){var e,i;if(t)null===(i=this.animations[t])||void 0===i||i.stop();else for(var n in this.animations)null===(e=this.animations[n])||void 0===e||e.stop()},e.prototype.onPause=function(){var t;for(var e in this.animations)null===(t=this.animations[e])||void 0===t||t.pause()},e.prototype.onResume=function(){var t;for(var e in this.animations)null===(t=this.animations[e])||void 0===t||t.resume()},e.prototype.onDestroy=function(){var t;for(var e in this.animations)null===(t=this.animations[e])||void 0===t||t.destroy();this.tweenGroup.removeAll(),this.tweenGroup=null,this.group=null,this.animations=null,this.removeAllListeners()},e.prototype.update=function(t){var e,i,n;for(var r in this.currentTime=t.time,this.animations)this.animations[r].currentTime=t.time;this.tweenGroup.update(t.time);try{for(var o=function(t){var e="function"==typeof Symbol&&Symbol.iterator,i=e&&t[e],n=0;if(i)return i.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(this.needPlay),s=o.next();!s.done;s=o.next()){var a=s.value;null===(n=this.animations[a.name])||void 0===n||n.play(a.iteration,this.currentTime)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}this.needPlay.length=0},e.prototype.newAnimation=function(t){var e=this,i=new _(this.group[t],this.tweenGroup);i.on("finish",(function(){return e.emit("finish",t)})),this.animations[t]=i},e.componentName="Transition",e}(e.Component),y=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="transition",e}return n(e,t),e.systemName="transition",e}(e.System);return t.Transition=d,t.TransitionSystem=y,Object.defineProperty(t,"__esModule",{value:!0}),t}({},EVA);window.EVA.plugin.transition=window.EVA.plugin.transition||_EVA_IIFE_transition;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@tweenjs/tween.js"),n=require("@eva/eva.js"),i=function(t,n){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},i(t,n)};function e(t,n){function e(){this.constructor=t}i(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}var o={linear:t.Easing.Linear.None,"ease-in":t.Easing.Quadratic.In,"ease-out":t.Easing.Quadratic.Out,"ease-in-out":t.Easing.Quadratic.InOut,"bounce-in":t.Easing.Bounce.In,"bounce-out":t.Easing.Bounce.Out,"bounce-in-out":t.Easing.Bounce.InOut,none:function(t){return~~t}},r=function(){function n(t,n){this.tweens=[],this.timelines=[],this.finishCount=0,this.callbacks=new Map,this.objectCache={},this.currIteration=0,this.timelines=t,this.tweenGroup=n}return n.prototype.on=function(t,n){this.callbacks[t]||this.callbacks.set(t,[]),this.callbacks.get(t).push(n)},n.prototype.emit=function(t){var n=this.callbacks.get(t);n&&n.length&&n.forEach((function(t){return t()}))},n.prototype.checkFinish=function(){if(++this.finishCount==this.tweens.length)if(++this.currIteration==this.iteration)this.emit("finish");else{if(this.stoped)return;this.start()}},n.prototype.getObjectCache=function(t,n){var i=""+t.gameObject.id+t.name;if(this.objectCache[i]||(this.objectCache[i]={}),this.objectCache[i][n])return this.objectCache[i][n];for(var e=n.split("."),o=e.length-1,r=t,s=0;s<o;s++)r=r[e[s]];return this.objectCache[i][n]={property:r,key:e[o]},this.objectCache[i][n]},n.prototype.doAnim=function(t){var n=t.component,i=t.name,e=t.value,o=this.getObjectCache(n,i);o.property[o.key]=e},n.prototype.init=function(){var n,i=this;this.checkFinishFunc=this.checkFinish.bind(this),this.timelines.forEach((function(e,r){for(var s=0;s<e.values.length-1;s++){var a=e.values[s],u=e.values[s+1],h=new t.Tween({value:a.value},i.tweenGroup).to({value:u.value}).duration(u.time-a.time).easing(o[a.tween]).onUpdate((function(t){i.doAnim({component:e.component,name:e.name,value:t.value})}));0===s?i.tweens[r]=h:n.chain(h),n=h}n&&n.onComplete((function(){return i.checkFinishFunc()}))}))},n.prototype.play=function(t,n){void 0===t&&(t=1),this.currentTime=n,this.stoped=!1,this.start(),this.currIteration=0,this.iteration=t},n.prototype.start=function(){var t=this;this.finishCount=0,this.tweens.length=0,this.init(),this.tweens.forEach((function(n){return n.start(t.currentTime)}))},n.prototype.pause=function(){var t=this;this.tweens.forEach((function(n){return n.pause(t.currentTime)}))},n.prototype.resume=function(){var t=this;this.tweens.forEach((function(n){return n.resume(t.currentTime)}))},n.prototype.stop=function(){this.stoped=!0,this.tweens.forEach((function(t){return t.stop()}))},n.prototype.destroy=function(){this.stop(),this.tweens=null,this.timelines=null,this.objectCache=null,this.callbacks.clear(),this.callbacks=null},n}(),s=function(n){function i(){var t=null!==n&&n.apply(this,arguments)||this;return t.animations={},t.group={},t.currentTime=0,t.needPlay=[],t}return e(i,n),i.prototype.init=function(n){var i=(void 0===n?{group:{}}:n).group;this.group=i,this.tweenGroup=new t.Group},i.prototype.awake=function(){for(var t in this.group)this.newAnimation(t)},i.prototype.play=function(t,n){t||(t=Object.keys(this.group)[0]),t&&!this.animations[t]&&this.group[t]&&this.newAnimation(t),t&&this.animations[t]&&this.needPlay.push({name:t,iteration:n})},i.prototype.stop=function(t){var n,i;if(t)null===(i=this.animations[t])||void 0===i||i.stop();else for(var e in this.animations)null===(n=this.animations[e])||void 0===n||n.stop()},i.prototype.onPause=function(){var t;for(var n in this.animations)null===(t=this.animations[n])||void 0===t||t.pause()},i.prototype.onResume=function(){var t;for(var n in this.animations)null===(t=this.animations[n])||void 0===t||t.resume()},i.prototype.onDestroy=function(){var t;for(var n in this.animations)null===(t=this.animations[n])||void 0===t||t.destroy();this.tweenGroup.removeAll(),this.tweenGroup=null,this.group=null,this.animations=null,this.removeAllListeners()},i.prototype.update=function(t){var n,i,e;for(var o in this.currentTime=t.time,this.animations)this.animations[o].currentTime=t.time;this.tweenGroup.update(t.time);try{for(var r=function(t){var n="function"==typeof Symbol&&t[Symbol.iterator],i=0;return n?n.call(t):{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}}}(this.needPlay),s=r.next();!s.done;s=r.next()){var a=s.value;null===(e=this.animations[a.name])||void 0===e||e.play(a.iteration,this.currentTime)}}catch(t){n={error:t}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}this.needPlay.length=0},i.prototype.newAnimation=function(t){var n=this,i=new r(this.group[t],this.tweenGroup);i.on("finish",(function(){return n.emit("finish",t)})),this.animations[t]=i},i.componentName="Transition",i}(n.Component),a=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.name="transition",n}return e(n,t),n.systemName="transition",n}(n.System);exports.Transition=s,exports.TransitionSystem=a;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@tweenjs/tween.js"),n=require("@eva/eva.js"),i=function(t,n){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])})(t,n)};function e(t,n){function e(){this.constructor=t}i(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}var o={linear:t.Easing.Linear.None,"ease-in":t.Easing.Quadratic.In,"ease-out":t.Easing.Quadratic.Out,"ease-in-out":t.Easing.Quadratic.InOut,"bounce-in":t.Easing.Bounce.In,"bounce-out":t.Easing.Bounce.Out,"bounce-in-out":t.Easing.Bounce.InOut,none:function(t){return~~t}},r=function(){function n(t,n){this.tweens=[],this.timelines=[],this.finishCount=0,this.callbacks=new Map,this.objectCache={},this.currIteration=0,this.timelines=t,this.tweenGroup=n}return n.prototype.on=function(t,n){this.callbacks[t]||this.callbacks.set(t,[]),this.callbacks.get(t).push(n)},n.prototype.emit=function(t){var n=this.callbacks.get(t);n&&n.length&&n.forEach((function(t){return t()}))},n.prototype.checkFinish=function(){if(++this.finishCount==this.tweens.length)if(++this.currIteration==this.iteration)this.emit("finish");else{if(this.stoped)return;this.start()}},n.prototype.getObjectCache=function(t,n){var i=""+t.gameObject.id+t.name;if(this.objectCache[i]||(this.objectCache[i]={}),this.objectCache[i][n])return this.objectCache[i][n];for(var e=n.split("."),o=e.length-1,r=t,s=0;s<o;s++)r=r[e[s]];return this.objectCache[i][n]={property:r,key:e[o]},this.objectCache[i][n]},n.prototype.doAnim=function(t){var n=t.component,i=t.name,e=t.value,o=this.getObjectCache(n,i);o.property[o.key]=e},n.prototype.init=function(){var n,i=this;this.checkFinishFunc=this.checkFinish.bind(this),this.timelines.forEach((function(e,r){for(var s=0;s<e.values.length-1;s++){var a=e.values[s],u=e.values[s+1],h=new t.Tween({value:a.value},i.tweenGroup).to({value:u.value}).duration(u.time-a.time).easing(o[a.tween]).onUpdate((function(t){i.doAnim({component:e.component,name:e.name,value:t.value})}));0===s?i.tweens[r]=h:n.chain(h),n=h}n&&n.onComplete((function(){return i.checkFinishFunc()}))}))},n.prototype.play=function(t,n){void 0===t&&(t=1),this.currentTime=n,this.stoped=!1,this.start(),this.currIteration=0,this.iteration=t},n.prototype.start=function(){var t=this;this.finishCount=0,this.tweens.length=0,this.init(),this.tweens.forEach((function(n){return n.start(t.currentTime)}))},n.prototype.pause=function(){var t=this;this.tweens.forEach((function(n){return n.pause(t.currentTime)}))},n.prototype.resume=function(){var t=this;this.tweens.forEach((function(n){return n.resume(t.currentTime)}))},n.prototype.stop=function(){this.stoped=!0,this.tweens.forEach((function(t){return t.stop()}))},n.prototype.destroy=function(){this.stop(),this.tweens=null,this.timelines=null,this.objectCache=null,this.callbacks.clear(),this.callbacks=null},n}(),s=function(n){function i(){var t=null!==n&&n.apply(this,arguments)||this;return t.animations={},t.group={},t.currentTime=0,t.needPlay=[],t}return e(i,n),i.prototype.init=function(n){var i=(void 0===n?{group:{}}:n).group;this.group=i,this.tweenGroup=new t.Group},i.prototype.awake=function(){for(var t in this.group)this.newAnimation(t)},i.prototype.play=function(t,n){t||(t=Object.keys(this.group)[0]),t&&!this.animations[t]&&this.group[t]&&this.newAnimation(t),t&&this.animations[t]&&this.needPlay.push({name:t,iteration:n})},i.prototype.stop=function(t){var n,i;if(t)null===(i=this.animations[t])||void 0===i||i.stop();else for(var e in this.animations)null===(n=this.animations[e])||void 0===n||n.stop()},i.prototype.onPause=function(){var t;for(var n in this.animations)null===(t=this.animations[n])||void 0===t||t.pause()},i.prototype.onResume=function(){var t;for(var n in this.animations)null===(t=this.animations[n])||void 0===t||t.resume()},i.prototype.onDestroy=function(){var t;for(var n in this.animations)null===(t=this.animations[n])||void 0===t||t.destroy();this.tweenGroup.removeAll(),this.tweenGroup=null,this.group=null,this.animations=null,this.removeAllListeners()},i.prototype.update=function(t){var n,i,e;for(var o in this.currentTime=t.time,this.animations)this.animations[o].currentTime=t.time;this.tweenGroup.update(t.time);try{for(var r=function(t){var n="function"==typeof Symbol&&t[Symbol.iterator],i=0;return n?n.call(t):{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}}}(this.needPlay),s=r.next();!s.done;s=r.next()){var a=s.value;null===(e=this.animations[a.name])||void 0===e||e.play(a.iteration,this.currentTime)}}catch(t){n={error:t}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}this.needPlay.length=0},i.prototype.newAnimation=function(t){var n=this,i=new r(this.group[t],this.tweenGroup);i.on("finish",(function(){return n.emit("finish",t)})),this.animations[t]=i},i.componentName="Transition",i}(n.Component),a=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.name="transition",n}return e(n,t),n.systemName="transition",n}(n.System);exports.Transition=s,exports.TransitionSystem=a;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eva/plugin-transition",
3
- "version": "1.2.7-editor.7",
3
+ "version": "1.2.8-fix.1",
4
4
  "description": "@eva/plugin-transition",
5
5
  "main": "index.js",
6
6
  "module": "dist/plugin-transition.esm.js",
@@ -18,7 +18,7 @@
18
18
  "license": "MIT",
19
19
  "homepage": "https://eva.js.org",
20
20
  "dependencies": {
21
- "@eva/eva.js": "1.2.7-editor.7",
21
+ "@eva/eva.js": "1.2.8-fix.1",
22
22
  "@tweenjs/tween.js": "^18.6.4",
23
23
  "sprite-timeline": "^1.10.2"
24
24
  }
@@ -1,340 +0,0 @@
1
- import { __extends, __values } from 'tslib';
2
- import { Easing, Tween, Group } from '@tweenjs/tween.js';
3
- import { Component, System } from '@eva/eva.js/dist/miniprogram';
4
- var easingMap = {
5
- linear: Easing.Linear.None,
6
- 'ease-in': Easing.Quadratic.In,
7
- 'ease-out': Easing.Quadratic.Out,
8
- 'ease-in-out': Easing.Quadratic.InOut,
9
- 'bounce-in': Easing.Bounce.In,
10
- 'bounce-out': Easing.Bounce.Out,
11
- 'bounce-in-out': Easing.Bounce.InOut,
12
- none: function none(p) {
13
- return ~~p;
14
- }
15
- };
16
-
17
- var Animation = function () {
18
- function Animation(timelines, tweenGroup) {
19
- this.tweens = [];
20
- this.timelines = [];
21
- this.finishCount = 0;
22
- this.callbacks = new Map();
23
- this.objectCache = {};
24
- this.currIteration = 0;
25
- this.timelines = timelines;
26
- this.tweenGroup = tweenGroup;
27
- }
28
-
29
- Animation.prototype.on = function (eventName, callback) {
30
- if (!this.callbacks[eventName]) {
31
- this.callbacks.set(eventName, []);
32
- }
33
-
34
- this.callbacks.get(eventName).push(callback);
35
- };
36
-
37
- Animation.prototype.emit = function (eventName) {
38
- var callbacks = this.callbacks.get(eventName);
39
- if (!callbacks || !callbacks.length) return;
40
- callbacks.forEach(function (fn) {
41
- return fn();
42
- });
43
- };
44
-
45
- Animation.prototype.checkFinish = function () {
46
- if (++this.finishCount == this.tweens.length) {
47
- if (++this.currIteration == this.iteration) {
48
- this.emit('finish');
49
- } else {
50
- if (this.stoped) return;
51
- this.start();
52
- }
53
- }
54
- };
55
-
56
- Animation.prototype.getObjectCache = function (component, name) {
57
- var key = "" + component.gameObject.id + component.name;
58
-
59
- if (!this.objectCache[key]) {
60
- this.objectCache[key] = {};
61
- }
62
-
63
- if (this.objectCache[key][name]) {
64
- return this.objectCache[key][name];
65
- }
66
-
67
- var keys = name.split('.');
68
- var keyIndex = keys.length - 1;
69
- var property = component;
70
-
71
- for (var i = 0; i < keyIndex; i++) {
72
- property = property[keys[i]];
73
- }
74
-
75
- this.objectCache[key][name] = {
76
- property: property,
77
- key: keys[keyIndex]
78
- };
79
- return this.objectCache[key][name];
80
- };
81
-
82
- Animation.prototype.doAnim = function (_a) {
83
- var component = _a.component,
84
- name = _a.name,
85
- value = _a.value;
86
-
87
- var _b = this.getObjectCache(component, name),
88
- property = _b.property,
89
- key = _b.key;
90
-
91
- property[key] = value;
92
- };
93
-
94
- Animation.prototype.init = function () {
95
- var _this = this;
96
-
97
- this.checkFinishFunc = this.checkFinish.bind(this);
98
- var lastTween;
99
- this.timelines.forEach(function (timeline, i) {
100
- for (var j = 0; j < timeline.values.length - 1; j++) {
101
- var frame = timeline.values[j];
102
- var nextFrame = timeline.values[j + 1];
103
- var tween = new Tween({
104
- value: frame.value
105
- }, _this.tweenGroup).to({
106
- value: nextFrame.value
107
- }).duration(nextFrame.time - frame.time).easing(easingMap[frame.tween]).onUpdate(function (props) {
108
- _this.doAnim({
109
- component: timeline.component,
110
- name: timeline.name,
111
- value: props.value
112
- });
113
- });
114
-
115
- if (j === 0) {
116
- _this.tweens[i] = tween;
117
- } else {
118
- lastTween.chain(tween);
119
- }
120
-
121
- lastTween = tween;
122
- }
123
-
124
- lastTween && lastTween.onComplete(function () {
125
- return _this.checkFinishFunc();
126
- });
127
- });
128
- };
129
-
130
- Animation.prototype.play = function (iteration, currentTime) {
131
- if (iteration === void 0) {
132
- iteration = 1;
133
- }
134
-
135
- this.currentTime = currentTime;
136
- this.stoped = false;
137
- this.start();
138
- this.currIteration = 0;
139
- this.iteration = iteration;
140
- };
141
-
142
- Animation.prototype.start = function () {
143
- var _this = this;
144
-
145
- this.finishCount = 0;
146
- this.tweens.length = 0;
147
- this.init();
148
- this.tweens.forEach(function (tween) {
149
- return tween.start(_this.currentTime);
150
- });
151
- };
152
-
153
- Animation.prototype.pause = function () {
154
- var _this = this;
155
-
156
- this.tweens.forEach(function (tween) {
157
- return tween.pause(_this.currentTime);
158
- });
159
- };
160
-
161
- Animation.prototype.resume = function () {
162
- var _this = this;
163
-
164
- this.tweens.forEach(function (tween) {
165
- return tween.resume(_this.currentTime);
166
- });
167
- };
168
-
169
- Animation.prototype.stop = function () {
170
- this.stoped = true;
171
- this.tweens.forEach(function (tween) {
172
- return tween.stop();
173
- });
174
- };
175
-
176
- Animation.prototype.destroy = function () {
177
- this.stop();
178
- this.tweens = null;
179
- this.timelines = null;
180
- this.objectCache = null;
181
- this.callbacks.clear();
182
- this.callbacks = null;
183
- };
184
-
185
- return Animation;
186
- }();
187
-
188
- var Animation$1 = Animation;
189
-
190
- var Transition = function (_super) {
191
- __extends(Transition, _super);
192
-
193
- function Transition() {
194
- var _this = _super !== null && _super.apply(this, arguments) || this;
195
-
196
- _this.animations = {};
197
- _this.group = {};
198
- _this.currentTime = 0;
199
- _this.needPlay = [];
200
- return _this;
201
- }
202
-
203
- Transition.prototype.init = function (_a) {
204
- var group = (_a === void 0 ? {
205
- group: {}
206
- } : _a).group;
207
- this.group = group;
208
- this.tweenGroup = new Group();
209
- };
210
-
211
- Transition.prototype.awake = function () {
212
- for (var name_1 in this.group) {
213
- this.newAnimation(name_1);
214
- }
215
- };
216
-
217
- Transition.prototype.play = function (name, iteration) {
218
- if (!name) {
219
- name = Object.keys(this.group)[0];
220
- }
221
-
222
- if (name && !this.animations[name] && this.group[name]) {
223
- this.newAnimation(name);
224
- }
225
-
226
- if (name && this.animations[name]) {
227
- this.needPlay.push({
228
- name: name,
229
- iteration: iteration
230
- });
231
- }
232
- };
233
-
234
- Transition.prototype.stop = function (name) {
235
- var _a, _b;
236
-
237
- if (!name) {
238
- for (var key in this.animations) {
239
- (_a = this.animations[key]) === null || _a === void 0 ? void 0 : _a.stop();
240
- }
241
- } else {
242
- (_b = this.animations[name]) === null || _b === void 0 ? void 0 : _b.stop();
243
- }
244
- };
245
-
246
- Transition.prototype.onPause = function () {
247
- var _a;
248
-
249
- for (var key in this.animations) {
250
- (_a = this.animations[key]) === null || _a === void 0 ? void 0 : _a.pause();
251
- }
252
- };
253
-
254
- Transition.prototype.onResume = function () {
255
- var _a;
256
-
257
- for (var key in this.animations) {
258
- (_a = this.animations[key]) === null || _a === void 0 ? void 0 : _a.resume();
259
- }
260
- };
261
-
262
- Transition.prototype.onDestroy = function () {
263
- var _a;
264
-
265
- for (var key in this.animations) {
266
- (_a = this.animations[key]) === null || _a === void 0 ? void 0 : _a.destroy();
267
- }
268
-
269
- this.tweenGroup.removeAll();
270
- this.tweenGroup = null;
271
- this.group = null;
272
- this.animations = null;
273
- this.removeAllListeners();
274
- };
275
-
276
- Transition.prototype.update = function (e) {
277
- var e_1, _a;
278
-
279
- var _b;
280
-
281
- this.currentTime = e.time;
282
-
283
- for (var key in this.animations) {
284
- this.animations[key].currentTime = e.time;
285
- }
286
-
287
- this.tweenGroup.update(e.time);
288
-
289
- try {
290
- for (var _c = __values(this.needPlay), _d = _c.next(); !_d.done; _d = _c.next()) {
291
- var play = _d.value;
292
- (_b = this.animations[play.name]) === null || _b === void 0 ? void 0 : _b.play(play.iteration, this.currentTime);
293
- }
294
- } catch (e_1_1) {
295
- e_1 = {
296
- error: e_1_1
297
- };
298
- } finally {
299
- try {
300
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
301
- } finally {
302
- if (e_1) throw e_1.error;
303
- }
304
- }
305
-
306
- this.needPlay.length = 0;
307
- };
308
-
309
- Transition.prototype.newAnimation = function (name) {
310
- var _this = this;
311
-
312
- var animation = new Animation$1(this.group[name], this.tweenGroup);
313
- animation.on('finish', function () {
314
- return _this.emit('finish', name);
315
- });
316
- this.animations[name] = animation;
317
- };
318
-
319
- Transition.componentName = 'Transition';
320
- return Transition;
321
- }(Component);
322
-
323
- var Transition$1 = Transition;
324
-
325
- var TransitionSystem = function (_super) {
326
- __extends(TransitionSystem, _super);
327
-
328
- function TransitionSystem() {
329
- var _this = _super !== null && _super.apply(this, arguments) || this;
330
-
331
- _this.name = 'transition';
332
- return _this;
333
- }
334
-
335
- TransitionSystem.systemName = 'transition';
336
- return TransitionSystem;
337
- }(System);
338
-
339
- var TransitionSystem$1 = TransitionSystem;
340
- export { Transition$1 as Transition, TransitionSystem$1 as TransitionSystem };