package.dist.prod.animations.animate.js Maven / Gradle / Ivy
"use strict";import p from"./AnimationQueue.js";const f=e=>{let n=null,a=!1,i,o,r;const m=new Promise((t,c)=>{r=u=>{n=n||u;const d=u-n,l=e.duration-d;if(d<=e.duration){const s=1-l/e.duration;e.advance(s),a||(i=requestAnimationFrame(r))}else e.advance(1),t()},o=()=>{a=!0,cancelAnimationFrame(i),c(new Error("animation stopped"))}}).catch(t=>t);return p.push(e.element,()=>(typeof e.beforeStart=="function"&&e.beforeStart(),requestAnimationFrame(r),new Promise(t=>{m.then(()=>t())}))),{promise:()=>m,stop:()=>o}},v=400;export{v as duration};export default f;
//# sourceMappingURL=animate.js.map