vexip-ui
Version:
A Vue 3 UI library, Highly customizability, full TypeScript, performance pretty good
3 lines (2 loc) • 565 B
JavaScript
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function d(y){const{el:l,xFrom:a=0,xTo:t=0,yFrom:u=0,yTo:e=0,duration:i=500,callback:f=null}=y;if(!l)return;const s=()=>{typeof f=="function"&&f()};if(i<=0){l.scrollTo(t,e),s();return}const o=t-a,n=e-u;if(!o&&!n){s();return}const T=Math.ceil(o/i*16),S=Math.ceil(n/i*16);let c=a,r=u;const m=()=>{c+=T,r+=S,o&&(t-c)/o<=0&&(c=t),n&&(e-r)/n<=0&&(r=e),l.scrollTo(c,r),(!o||c===t)&&(!n||r===e)?s():requestAnimationFrame(m)};m()}exports.animateScrollTo=d;
//# sourceMappingURL=helper.cjs.map