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;ni===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.tweenInformation.type,layerName:a.tweenInformation.layerName,effectName:a.tweenInformation.effectName,propertyName:a.tweenInformation.propertyName,scaleFromCenterOfObject:a.tweenInformation.scaleFromCenterOfObject,useHSLColorTransition:a.tweenInformation.useHSLColorTransition,destroyObjectWhenFinished:a.tweenInformation.destroyObjectWhenFinished};if(a.tweenInformation.variablePath&&(s instanceof u.RuntimeScene||s instanceof u.RuntimeObject)){const l=s.getVariables().getVariableFromPath(a.tweenInformation.variablePath);l&&(f.variable=l)}if(typeof a.initialValue=="number"&&typeof a.targetedValue=="number"){this.addSimpleTween(o,s,a.totalDuration,a.easingIdentifier,m,a.initialValue,a.targetedValue,h,f,c);const l=this._tweens.get(o);l&&(l.updateElapsedTime(a.elapsedTime),a.isPaused&&this.pauseTween(o))}else if(Array.isArray(a.initialValue)&&Array.isArray(a.targetedValue)){this.addMultiTween(o,s,a.totalDuration,a.easingIdentifier,m,a.initialValue,a.targetedValue,h,f,c);const l=this._tweens.get(o);l&&(l.updateElapsedTime(a.elapsedTime),a.isPaused&&this.pauseTween(o))}})}}d.TweenManager=V;const b=()=>{};class T{constructor(t,n,i,r,o,a,s){this.isPaused=!1;this.timeSource=t,this.totalDuration=n,this.easing=i,this.easingIdentifier=r,this.interpolate=o,this.tweenInformation=a,this.elapsedTime=0,this.onFinish=s||b}step(){!this.isPlaying()||(this.elapsedTime=Math.min(this.elapsedTime+this.timeSource.getElapsedTime()/1e3,this.totalDuration),this._updateValue())}isPlaying(){return!this.isPaused&&!this.hasFinished()}hasFinished(){return this.elapsedTime===this.totalDuration}stop(t){this.elapsedTime=this.totalDuration,t&&this._updateValue()}resume(){this.isPaused=!1}pause(){this.isPaused=!0}getProgress(){return this.elapsedTime/this.totalDuration}updateElapsedTime(t){this.elapsedTime=t}}d.AbstractTweenInstance=T;class v extends T{constructor(t,n,i,r,o,a,s,h,c,m){super(t,n,i,r,o,c,m);this.initialValue=a,this.currentValue=a,this.targetedValue=s,this.setValue=h}_updateValue(){const t=this.easing(this.getProgress()),n=this.interpolate(this.initialValue,this.targetedValue,t);this.currentValue=n,this.setValue(n),this.hasFinished()&&this.onFinish()}getValue(){return this.currentValue}getNetworkSyncData(){const t=this.interpolate===u.evtTools.common.exponentialInterpolation?"exponential":"linear",n={type:this.tweenInformation.type,layerName:this.tweenInformation.layerName,effectName:this.tweenInformation.effectName,propertyName:this.tweenInformation.propertyName,scaleFromCenterOfObject:this.tweenInformation.scaleFromCenterOfObject,useHSLColorTransition:this.tweenInformation.useHSLColorTransition,destroyObjectWhenFinished:this.tweenInformation.destroyObjectWhenFinished};if(this.tweenInformation.variable&&(this.timeSource instanceof u.RuntimeScene||this.timeSource instanceof u.RuntimeObject)){const i=this.timeSource.getVariables().getVariablePathInContainerByLoopingThroughAllVariables(this.tweenInformation.variable);i&&(n.variablePath=i)}return{initialValue:this.initialValue,targetedValue:this.targetedValue,elapsedTime:this.elapsedTime,totalDuration:this.totalDuration,easingIdentifier:this.easingIdentifier,interpolationString:t,isPaused:this.isPaused,tweenInformation:n}}}d.SimpleTweenInstance=v;class M extends T{constructor(t,n,i,r,o,a,s,h,c,m){super(t,n,i,r,o,c,m);this.currentValues=new Array;this.initialValue=a,this.targetedValue=s,this.setValue=h}_updateValue(){const t=this.easing(this.getProgress()),n=this.initialValue.length;this.currentValues.length=n;for(let i=0;i{e/=255,t/=255,n/=255;let i=Math.max(e,t,n),r=i-Math.min(e,t,n),o=1-Math.abs(i+i-r-1),a=r&&(i===e?(t-n)/r:i===t?2+(n-e)/r:4+(e-t)/r);return[Math.round(60*(a<0?a+6:a)),Math.round((o?r/o:0)*100),Math.round((i+i-r)/2*100)]},d.hslToRgb=(e,t,n)=>{e=e%=360,e<0&&(e+=360),t=t/100,n=n/100;const i=t*Math.min(n,1-n),r=(o=0,a=(o+e/30)%12)=>n-i*Math.max(Math.min(a-3,9-a,1),-1);return[Math.round(r(0)*255),Math.round(r(8)*255),Math.round(r(4)*255)]},d.ease=(e,t,n,i)=>{const r=u.evtTools.tween.easingFunctions,o=r.hasOwnProperty(e)?r[e]:r.linear;return t+(n-t)*o(i)}})(p=w.tween||(w.tween={}))})(I=u.evtTools||(u.evtTools={}))})(gdjs||(gdjs={})); //# sourceMappingURL=TweenManager.js.map