14 lines
9.2 KiB
JavaScript
14 lines
9.2 KiB
JavaScript
var gdjs;(function(u){let I;(function(w){let p;(function(d){/*!
|
|||
|
|
* All equations are adapted from Thomas Fuchs'
|
||
|
|
* [Scripty2](https://github.com/madrobby/scripty2/blob/master/src/effects/transitions/penner.js).
|
||
|
|
*
|
||
|
|
* Based on Easing Equations (c) 2003 [Robert
|
||
|
|
* Penner](http://www.robertpenner.com/), all rights reserved. This work is
|
||
|
|
* [subject to terms](http://www.robertpenner.com/easing_terms_of_use.html).
|
||
|
|
*//*!
|
||
|
|
* TERMS OF USE - EASING EQUATIONS
|
||
|
|
* Open source under the BSD License.
|
||
|
|
* Easing Equations (c) 2003 Robert Penner, all rights reserved.
|
||
|
|
*//*! Shifty 3.0.3 - https://github.com/jeremyckahn/shifty */d.easingFunctions={linear:e=>e,easeInQuad:e=>Math.pow(e,2),easeOutQuad:e=>-(Math.pow(e-1,2)-1),easeInOutQuad:e=>(e/=.5)<1?.5*Math.pow(e,2):-.5*((e-=2)*e-2),easeInCubic:e=>Math.pow(e,3),easeOutCubic:e=>Math.pow(e-1,3)+1,easeInOutCubic:e=>(e/=.5)<1?.5*Math.pow(e,3):.5*(Math.pow(e-2,3)+2),easeInQuart:e=>Math.pow(e,4),easeOutQuart:e=>-(Math.pow(e-1,4)-1),easeInOutQuart:e=>(e/=.5)<1?.5*Math.pow(e,4):-.5*((e-=2)*Math.pow(e,3)-2),easeInQuint:e=>Math.pow(e,5),easeOutQuint:e=>Math.pow(e-1,5)+1,easeInOutQuint:e=>(e/=.5)<1?.5*Math.pow(e,5):.5*(Math.pow(e-2,5)+2),easeInSine:e=>-Math.cos(e*(Math.PI/2))+1,easeOutSine:e=>Math.sin(e*(Math.PI/2)),easeInOutSine:e=>-.5*(Math.cos(Math.PI*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>e===0?0:e===1?1:(e/=.5)<1?.5*Math.pow(2,10*(e-1)):.5*(-Math.pow(2,-10*--e)+2),easeInCirc:e=>-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-Math.pow(e-1,2)),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeOutBounce:e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,easeInBack:e=>{const t=1.70158;return e*e*((t+1)*e-t)},easeOutBack:e=>{const t=1.70158;return(e=e-1)*e*((t+1)*e+t)+1},easeInOutBack:e=>{let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},elastic:e=>-1*Math.pow(4,-8*e)*Math.sin((e*6-1)*(2*Math.PI)/2)+1,swingFromTo:e=>{let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},swingFrom:e=>{const t=1.70158;return e*e*((t+1)*e-t)},swingTo:e=>{const t=1.70158;return(e-=1)*e*((t+1)*e+t)+1},bounce:e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,bouncePast:e=>e<1/2.75?7.5625*e*e:e<2/2.75?2-(7.5625*(e-=1.5/2.75)*e+.75):e<2.5/2.75?2-(7.5625*(e-=2.25/2.75)*e+.9375):2-(7.5625*(e-=2.625/2.75)*e+.984375),easeFromTo:e=>(e/=.5)<1?.5*Math.pow(e,4):-.5*((e-=2)*Math.pow(e,3)-2),easeFrom:e=>Math.pow(e,4),easeTo:e=>Math.pow(e,.25)};class V{constructor(){this._tweens=new Map;this._activeTweens=new Array}step(){let t=0;for(let n=0;n<this._activeTweens.length;n++){const i=this._activeTweens[n];i.step(),i.hasFinished()||(this._activeTweens[t]=i,t++)}this._activeTweens.length=t}addSimpleTween(t,n,i,r,o,a,s,h,c,m){const f=d.easingFunctions[r];if(!f)return;this.removeTween(t);const l=new v(n,i,f,r,o,a,s,h,c,m);this._tweens.set(t,l),this._addActiveTween(l)}addMultiTween(t,n,i,r,o,a,s,h,c,m){const f=d.easingFunctions[r];if(!f)return;this.removeTween(t);const l=new M(n,i,f,r,o,a,s,h,c,m);this._tweens.set(t,l),this._addActiveTween(l)}exists(t){return this._tweens.has(t)}isPlaying(t){const n=this._tweens.get(t);return!!n&&n.isPlaying()}hasFinished(t){const n=this._tweens.get(t);return!!n&&n.hasFinished()}pauseTween(t){const n=this._tweens.get(t);!n||!n.isPlaying()||n.hasFinished()||(this._removeActiveTween(n),n.pause())}resumeTween(t){const n=this._tweens.get(t);!n||n.isPlaying()||n.hasFinished()||(this._addActiveTween(n),n.resume())}stopTween(t,n){const i=this._tweens.get(t);!i||i.hasFinished()||(i.isPlaying()&&this._removeActiveTween(i),i.stop(n))}removeTween(t){const n=this._tweens.get(t);!n||(n.isPlaying()&&this._removeActiveTween(n),this._tweens.delete(t))}_addActiveTween(t){this._activeTweens.push(t)}_removeActiveTween(t){const n=this._activeTweens.findIndex(i=>i===t);this._activeTweens.splice(n,1)}getProgress(t){const n=this._tweens.get(t);return n?n.getProgress():0}getValue(t){const n=this._tweens.get(t);return n?n.getValue():0}getNetworkSyncData(){const t={tweens:{}};return this._tweens.forEach((n,i)=>{t.tweens[i]=n.getNetworkSyncData()}),t}updateFromNetworkSyncData(t,n,i,r){Object.entries(t.tweens).forEach(([o,a])=>{const s=n(a.tweenInformation),h=i(a.tweenInformation),c=r(a.tweenInformation),m=a.interpolationString==="exponential"?u.evtTools.common.exponentialInterpolation:u.evtTools.common.lerp,f={type:a.tweenI
|
||
|
|
//# sourceMappingURL=TweenManager.js.map
|