"use strict";const a=require("./base-iCmnU-fv.cjs");class u{startTime;startPos;endPos;duration;runEasing;runIngFun;lastPos;lastInterval;timeAnimate;constructor(t){this.startTime=0,this.startPos=0,this.endPos=0,this.duration=0,this.runEasing=null,this.runIngFun=t.runIngCallback,this.lastPos=0,this.lastInterval=0}_easing={linear:(t,s,i,n)=>i*t/n+s,easeInCubic:(t,s,i,n)=>i*(t/=n)*t*t+s,easeOutCubic:(t,s,i,n)=>i*((t=t/n-1)*t*t+1)+s};start(t,s,i,n="linear"){const e=this;return new Promise(r=>{this.startTime=+new Date,this.startPos=t,this.endPos=s,this.duration=i,this.runEasing=e._easing[n],e.timeAnimate=a.CommonBase.requestAnimationFrame(function o(){e.step()===!1?(e.stop(),r(e.lastInterval)):e.timeAnimate=a.CommonBase.requestAnimationFrame(o)})})}step(){const t=+new Date;if(t>=this.startTime+this.duration)return this.runIngFun(this.endPos),!1;const s=this.runEasing(t-this.startTime,this.startPos,this.endPos-this.startPos,this.duration);return this.lastInterval=Math.abs(s-this.lastPos),this.lastPos=s,this.runIngFun(s),!0}stop(){this.timeAnimate&&a.CommonBase.cancelAnimationFrame(this.timeAnimate)}}exports.AnimateEasing=u;
//# sourceMappingURL=Tools_animateEasing-C6TmrmvZ.cjs.map
