svg-scroll-draw 2.15.0 → 2.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/angular/index.cjs +2 -2
- package/dist/angular/index.mjs +2 -2
- package/dist/astro/index.cjs +2 -2
- package/dist/astro/index.mjs +2 -2
- package/dist/cdn/svg-scroll-draw.dev.global.js +18 -4
- package/dist/cdn/svg-scroll-draw.global.js +2 -2
- package/dist/cinematic/index.d.mts +72 -0
- package/dist/cinematic/index.d.ts +72 -0
- package/dist/group/index.cjs +2 -2
- package/dist/group/index.mjs +2 -2
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +3 -3
- package/dist/nuxt/index.cjs +2 -2
- package/dist/nuxt/index.mjs +2 -2
- package/dist/react/index.cjs +2 -2
- package/dist/react/index.mjs +2 -2
- package/dist/solid/index.cjs +2 -2
- package/dist/solid/index.mjs +2 -2
- package/dist/svelte/index.cjs +2 -2
- package/dist/svelte/index.mjs +2 -2
- package/dist/video/index.d.mts +49 -0
- package/dist/video/index.d.ts +49 -0
- package/dist/vivus/{react/index.d.mts → index.d.mts} +1 -17
- package/dist/vivus/{react/index.d.ts → index.d.ts} +1 -17
- package/dist/vue/index.cjs +2 -2
- package/dist/vue/index.mjs +2 -2
- package/dist/web-component/index.cjs +2 -2
- package/dist/web-component/index.mjs +2 -2
- package/package.json +2 -1
- package/dist/aos/react/index.d.mts +0 -44
- package/dist/aos/react/index.d.ts +0 -44
- package/dist/horizontal/index.d.mts +0 -108
- package/dist/horizontal/index.d.ts +0 -108
package/dist/astro/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
function
|
|
1
|
+
function zt({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),l=Math.sqrt(t),s=0,c=[];for(let d=0;d<r;d++){let S=Math.pow(l,d);c.push(S),s+=S;}let u=[0],m=0;for(let d=0;d<r;d++)m+=c[d]/s,u.push(m);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let S=0;S<r;S++)if(d<=u[S+1]){let _=(d-u[S])/(u[S+1]-u[S]);if(S===0)return _*(2-_);let x=1-Math.pow(t,S);return x+(1-x)*(2*_-1)*(2*_-1)}return 1}}function Vt({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),l=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return s=>s<=0?0:s>=1?1:r*Math.pow(2,-10*s)*Math.sin((s-l)*(2*Math.PI)/t)+1}var ue={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:zt(),elastic:Vt()};function Se(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[r="top",t="bottom"]=n.split(/\s+/).filter(Boolean);return {element:r,viewport:t}}function yt(e,n,r,t){switch(t){case "top":return e+r;case "center":return e+r+n/2;case "bottom":return e+r+n;default:return e+r}}function ht(e,n){if(/^\d+(\.\d+)?%$/.test(e))return n*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return n/2;case "bottom":return n;default:return n}}function ze(e){let n=e.tagName.toLowerCase();if(n==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(r+t)}if(n==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function qt(e,n,r){return Math.min(r,Math.max(n,e))}function Z(e,n,r,t){return r===n?0:qt((e-n)/(r-n)*t,0,1)}function Ze(e,n,r){let t=e.getBoundingClientRect(),l=r==="x"?t.width:t.height;return n?{top:r==="x"?t.left-n.getBoundingClientRect().left+n.scrollLeft:t.top-n.getBoundingClientRect().top+n.scrollTop,height:l,scroll:0}:{top:r==="x"?t.left:t.top,height:l,scroll:r==="x"?window.scrollX:window.scrollY}}function Le(e,n,r,t,l){let s=yt(e.top,e.height,n,t.element)-ht(t.viewport,r),c=yt(e.top,e.height,n,l.element)-ht(l.viewport,r);return {tStart:s,tEnd:c}}function bt(e){let n=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(n)return [parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function Ve(e,n,r){let t=bt(e),l=bt(n);return !t||!l?e:`rgb(${Math.round(t[0]+(l[0]-t[0])*r)},${Math.round(t[1]+(l[1]-t[1])*r)},${Math.round(t[2]+(l[2]-t[2])*r)})`}var wt={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var Be=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function K(e,...n){Be&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var Wt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Bt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",St=33;function Gt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function jt(e){let n=[];for(let r=0;r<St;r++){let t=r/(St-1);n.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${n.join(",")})`}function Ke(e){switch(e){case "linear":return "linear";case "ease-in":return Wt;case "ease-out":return Bt;case "ease-in-out":return Gt()?jt(ue["ease-in-out"]):null;default:return null}}var vt=Symbol.for("svg-scroll-draw.registry");function Et(){let e=globalThis;return e[vt]||(e[vt]=new Map)}function Oe(e,n){Et().set(e,n);}function Ie(e){Et().delete(e);}var Ut=0;function Yt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function xt(e,n){let r="";try{r=getComputedStyle(e).getPropertyValue(n).trim();}catch{}return r||(e.getAttribute(n)??"").trim()}var Tt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function Xt(e){if(!Be)return;let n=xt(e,"stroke");if(!n||n==="none"){K("Element has no stroke \u2014 path will not be visible.",e);return}let r=(e.getAttribute("fill")??"").trim();r&&!Tt.has(r)&&!Tt.has(xt(e,"fill"))&&K("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Jt(e,n,r){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function l(){let s=r==="x"?window.scrollX:window.scrollY,c=e-s,u=n-s,m=r==="x";t.innerHTML=`
|
|
2
2
|
<div style="position:absolute;${m?`left:${c}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${c}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
-
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),{el:t,destroy(){window.removeEventListener("scroll",l),t.remove();}}}var xt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Tt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Xt(e,n,r){if(!Ze)return;let t=(e.match(Tt)??[]).join("").toUpperCase(),l=(n.match(Tt)??[]).join("").toUpperCase(),s=(e.match(xt)??[]).length,c=(n.match(xt)??[]).length;if(t!==l){K(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${l||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}s!==c&&K(`morphTo: coordinate count differs (${s} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function it(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let c=parseFloat(s),u=t[l++]??c;return String(+(c+(u-c)*r).toFixed(4))})}function et(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,l=r?{...wt[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:d="linear",trigger:S={},stagger:_=0,direction:x="forward",once:ne=false,debug:ke=false,axis:j="y",scrollContainer:oe,autoReverse:se=false,delay:ee=0,strokeColor:T,strokeWidth:W,fillOpacity:L,waypoints:A,velocityScale:F=false,threshold:B=0,rootMargin:P="0px",repeat:M=0,repeatDelay:me=0,morphTo:D,clip:de,autoplay:ve=false,duration:ge=1e3,native:Ee=true,onProgress:g,onStart:v,onComplete:y,onEnter:$,onLeave:ye,onEnterBack:he,onLeaveBack:Ce}=l,te=de===true?"left":typeof de=="string"?de:false,be=typeof d=="function"?d:ue[d]??ue.linear,Ae=Se(S.start??"top bottom"),He=Se(S.end??"bottom top"),fe=typeof oe=="string"?document.querySelector(oe):oe??null,pe=Array.isArray(T)?T[0]:null,Y=Array.isArray(T)?T[1]:typeof T=="string"?T:null,X=Array.isArray(W)?W[0]:null,z=Array.isArray(W)?W[1]:typeof W=="number"?W:null,re=Array.isArray(L)?L[0]:null,G=Array.isArray(L)?L[1]:typeof L=="number"?L:null;function Me(o){let a=o*100;switch(te){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let k=te?[]:Array.from(e.querySelectorAll(c)),E=[],i=[],f=0,ie=0,O=false,R=false,N=0,xe=false,ae=-1,U=-1,q=false,le=0,Pe=0,Re,tt=null;function lt(){tt?.destroy(),tt=null;}let Fe=new Set,ct=NaN,Ne=true,Ge=-1,ut=performance.now(),_e=NaN;function rt(){return fe?j==="x"?fe.scrollLeft:fe.scrollTop:j==="x"?window.scrollX:window.scrollY}function mt(){return fe?j==="x"?fe.clientWidth:fe.clientHeight:j==="x"?window.innerWidth:window.innerHeight}function ft(){let o=Qe(e,fe,j);return Le(o,o.scroll,mt(),Ae,He)}function pt(){(({tStart:f,tEnd:ie}=ft())),ke&&Ze&&(lt(),tt=Yt(f,ie,j));}function nt(o,a=ft){Oe(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let b=o.destroy;return o.destroy=()=>{b.call(o),Ie(e);},o}function kt(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),te){let b=a==="reverse"?1-o:o;e.style.clipPath=Me(b);return}k.forEach((b,J)=>{b.style.strokeDashoffset=a==="reverse"?`${E[J]*o}`:`${E[J]*(1-o)}`,m&&(b.style.opacity=a==="reverse"?`${1-o}`:`${o}`),pe&&Y?b.style.stroke=qe(pe,Y,o):Y&&(b.style.stroke=Y),X!==null&&z!==null?b.style.strokeWidth=`${X+(z-X)*o}`:z!==null&&(b.style.strokeWidth=`${z}`),re!==null&&G!==null?b.style.fillOpacity=`${re+(G-re)*o}`:G!==null&&(b.style.fillOpacity=`${G}`),D&&b.tagName.toLowerCase()==="path"&&i[J]&&b.setAttribute("d",it(i[J],D,o));});}function je(){if(e.style.setProperty("--scroll-draw-progress","0"),te){e.style.clipPath=Me(0);return}k.forEach((o,a)=>{o.style.strokeDasharray=`${E[a]}`,o.style.strokeDashoffset=x==="reverse"?"0":`${E[a]}`,m?o.style.opacity=x==="reverse"?"1":"0":o.style.opacity="",pe&&(o.style.stroke=pe),X!==null&&(o.style.strokeWidth=`${X}`),re!==null&&(o.style.fillOpacity=`${re}`),D&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(k.forEach(o=>{Ut(o);let a=ze(o);E.push(a);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),D&&(b?Xt(i[i.length-1],D,o):K(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=x==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),Y&&(o.style.stroke=Y),z!==null&&(o.style.strokeWidth=`${z}`),G!==null&&(o.style.fillOpacity=`${G}`),D&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",D)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=x==="reverse"?"0":`${a}`,m?o.style.opacity=x==="reverse"?"1":"0":o.style.opacity="",pe&&(o.style.stroke=pe),X!==null&&(o.style.strokeWidth=`${X}`),re!==null&&(o.style.fillOpacity=`${re}`));}),te){if(s)return e.style.clipPath=Me(1),y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Me(0);}else if(s)return y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let dt=typeof d=="string"?Ke(d):null;function Rt(){return !(Ee===false||!jt()||!k.length||!dt||te||j!=="y"||fe||u!==1||_!==0||ne||se||F!==false||D||A||M||ee>0||g||v||y||$||ye||he||Ce||T!=null||W!=null||L!=null||(S.start??"top bottom").trim()!=="top bottom"||(S.end??"bottom top").trim()!=="bottom top")}function Ft(){let o=++Gt,a=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,J=`--svg-scroll-draw-${o}`,De=x==="reverse"?"0":"var(--ssd-len)",$e=x==="reverse"?"var(--ssd-len)":"0",Te=`stroke-dashoffset:${De};`,w=`stroke-dashoffset:${$e};`;m&&(Te+=`opacity:${x==="reverse"?1:0};`,w+=`opacity:${x==="reverse"?0:1};`);let C=document.createElement("style");C.setAttribute("data-svg-scroll-draw",""),C.textContent=`@keyframes ${a}{from{${Te}}to{${w}}}.${b}{view-timeline-name:${J};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${dt};animation-fill-mode:both;animation-timeline:${J};animation-range:cover 0% cover 100%;}`,document.head.appendChild(C),e.classList.add(b);function Q(p,V){p.style.setProperty("--ssd-len",String(E[V])),p.style.strokeDasharray=`${E[V]}`,p.style.strokeDashoffset="",p.style.opacity="",p.style.animationPlayState="",p.classList.add(a);}k.forEach(Q);let h=false,I=-1;function H(){if(I>=0)return I;let p=e.getBoundingClientRect(),{tStart:V,tEnd:we}=Le({top:p.top,height:p.height},rt(),mt(),Ae,He);return be(Z(rt(),V,we,u))}return {destroy(){e.classList.remove(b),k.forEach(p=>{p.classList.remove(a),p.style.removeProperty("--ssd-len"),p.style.animationPlayState="";}),C.remove();},replay(){h=false,I=-1,k.forEach(Q);},pause(){h=true,k.forEach(p=>{p.style.animationPlayState="paused";});},resume(){h&&(h=false,k.forEach(p=>{p.style.animationPlayState="running";}));},seek(p){let V=Math.min(1,Math.max(0,p));I=V,h=true,k.forEach((we,ce)=>{we.classList.remove(a),we.style.strokeDashoffset=x==="reverse"?`${E[ce]*V}`:`${E[ce]*(1-V)}`,m&&(we.style.opacity=x==="reverse"?`${1-V}`:`${V}`);});},getProgress(){return H()},refresh(){k.forEach((p,V)=>{E[V]=ze(p),p.style.setProperty("--ssd-len",String(E[V])),p.style.strokeDasharray=`${E[V]}`;});}}}if(Rt())return nt(Ft());function Nt(){let o=Math.max(1,ge),a=0,b=0,J=false;function De(h){let I=true;if(te){let H=Math.min(1,Math.max(0,h/o)),p=be(H);le=p,e.style.setProperty("--scroll-draw-progress",String(p)),e.style.clipPath=Me(x==="reverse"?1-p:p),g?.(p),H<1&&(I=false);}else k.forEach((H,p)=>{let V=p*_*o,we=Math.min(1,Math.max(0,(h-V)/o)),ce=be(we);H.style.strokeDashoffset=x==="reverse"?`${E[p]*ce}`:`${E[p]*(1-ce)}`,m&&(H.style.opacity=x==="reverse"?`${1-ce}`:`${ce}`),pe&&Y?H.style.stroke=qe(pe,Y,ce):Y&&(H.style.stroke=Y),X!==null&&z!==null?H.style.strokeWidth=`${X+(z-X)*ce}`:z!==null&&(H.style.strokeWidth=`${z}`),re!==null&&G!==null?H.style.fillOpacity=`${re+(G-re)*ce}`:G!==null&&(H.style.fillOpacity=`${G}`),D&&H.tagName.toLowerCase()==="path"&&i[p]&&H.setAttribute("d",it(i[p],D,ce)),p===0&&(le=ce,g?.(ce),e.style.setProperty("--scroll-draw-progress",String(ce))),we<1&&(I=false);});if(A){let H=Math.min(1,Math.max(0,h/o)),p=be(H);for(let V in A){let we=parseFloat(V);p>=we&&!Fe.has(we)&&(Fe.add(we),A[V]?.());}}return I}function $e(h){if(q)return;let I=h-a;R||(R=true,v?.());let H=De(I);if(H&&!O){O=true,De(o*(1+Math.max(0,k.length-1)*_)),y?.(),Pe<(M==="infinite"?1/0:M??0)&&(Pe++,Re=setTimeout(()=>{a=performance.now(),R=false,O=false,Fe.clear(),je(),N=requestAnimationFrame($e);},me));return}H||(N=requestAnimationFrame($e));}function Te(){cancelAnimationFrame(N),clearTimeout(Re),a=performance.now(),b=0,q=false,R=false,O=false,Pe=0,J=true,le=0,Fe.clear(),je(),N=requestAnimationFrame($e);}let w=new IntersectionObserver(h=>{h.forEach(I=>{I.isIntersecting&&!(ne&&O)?Te():!I.isIntersecting&&!ne&&!O&&(cancelAnimationFrame(N),clearTimeout(Re),J=false);});},{root:fe??null,threshold:B,rootMargin:P}),C;function Q(){clearTimeout(C),C=setTimeout(()=>{k.forEach((h,I)=>{E[I]=ze(h),h.style.strokeDasharray=`${E[I]}`;});},150);}return window.addEventListener("resize",Q),window.addEventListener("orientationchange",Q),ee>0?setTimeout(()=>w.observe(e),ee):w.observe(e),{destroy(){cancelAnimationFrame(N),clearTimeout(Re),w.disconnect(),window.removeEventListener("resize",Q),window.removeEventListener("orientationchange",Q),clearTimeout(C);},replay(){Pe=0,Te();},pause(){q||!J||(q=true,b=performance.now()-a,cancelAnimationFrame(N));},resume(){q&&(q=false,J=true,a=performance.now()-b,N=requestAnimationFrame($e));},seek(h){let I=Math.min(1,Math.max(0,h));le=I,q=true,b=I*o,a=performance.now()-b,cancelAnimationFrame(N),De(b);},getProgress(){return le},refresh(){clearTimeout(C),k.forEach((h,I)=>{E[I]=ze(h),h.style.strokeDasharray=`${E[I]}`;});}}}if(ve)return nt(Nt());pt();function Ue(){if(!xe||q)return;let o=performance.now(),a=rt();if(!Ne&&F===false&&a===ct){N=requestAnimationFrame(Ue);return}Ne=false,ct=a;let b=u;if(F!==false){let w=o-ut,C=w>0?Math.abs(a-(Ge<0?a:Ge))/w:0;b=u*Math.max(.2,1+C*(typeof F=="number"?F:1)*.04);}Ge=a,ut=o;let J=se?U===-1||a>=U?"forward":"reverse":x;U=a;let De=ie-f,$e=true,Te=De===0?0:(a-f)/De;if(isNaN(_e)||(_e<=0&&Te>0?$?.():_e>0&&Te<=0&&Ce?.(),_e<1&&Te>=1?ye?.():_e>=1&&Te<1&&he?.()),_e=Te,te){let w=be(Z(a,f,ie,b));ne&&!se&&(ae=Math.max(ae,w),w=ae),le=w,e.style.setProperty("--scroll-draw-progress",String(w));let C=J==="reverse"?1-w:w;e.style.clipPath=Me(C),g?.(w),!R&&Z(a,f,ie,b)>0&&(R=true,v?.()),w>=1&&!O?(O=true,y?.(),Pe<(M==="infinite"?1/0:M??0)&&(Pe++,Re=setTimeout(()=>{ae=-1,R=false,O=false,e.style.clipPath=Me(0);},me))):w<1&&!ne&&(O=false),N=requestAnimationFrame(Ue);return}if(k.forEach((w,C)=>{let Q=C*_*De,h=be(Z(a,f+Q,ie+Q,b));ne&&!se&&(ae=Math.max(ae,h),h=ae),le=h,w.style.strokeDashoffset=J==="reverse"?`${E[C]*h}`:`${E[C]*(1-h)}`,m&&(w.style.opacity=J==="reverse"?`${1-h}`:`${h}`),pe&&Y?w.style.stroke=qe(pe,Y,h):Y&&(w.style.stroke=Y),X!==null&&z!==null?w.style.strokeWidth=`${X+(z-X)*h}`:z!==null&&(w.style.strokeWidth=`${z}`),re!==null&&G!==null?w.style.fillOpacity=`${re+(G-re)*h}`:G!==null&&(w.style.fillOpacity=`${G}`),D&&w.tagName.toLowerCase()==="path"&&i[C]&&w.setAttribute("d",it(i[C],D,h)),C===0&&(g?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&($e=false);}),A){let w=be(Z(a,f,ie,b));for(let C in A){let Q=parseFloat(C);w>=Q&&!Fe.has(Q)&&(Fe.add(Q),A[C]?.());}}!R&&Z(a,f,ie,b)>0&&(R=true,v?.()),$e&&!O?(O=true,y?.(),Pe<(M==="infinite"?1/0:M??0)&&(Pe++,Re=setTimeout(()=>{ae=-1,R=false,O=false,Fe.clear(),je(),Ne=true;},me))):!$e&&!ne&&(O=false),N=requestAnimationFrame(Ue);}let ot=false;function Ye(){ot||(ot=true,N=requestAnimationFrame(function(){Ue();}));}function Xe(){ot=false,cancelAnimationFrame(N);}let st=new IntersectionObserver(o=>{o.forEach(a=>{xe=a.isIntersecting,xe&&!q?(Ne=true,Ye()):Xe();});},{root:fe??null,threshold:B,rootMargin:P});function gt(){k.forEach((o,a)=>{E[a]=ze(o),o.style.strokeDasharray=`${E[a]}`;}),pt(),Ne=true;}let Je;function Ve(){clearTimeout(Je),Je=setTimeout(gt,150);}window.addEventListener("resize",Ve),window.addEventListener("orientationchange",Ve);let We;return typeof ResizeObserver<"u"&&(We=new ResizeObserver(()=>Ve()),We.observe(document.body),We.observe(document.documentElement),We.observe(e)),ee>0?setTimeout(()=>st.observe(e),ee):st.observe(e),nt({destroy(){cancelAnimationFrame(N),clearTimeout(Re),Xe(),st.disconnect(),We?.disconnect(),window.removeEventListener("resize",Ve),window.removeEventListener("orientationchange",Ve),clearTimeout(Je),lt();},replay(){ae=-1,U=-1,Ge=-1,R=false,O=false,Pe=0,q=false,le=0,Fe.clear(),clearTimeout(Re),je(),Ne=true,xe&&Ye();},pause(){q=true,Xe();},resume(){q&&(q=false,Ne=true,xe&&Ye());},seek(o){let a=Math.min(1,Math.max(0,o));le=a,ae=a,q=true,Xe(),kt(a,x),Ne=true;},getProgress(){return le},refresh(){clearTimeout(Je),gt(),xe&&!q&&Ye();}},()=>({tStart:f,tEnd:ie}))}function Jt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function At(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let l=[],s=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}n.push({fn:t[1],nums:l,units:s});}return n}function Qt(e,n,r){let t=At(e),l=At(n);return t.length===0||t.length!==l.length?r<1?e:n:t.map((s,c)=>{let u=l[c];return s.fn!==u.fn||s.nums.length!==u.nums.length?r<1?`${s.fn}(${s.nums.map((m,d)=>`${m}${s.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,d)=>`${m}${u.units[d]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,d)=>`${m+(u.nums[d]-m)*r}${s.units[d]}`).join(", ")})`}).join(" ")}function Mt(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),l=String(n);if(Jt(t))return qe(t,l,r);if(t.includes("("))return Qt(t,l,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),c=l.match(/^([-+]?[\d.]+)(.*)$/);if(s&&c){let u=parseFloat(s[1]),m=parseFloat(c[1]);return `${u+(m-u)*r}${s[2]||c[2]}`}return r<1?t:l}function Zt(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var Kt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),er=0,$t="--scroll-draw-progress";function tr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Lt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:l={},easing:s="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:d,native:S=true,velocityScale:_=false,respectReducedMotion:x=true,triggerElement:ne,onProgress:ke,onComplete:j,onEnter:oe,onLeave:se,onEnterBack:ee,onLeaveBack:T}=n,W=x&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof s=="function"?s:ue[s]??ue["ease-out"],A=Se(l.start??"top bottom"),F=Se(l.end??"bottom top"),B=ne??e,P=typeof d=="string"?document.querySelector(d):d??null,M=Object.entries(t).map(([i,f])=>({prop:Zt(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function me(){let i=window.getComputedStyle(e);for(let f of M)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function D(){for(let i of M)e.style.setProperty(i.prop,String(i.to));}let de=new Map;for(let i of [...M.map(f=>f.prop),$t])de.set(i,e.style.getPropertyValue(i));function ve(){for(let[i,f]of de)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if(W)return D(),j?.(),{...r,destroy:ve,getProgress:()=>1};me();let ge=typeof s=="string"?Ke(s):null;function Ee(){if(!S||!tr()||!ge||m!=="y"||P||B!==e||u||c!==1||ke||j||oe||se||ee||T||_!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of M)if(!Kt.has(i.prop))return false;return true}function g(){let i=`ssd-a-${++er}`,f=M.map(U=>`${U.prop}:${U.from}`).join(";"),ie=M.map(U=>`${U.prop}:${U.to}`).join(";"),O=document.createElement("style");O.setAttribute("data-ssd-animate",""),O.textContent=`@keyframes ${i}{from{${f}}to{${ie}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ge};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(O),e.classList.add(i);let R=()=>m==="x"?window.scrollX:window.scrollY,N=()=>m==="x"?window.innerWidth:window.innerHeight,xe=()=>{let U=e.getBoundingClientRect();return Le({top:U.top,height:U.height},R(),N(),A,F)};Oe(e,{type:"animate",getProgress:()=>ae.getProgress(),getTrigger:xe});let ae={destroy(){e.classList.remove(i),O.remove(),e.style.animationPlayState="",ve(),Ie(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(U){let q=Math.min(1,Math.max(0,U));e.classList.remove(i);for(let le of M)e.style.setProperty(le.prop,Mt(le.from,le.to,q));},getProgress(){let{tStart:U,tEnd:q}=xe();return L(Z(R(),U,q,c))}};return ae}if(Ee())return g();let v=0,y=0,$=0,ye=false,he=false,Ce=-1,te=0,be=false,Ae=NaN,He=-1,fe=0,pe=()=>P?m==="x"?P.scrollLeft:P.scrollTop:m==="x"?window.scrollX:window.scrollY,Y=()=>P?m==="x"?P.clientWidth:P.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function X(){let i=Qe(B,P,m),f=Le(i,i.scroll,Y(),A,F);v=f.tStart,y=f.tEnd;}function z(i){e.style.setProperty($t,String(i));for(let f of M)e.style.setProperty(f.prop,Mt(f.from,f.to,i));ke?.(i);}function re(i){if(isNaN(Ae)){Ae=i;return}Ae<=0&&i>0?oe?.():Ae>0&&i<=0&&T?.(),Ae<1&&i>=1?se?.():Ae>=1&&i<1&&ee?.(),Ae=i;}function G(){if(!ye||he)return;let i=performance.now(),f=pe(),ie=c;if(_!==false){let N=i-fe,xe=N>0?Math.abs(f-(He<0?f:He))/N:0;ie=c*Math.max(.2,1+xe*(typeof _=="number"?_:1)*.04);}He=f,fe=i;let O=y===v?0:(f-v)/(y-v);re(O);let R=L(Z(f,v,y,ie));u&&(Ce=Math.max(Ce,R),R=Ce),te=R,z(R),R>=1&&!be?(be=true,j?.()):R<1&&!u&&(be=false),$=requestAnimationFrame(G);}X(),y===v&&K("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=L(Z(pe(),v,y,c));u&&i>0&&(Ce=i),te=i,z(i);}let Me=new IntersectionObserver(i=>{i.forEach(f=>{ye=f.isIntersecting,ye&&!he?$=requestAnimationFrame(G):cancelAnimationFrame($);});},{root:P??null}),k;function E(){clearTimeout(k),k=setTimeout(X,150);}return window.addEventListener("resize",E),window.addEventListener("orientationchange",E),Me.observe(e),Oe(e,{type:"animate",getProgress:()=>te,getTrigger:()=>({tStart:v,tEnd:y})}),{destroy(){cancelAnimationFrame($),Me.disconnect(),window.removeEventListener("resize",E),window.removeEventListener("orientationchange",E),clearTimeout(k),ve(),Ie(e);},replay(){Ce=-1,be=false,te=0,he=false,z(0);},pause(){he=true,cancelAnimationFrame($);},resume(){he&&(he=false,ye&&($=requestAnimationFrame(G)));},seek(i){let f=Math.min(1,Math.max(0,i));te=f,Ce=f,he=true,cancelAnimationFrame($),z(f);},getProgress(){return te}}}var at={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ct(e,n){if(typeof window>"u")return at;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return K("scrollCounter: element not found:",e),at;let t=r,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:d=true,decimals:S,onComplete:_}=n,x=S!==void 0?g=>g.toFixed(S):c??(g=>String(Math.round(g))),ne=typeof u=="function"?u:ue[u]??ue["ease-out"],ke=Se(m.start??"top 80%"),j=Se(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=x(s),_?.(),at;let se=0,ee=0,T=0,W=false,L=false,A=-1,F=0,B=false,P=()=>window.scrollY,M=()=>window.innerHeight;function me(){let g=t.getBoundingClientRect(),v=Le({top:g.top,height:g.height},P(),M(),ke,j);se=v.tStart,ee=v.tEnd;}function D(g){t.textContent=x(l+(s-l)*g),t.style.setProperty("--scroll-draw-progress",String(g));}function de(){if(!W||L)return;let g=ne(Z(P(),se,ee,1));d&&(A=Math.max(A,g),g=A),F=g,D(g),g>=1&&!B?(B=true,_?.()):g<1&&!d&&(B=false),T=requestAnimationFrame(de);}me();{let g=ne(Z(P(),se,ee,1));d&&g>0&&(A=g),F=g,D(g);}let ve=new IntersectionObserver(g=>{g.forEach(v=>{W=v.isIntersecting,W&&!L?T=requestAnimationFrame(de):cancelAnimationFrame(T);});}),ge;function Ee(){clearTimeout(ge),ge=setTimeout(me,150);}return window.addEventListener("resize",Ee),window.addEventListener("orientationchange",Ee),ve.observe(t),Oe(t,{type:"counter",getProgress:()=>F,getTrigger:()=>({tStart:se,tEnd:ee})}),{destroy(){cancelAnimationFrame(T),ve.disconnect(),window.removeEventListener("resize",Ee),window.removeEventListener("orientationchange",Ee),clearTimeout(ge),Ie(t);},replay(){A=-1,B=false,F=0,L=false,D(0);},pause(){L=true,cancelAnimationFrame(T);},resume(){L&&(L=false,W&&(T=requestAnimationFrame(de)));},seek(g){let v=Math.min(1,Math.max(0,g));F=v,A=v,L=true,cancelAnimationFrame(T),D(v);},getProgress(){return F}}}function Ot(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(r)?(t.textContent=r,t.style.whiteSpace="pre"):(t.textContent=r,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(r)?null:t}).filter(r=>r!==null)}function rr(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function Pt(e){let n=Ot(e),r=new Map;for(let s of n){let c=s.offsetTop;r.has(c)||r.set(c,[]),r.get(c).push(s);}let t=[],l=Array.from(r.keys()).sort((s,c)=>s-c);for(let s of l){let c=r.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,d)=>{let S=m.nextElementSibling;u.appendChild(m),d<c.length-1&&S&&S.style.whiteSpace==="pre"&&u.appendChild(S);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function nr(e,n,r,t){if(r<=1||t===0)return e;let l=(r-1)*t,s=n*t,c=s+(1-l);return c<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(c-s)))}function or(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var Dt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function It(e,n={}){if(typeof window>"u")return Dt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return K("scrollText: element not found:",e),Dt;let t=r,{split:l="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:d=true,onComplete:S}=n,_=window.matchMedia("(prefers-reduced-motion: reduce)").matches,x=typeof c=="function"?c:ue[c]??ue["ease-out"],ne=Se(m.start??"top 85%"),ke=Se(m.end??"top 40%"),j=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let oe;l==="chars"?oe=rr(t):l==="lines"?oe=Pt(t):oe=Ot(t);let se=oe.length;function ee(y,$){u?.opacity!==void 0&&(y.style.opacity=String(u.opacity+(1-u.opacity)*$));let ye=or($,u);ye&&(y.style.transform=ye);}function T(y){t.style.setProperty("--scroll-draw-progress",String(y)),oe.forEach(($,ye)=>{let he=x(nr(y,ye,se,s));ee($,he);});}if(_)return T(1),S?.(),{destroy(){t.innerHTML=j,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};T(0);let W=0,L=0,A=0,F=false,B=false,P=-1,M=0,me=false,D=()=>window.scrollY,de=()=>window.innerHeight;function ve(){let y=t.getBoundingClientRect(),$=Le({top:y.top,height:y.height},D(),de(),ne,ke);W=$.tStart,L=$.tEnd;}function ge(){if(!F||B)return;let y=Z(D(),W,L,1);d&&(P=Math.max(P,y),y=P),M=y,T(y),y>=1&&!me?(me=true,S?.()):y<1&&!d&&(me=false),A=requestAnimationFrame(ge);}ve();let Ee=new IntersectionObserver(y=>{y.forEach($=>{F=$.isIntersecting,F&&!B?A=requestAnimationFrame(ge):cancelAnimationFrame(A);});}),g;function v(){clearTimeout(g),g=setTimeout(()=>{if(l==="lines"){let y=M;t.innerHTML=j,t.setAttribute("aria-label",t.textContent??""),oe=Pt(t),T(y);}ve();},150);}return window.addEventListener("resize",v),window.addEventListener("orientationchange",v),Ee.observe(t),Oe(t,{type:"text",getProgress:()=>M,getTrigger:()=>({tStart:W,tEnd:L})}),{destroy(){cancelAnimationFrame(A),Ee.disconnect(),window.removeEventListener("resize",v),window.removeEventListener("orientationchange",v),clearTimeout(g),t.innerHTML=j,t.removeAttribute("aria-label"),Ie(t);},replay(){P=-1,me=false,M=0,B=false,T(0);},pause(){B=true,cancelAnimationFrame(A);},resume(){B&&(B=false,F&&(A=requestAnimationFrame(ge)));},seek(y){let $=Math.min(1,Math.max(0,y));M=$,P=$,B=true,cancelAnimationFrame(A),T($);},getProgress(){return M}}}function sr(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let t=typeof e=="string"?document.querySelector(e):e;return t?et(t,n):(K("Container not found:",e),r)}function Be(){return typeof document>"u"?null:document}function ir(e=Be()){return e?Array.from(e.querySelectorAll("[data-scroll-draw]")).map(n=>{let r={};try{let t=n.dataset.scrollDrawOptions??n.dataset.scrollDrawoptions??"";t&&(r=JSON.parse(t));}catch{}return et(n,r)}):[]}function ar(e=Be()){return e?Array.from(e.querySelectorAll("[data-scroll-animate]")).map(n=>{let r={props:{}};try{let t=n.dataset.scrollAnimateOptions??"";t&&(r=JSON.parse(t));}catch{}return Lt(n,r)}):[]}function lr(e=Be()){return e?Array.from(e.querySelectorAll("[data-scroll-counter]")).map(n=>{let r={};try{let t=n.dataset.scrollCounterOptions??"";t&&(r=JSON.parse(t));}catch{}return !r.to&&r.to!==0&&(K('initScrollCounter: element missing "to" in options JSON:',n),r.to=0),Ct(n,r)}):[]}function cr(e=Be()){return e?Array.from(e.querySelectorAll("[data-scroll-text]")).map(n=>{let r={};try{let t=n.dataset.scrollTextOptions??"";t&&(r=JSON.parse(t));}catch{}return It(n,r)}):[]}function Wr(e=Be()){return {draw:ir(e),animate:ar(e),counter:lr(e),text:cr(e)}}export{Wr as initAll,ar as initScrollAnimate,lr as initScrollCounter,ir as initScrollDraw,cr as initScrollText,sr as scrollDraw};
|
|
3
|
+
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),{el:t,destroy(){window.removeEventListener("scroll",l),t.remove();}}}var At=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Mt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Qt(e,n,r){if(!Be)return;let t=(e.match(Mt)??[]).join("").toUpperCase(),l=(n.match(Mt)??[]).join("").toUpperCase(),s=(e.match(At)??[]).length,c=(n.match(At)??[]).length;if(t!==l){K(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${l||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}s!==c&&K(`morphTo: coordinate count differs (${s} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function it(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let c=parseFloat(s),u=t[l++]??c;return String(+(c+(u-c)*r).toFixed(4))})}function et(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,l=r?{...wt[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:d="linear",trigger:S={},stagger:_=0,direction:x="forward",once:ne=false,debug:ke=false,axis:j="y",scrollContainer:oe,autoReverse:se=false,delay:ee=0,strokeColor:T,strokeWidth:W,fillOpacity:L,waypoints:A,velocityScale:F=false,threshold:B=0,rootMargin:C="0px",repeat:M=0,repeatDelay:me=0,morphTo:D,clip:de,autoplay:ve=false,duration:ge=1e3,native:Ee=true,onProgress:g,onStart:v,onComplete:y,onEnter:$,onLeave:ye,onEnterBack:he,onLeaveBack:Pe}=l,te=de===true?"left":typeof de=="string"?de:false,be=typeof d=="function"?d:ue[d]??ue.linear,Ae=Se(S.start??"top bottom"),He=Se(S.end??"bottom top"),fe=typeof oe=="string"?document.querySelector(oe):oe??null,pe=Array.isArray(T)?T[0]:null,Y=Array.isArray(T)?T[1]:typeof T=="string"?T:null,X=Array.isArray(W)?W[0]:null,z=Array.isArray(W)?W[1]:typeof W=="number"?W:null,re=Array.isArray(L)?L[0]:null,G=Array.isArray(L)?L[1]:typeof L=="number"?L:null;function Me(o){let a=o*100;switch(te){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let k=te?[]:Array.from(e.querySelectorAll(c)),E=[],i=[],f=0,ie=0,O=false,R=false,N=0,xe=false,ae=-1,U=-1,V=false,le=0,Ce=0,Re,tt=null;function lt(){tt?.destroy(),tt=null;}let Fe=new Set,ct=NaN,Ne=true,je=-1,ut=performance.now(),_e=NaN;function rt(){return fe?j==="x"?fe.scrollLeft:fe.scrollTop:j==="x"?window.scrollX:window.scrollY}function mt(){return fe?j==="x"?fe.clientWidth:fe.clientHeight:j==="x"?window.innerWidth:window.innerHeight}function ft(){let o=Ze(e,fe,j);return Le(o,o.scroll,mt(),Ae,He)}function pt(){(({tStart:f,tEnd:ie}=ft())),ke&&Be&&(lt(),tt=Jt(f,ie,j));}function nt(o,a=ft){Oe(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let b=o.destroy;return o.destroy=()=>{b.call(o),Ie(e);},o}function Ft(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),te){let b=a==="reverse"?1-o:o;e.style.clipPath=Me(b);return}k.forEach((b,J)=>{b.style.strokeDashoffset=a==="reverse"?`${E[J]*o}`:`${E[J]*(1-o)}`,m&&(b.style.opacity=a==="reverse"?`${1-o}`:`${o}`),pe&&Y?b.style.stroke=Ve(pe,Y,o):Y&&(b.style.stroke=Y),X!==null&&z!==null?b.style.strokeWidth=`${X+(z-X)*o}`:z!==null&&(b.style.strokeWidth=`${z}`),re!==null&&G!==null?b.style.fillOpacity=`${re+(G-re)*o}`:G!==null&&(b.style.fillOpacity=`${G}`),D&&b.tagName.toLowerCase()==="path"&&i[J]&&b.setAttribute("d",it(i[J],D,o));});}function Ue(){if(e.style.setProperty("--scroll-draw-progress","0"),te){e.style.clipPath=Me(0);return}k.forEach((o,a)=>{o.style.strokeDasharray=`${E[a]}`,o.style.strokeDashoffset=x==="reverse"?"0":`${E[a]}`,m?o.style.opacity=x==="reverse"?"1":"0":o.style.opacity="",pe&&(o.style.stroke=pe),X!==null&&(o.style.strokeWidth=`${X}`),re!==null&&(o.style.fillOpacity=`${re}`),D&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(k.forEach(o=>{Xt(o);let a=ze(o);E.push(a);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),D&&(b?Qt(i[i.length-1],D,o):K(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=x==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),Y&&(o.style.stroke=Y),z!==null&&(o.style.strokeWidth=`${z}`),G!==null&&(o.style.fillOpacity=`${G}`),D&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",D)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=x==="reverse"?"0":`${a}`,m?o.style.opacity=x==="reverse"?"1":"0":o.style.opacity="",pe&&(o.style.stroke=pe),X!==null&&(o.style.strokeWidth=`${X}`),re!==null&&(o.style.fillOpacity=`${re}`));}),te){if(s)return e.style.clipPath=Me(1),y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Me(0);}else if(s)return y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let dt=typeof d=="string"?Ke(d):null;function Nt(){return !(Ee===false||!Yt()||!k.length||!dt||te||j!=="y"||fe||u!==1||_!==0||ne||se||F!==false||D||A||M||ee>0||g||v||y||$||ye||he||Pe||T!=null||W!=null||L!=null||(S.start??"top bottom").trim()!=="top bottom"||(S.end??"bottom top").trim()!=="bottom top")}function Ht(){let o=++Ut,a=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,J=`--svg-scroll-draw-${o}`,De=x==="reverse"?"0":"var(--ssd-len)",$e=x==="reverse"?"var(--ssd-len)":"0",Te=`stroke-dashoffset:${De};`,w=`stroke-dashoffset:${$e};`;m&&(Te+=`opacity:${x==="reverse"?1:0};`,w+=`opacity:${x==="reverse"?0:1};`);let P=document.createElement("style");P.setAttribute("data-svg-scroll-draw",""),P.textContent=`@keyframes ${a}{from{${Te}}to{${w}}}.${b}{view-timeline-name:${J};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${dt};animation-fill-mode:both;animation-timeline:${J};animation-range:cover 0% cover 100%;}`,document.head.appendChild(P),e.classList.add(b);function Q(p,q){p.style.setProperty("--ssd-len",String(E[q])),p.style.strokeDasharray=`${E[q]}`,p.style.strokeDashoffset="",p.style.opacity="",p.style.animationPlayState="",p.classList.add(a);}k.forEach(Q);let h=false,I=-1;function H(){if(I>=0)return I;let p=e.getBoundingClientRect(),{tStart:q,tEnd:we}=Le({top:p.top,height:p.height},rt(),mt(),Ae,He);return be(Z(rt(),q,we,u))}return {destroy(){e.classList.remove(b),k.forEach(p=>{p.classList.remove(a),p.style.removeProperty("--ssd-len"),p.style.animationPlayState="";}),P.remove();},replay(){h=false,I=-1,k.forEach(Q);},pause(){h=true,k.forEach(p=>{p.style.animationPlayState="paused";});},resume(){h&&(h=false,k.forEach(p=>{p.style.animationPlayState="running";}));},seek(p){let q=Math.min(1,Math.max(0,p));I=q,h=true,k.forEach((we,ce)=>{we.classList.remove(a),we.style.strokeDashoffset=x==="reverse"?`${E[ce]*q}`:`${E[ce]*(1-q)}`,m&&(we.style.opacity=x==="reverse"?`${1-q}`:`${q}`);});},getProgress(){return H()},refresh(){k.forEach((p,q)=>{E[q]=ze(p),p.style.setProperty("--ssd-len",String(E[q])),p.style.strokeDasharray=`${E[q]}`;});}}}if(Nt())return nt(Ht());function _t(){let o=Math.max(1,ge),a=0,b=0,J=false;function De(h){let I=true;if(te){let H=Math.min(1,Math.max(0,h/o)),p=be(H);le=p,e.style.setProperty("--scroll-draw-progress",String(p)),e.style.clipPath=Me(x==="reverse"?1-p:p),g?.(p),H<1&&(I=false);}else k.forEach((H,p)=>{let q=p*_*o,we=Math.min(1,Math.max(0,(h-q)/o)),ce=be(we);H.style.strokeDashoffset=x==="reverse"?`${E[p]*ce}`:`${E[p]*(1-ce)}`,m&&(H.style.opacity=x==="reverse"?`${1-ce}`:`${ce}`),pe&&Y?H.style.stroke=Ve(pe,Y,ce):Y&&(H.style.stroke=Y),X!==null&&z!==null?H.style.strokeWidth=`${X+(z-X)*ce}`:z!==null&&(H.style.strokeWidth=`${z}`),re!==null&&G!==null?H.style.fillOpacity=`${re+(G-re)*ce}`:G!==null&&(H.style.fillOpacity=`${G}`),D&&H.tagName.toLowerCase()==="path"&&i[p]&&H.setAttribute("d",it(i[p],D,ce)),p===0&&(le=ce,g?.(ce),e.style.setProperty("--scroll-draw-progress",String(ce))),we<1&&(I=false);});if(A){let H=Math.min(1,Math.max(0,h/o)),p=be(H);for(let q in A){let we=parseFloat(q);p>=we&&!Fe.has(we)&&(Fe.add(we),A[q]?.());}}return I}function $e(h){if(V)return;let I=h-a;R||(R=true,v?.());let H=De(I);if(H&&!O){O=true,De(o*(1+Math.max(0,k.length-1)*_)),y?.(),Ce<(M==="infinite"?1/0:M??0)&&(Ce++,Re=setTimeout(()=>{a=performance.now(),R=false,O=false,Fe.clear(),Ue(),N=requestAnimationFrame($e);},me));return}H||(N=requestAnimationFrame($e));}function Te(){cancelAnimationFrame(N),clearTimeout(Re),a=performance.now(),b=0,V=false,R=false,O=false,Ce=0,J=true,le=0,Fe.clear(),Ue(),N=requestAnimationFrame($e);}let w=new IntersectionObserver(h=>{h.forEach(I=>{I.isIntersecting&&!(ne&&O)?Te():!I.isIntersecting&&!ne&&!O&&(cancelAnimationFrame(N),clearTimeout(Re),J=false);});},{root:fe??null,threshold:B,rootMargin:C}),P;function Q(){clearTimeout(P),P=setTimeout(()=>{k.forEach((h,I)=>{E[I]=ze(h),h.style.strokeDasharray=`${E[I]}`;});},150);}return window.addEventListener("resize",Q),window.addEventListener("orientationchange",Q),ee>0?setTimeout(()=>w.observe(e),ee):w.observe(e),{destroy(){cancelAnimationFrame(N),clearTimeout(Re),w.disconnect(),window.removeEventListener("resize",Q),window.removeEventListener("orientationchange",Q),clearTimeout(P);},replay(){Ce=0,Te();},pause(){V||!J||(V=true,b=performance.now()-a,cancelAnimationFrame(N));},resume(){V&&(V=false,J=true,a=performance.now()-b,N=requestAnimationFrame($e));},seek(h){let I=Math.min(1,Math.max(0,h));le=I,V=true,b=I*o,a=performance.now()-b,cancelAnimationFrame(N),De(b);},getProgress(){return le},refresh(){clearTimeout(P),k.forEach((h,I)=>{E[I]=ze(h),h.style.strokeDasharray=`${E[I]}`;});}}}if(ve)return nt(_t());pt();function Ye(){if(!xe||V)return;let o=performance.now(),a=rt();if(!Ne&&F===false&&a===ct){N=requestAnimationFrame(Ye);return}Ne=false,ct=a;let b=u;if(F!==false){let w=o-ut,P=w>0?Math.abs(a-(je<0?a:je))/w:0;b=u*Math.max(.2,1+P*(typeof F=="number"?F:1)*.04);}je=a,ut=o;let J=se?U===-1||a>=U?"forward":"reverse":x;U=a;let De=ie-f,$e=true,Te=De===0?0:(a-f)/De;if(isNaN(_e)||(_e<=0&&Te>0?$?.():_e>0&&Te<=0&&Pe?.(),_e<1&&Te>=1?ye?.():_e>=1&&Te<1&&he?.()),_e=Te,te){let w=be(Z(a,f,ie,b));ne&&!se&&(ae=Math.max(ae,w),w=ae),le=w,e.style.setProperty("--scroll-draw-progress",String(w));let P=J==="reverse"?1-w:w;e.style.clipPath=Me(P),g?.(w),!R&&Z(a,f,ie,b)>0&&(R=true,v?.()),w>=1&&!O?(O=true,y?.(),Ce<(M==="infinite"?1/0:M??0)&&(Ce++,Re=setTimeout(()=>{ae=-1,R=false,O=false,e.style.clipPath=Me(0);},me))):w<1&&!ne&&(O=false),N=requestAnimationFrame(Ye);return}if(k.forEach((w,P)=>{let Q=P*_*De,h=be(Z(a,f+Q,ie+Q,b));ne&&!se&&(ae=Math.max(ae,h),h=ae),le=h,w.style.strokeDashoffset=J==="reverse"?`${E[P]*h}`:`${E[P]*(1-h)}`,m&&(w.style.opacity=J==="reverse"?`${1-h}`:`${h}`),pe&&Y?w.style.stroke=Ve(pe,Y,h):Y&&(w.style.stroke=Y),X!==null&&z!==null?w.style.strokeWidth=`${X+(z-X)*h}`:z!==null&&(w.style.strokeWidth=`${z}`),re!==null&&G!==null?w.style.fillOpacity=`${re+(G-re)*h}`:G!==null&&(w.style.fillOpacity=`${G}`),D&&w.tagName.toLowerCase()==="path"&&i[P]&&w.setAttribute("d",it(i[P],D,h)),P===0&&(g?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&($e=false);}),A){let w=be(Z(a,f,ie,b));for(let P in A){let Q=parseFloat(P);w>=Q&&!Fe.has(Q)&&(Fe.add(Q),A[P]?.());}}!R&&Z(a,f,ie,b)>0&&(R=true,v?.()),$e&&!O?(O=true,y?.(),Ce<(M==="infinite"?1/0:M??0)&&(Ce++,Re=setTimeout(()=>{ae=-1,R=false,O=false,Fe.clear(),Ue(),Ne=true;},me))):!$e&&!ne&&(O=false),N=requestAnimationFrame(Ye);}let ot=false;function Xe(){ot||(ot=true,N=requestAnimationFrame(function(){Ye();}));}function Je(){ot=false,cancelAnimationFrame(N);}let st=new IntersectionObserver(o=>{o.forEach(a=>{xe=a.isIntersecting,xe&&!V?(Ne=true,Xe()):Je();});},{root:fe??null,threshold:B,rootMargin:C});function gt(){k.forEach((o,a)=>{E[a]=ze(o),o.style.strokeDasharray=`${E[a]}`;}),pt(),Ne=true;}let Qe;function qe(){clearTimeout(Qe),Qe=setTimeout(gt,150);}window.addEventListener("resize",qe),window.addEventListener("orientationchange",qe);let We;return typeof ResizeObserver<"u"&&(We=new ResizeObserver(()=>qe()),We.observe(document.body),We.observe(document.documentElement),We.observe(e)),ee>0?setTimeout(()=>st.observe(e),ee):st.observe(e),nt({destroy(){cancelAnimationFrame(N),clearTimeout(Re),Je(),st.disconnect(),We?.disconnect(),window.removeEventListener("resize",qe),window.removeEventListener("orientationchange",qe),clearTimeout(Qe),lt();},replay(){ae=-1,U=-1,je=-1,R=false,O=false,Ce=0,V=false,le=0,Fe.clear(),clearTimeout(Re),Ue(),Ne=true,xe&&Xe();},pause(){V=true,Je();},resume(){V&&(V=false,Ne=true,xe&&Xe());},seek(o){let a=Math.min(1,Math.max(0,o));le=a,ae=a,V=true,Je(),Ft(a,x),Ne=true;},getProgress(){return le},refresh(){clearTimeout(Qe),gt(),xe&&!V&&Xe();}},()=>({tStart:f,tEnd:ie}))}function Zt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function $t(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let l=[],s=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}n.push({fn:t[1],nums:l,units:s});}return n}function Kt(e,n,r){let t=$t(e),l=$t(n);return t.length===0||t.length!==l.length?r<1?e:n:t.map((s,c)=>{let u=l[c];return s.fn!==u.fn||s.nums.length!==u.nums.length?r<1?`${s.fn}(${s.nums.map((m,d)=>`${m}${s.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,d)=>`${m}${u.units[d]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,d)=>`${m+(u.nums[d]-m)*r}${s.units[d]}`).join(", ")})`}).join(" ")}function Lt(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),l=String(n);if(Zt(t))return Ve(t,l,r);if(t.includes("("))return Kt(t,l,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),c=l.match(/^([-+]?[\d.]+)(.*)$/);if(s&&c){let u=parseFloat(s[1]),m=parseFloat(c[1]);return `${u+(m-u)*r}${s[2]||c[2]}`}return r<1?t:l}function er(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var tr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),rr=0,Pt="--scroll-draw-progress";function nr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Ct(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:l={},easing:s="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:d,native:S=true,velocityScale:_=false,respectReducedMotion:x=true,triggerElement:ne,onProgress:ke,onComplete:j,onEnter:oe,onLeave:se,onEnterBack:ee,onLeaveBack:T}=n,W=x&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof s=="function"?s:ue[s]??ue["ease-out"],A=Se(l.start??"top bottom"),F=Se(l.end??"bottom top"),B=ne??e,C=typeof d=="string"?document.querySelector(d):d??null,M=Object.entries(t).map(([i,f])=>({prop:er(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function me(){let i=window.getComputedStyle(e);for(let f of M)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function D(){for(let i of M)e.style.setProperty(i.prop,String(i.to));}let de=new Map;for(let i of [...M.map(f=>f.prop),Pt])de.set(i,e.style.getPropertyValue(i));function ve(){for(let[i,f]of de)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if(W)return D(),j?.(),{...r,destroy:ve,getProgress:()=>1};me();let ge=typeof s=="string"?Ke(s):null;function Ee(){if(!S||!nr()||!ge||m!=="y"||C||B!==e||u||c!==1||ke||j||oe||se||ee||T||_!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of M)if(!tr.has(i.prop))return false;return true}function g(){let i=`ssd-a-${++rr}`,f=M.map(U=>`${U.prop}:${U.from}`).join(";"),ie=M.map(U=>`${U.prop}:${U.to}`).join(";"),O=document.createElement("style");O.setAttribute("data-ssd-animate",""),O.textContent=`@keyframes ${i}{from{${f}}to{${ie}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ge};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(O),e.classList.add(i);let R=()=>m==="x"?window.scrollX:window.scrollY,N=()=>m==="x"?window.innerWidth:window.innerHeight,xe=()=>{let U=e.getBoundingClientRect();return Le({top:U.top,height:U.height},R(),N(),A,F)};Oe(e,{type:"animate",getProgress:()=>ae.getProgress(),getTrigger:xe});let ae={destroy(){e.classList.remove(i),O.remove(),e.style.animationPlayState="",ve(),Ie(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(U){let V=Math.min(1,Math.max(0,U));e.classList.remove(i);for(let le of M)e.style.setProperty(le.prop,Lt(le.from,le.to,V));},getProgress(){let{tStart:U,tEnd:V}=xe();return L(Z(R(),U,V,c))}};return ae}if(Ee())return g();let v=0,y=0,$=0,ye=false,he=false,Pe=-1,te=0,be=false,Ae=NaN,He=-1,fe=0,pe=()=>C?m==="x"?C.scrollLeft:C.scrollTop:m==="x"?window.scrollX:window.scrollY,Y=()=>C?m==="x"?C.clientWidth:C.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function X(){let i=Ze(B,C,m),f=Le(i,i.scroll,Y(),A,F);v=f.tStart,y=f.tEnd;}function z(i){e.style.setProperty(Pt,String(i));for(let f of M)e.style.setProperty(f.prop,Lt(f.from,f.to,i));ke?.(i);}function re(i){if(isNaN(Ae)){Ae=i;return}Ae<=0&&i>0?oe?.():Ae>0&&i<=0&&T?.(),Ae<1&&i>=1?se?.():Ae>=1&&i<1&&ee?.(),Ae=i;}function G(){if(!ye||he)return;let i=performance.now(),f=pe(),ie=c;if(_!==false){let N=i-fe,xe=N>0?Math.abs(f-(He<0?f:He))/N:0;ie=c*Math.max(.2,1+xe*(typeof _=="number"?_:1)*.04);}He=f,fe=i;let O=y===v?0:(f-v)/(y-v);re(O);let R=L(Z(f,v,y,ie));u&&(Pe=Math.max(Pe,R),R=Pe),te=R,z(R),R>=1&&!be?(be=true,j?.()):R<1&&!u&&(be=false),$=requestAnimationFrame(G);}X(),y===v&&K("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=L(Z(pe(),v,y,c));u&&i>0&&(Pe=i),te=i,z(i);}let Me=new IntersectionObserver(i=>{i.forEach(f=>{ye=f.isIntersecting,ye&&!he?$=requestAnimationFrame(G):cancelAnimationFrame($);});},{root:C??null}),k;function E(){clearTimeout(k),k=setTimeout(X,150);}return window.addEventListener("resize",E),window.addEventListener("orientationchange",E),Me.observe(e),Oe(e,{type:"animate",getProgress:()=>te,getTrigger:()=>({tStart:v,tEnd:y})}),{destroy(){cancelAnimationFrame($),Me.disconnect(),window.removeEventListener("resize",E),window.removeEventListener("orientationchange",E),clearTimeout(k),ve(),Ie(e);},replay(){Pe=-1,be=false,te=0,he=false,z(0);},pause(){he=true,cancelAnimationFrame($);},resume(){he&&(he=false,ye&&($=requestAnimationFrame(G)));},seek(i){let f=Math.min(1,Math.max(0,i));te=f,Pe=f,he=true,cancelAnimationFrame($),z(f);},getProgress(){return te}}}var at={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Dt(e,n){if(typeof window>"u")return at;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return K("scrollCounter: element not found:",e),at;let t=r,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:d=true,decimals:S,onComplete:_}=n,x=S!==void 0?g=>g.toFixed(S):c??(g=>String(Math.round(g))),ne=typeof u=="function"?u:ue[u]??ue["ease-out"],ke=Se(m.start??"top 80%"),j=Se(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=x(s),_?.(),at;let se=0,ee=0,T=0,W=false,L=false,A=-1,F=0,B=false,C=()=>window.scrollY,M=()=>window.innerHeight;function me(){let g=t.getBoundingClientRect(),v=Le({top:g.top,height:g.height},C(),M(),ke,j);se=v.tStart,ee=v.tEnd;}function D(g){t.textContent=x(l+(s-l)*g),t.style.setProperty("--scroll-draw-progress",String(g));}function de(){if(!W||L)return;let g=ne(Z(C(),se,ee,1));d&&(A=Math.max(A,g),g=A),F=g,D(g),g>=1&&!B?(B=true,_?.()):g<1&&!d&&(B=false),T=requestAnimationFrame(de);}me();{let g=ne(Z(C(),se,ee,1));d&&g>0&&(A=g),F=g,D(g);}let ve=new IntersectionObserver(g=>{g.forEach(v=>{W=v.isIntersecting,W&&!L?T=requestAnimationFrame(de):cancelAnimationFrame(T);});}),ge;function Ee(){clearTimeout(ge),ge=setTimeout(me,150);}return window.addEventListener("resize",Ee),window.addEventListener("orientationchange",Ee),ve.observe(t),Oe(t,{type:"counter",getProgress:()=>F,getTrigger:()=>({tStart:se,tEnd:ee})}),{destroy(){cancelAnimationFrame(T),ve.disconnect(),window.removeEventListener("resize",Ee),window.removeEventListener("orientationchange",Ee),clearTimeout(ge),Ie(t);},replay(){A=-1,B=false,F=0,L=false,D(0);},pause(){L=true,cancelAnimationFrame(T);},resume(){L&&(L=false,W&&(T=requestAnimationFrame(de)));},seek(g){let v=Math.min(1,Math.max(0,g));F=v,A=v,L=true,cancelAnimationFrame(T),D(v);},getProgress(){return F}}}function kt(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(r)?(t.textContent=r,t.style.whiteSpace="pre"):(t.textContent=r,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(r)?null:t}).filter(r=>r!==null)}function or(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function Ot(e){let n=kt(e),r=new Map;for(let s of n){let c=s.offsetTop;r.has(c)||r.set(c,[]),r.get(c).push(s);}let t=[],l=Array.from(r.keys()).sort((s,c)=>s-c);for(let s of l){let c=r.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,d)=>{let S=m.nextElementSibling;u.appendChild(m),d<c.length-1&&S&&S.style.whiteSpace==="pre"&&u.appendChild(S);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function sr(e,n,r,t){if(r<=1||t===0)return e;let l=(r-1)*t,s=n*t,c=s+(1-l);return c<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(c-s)))}function ir(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var It={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Rt(e,n={}){if(typeof window>"u")return It;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return K("scrollText: element not found:",e),It;let t=r,{split:l="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:d=true,onComplete:S}=n,_=window.matchMedia("(prefers-reduced-motion: reduce)").matches,x=typeof c=="function"?c:ue[c]??ue["ease-out"],ne=Se(m.start??"top 85%"),ke=Se(m.end??"top 40%"),j=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let oe;l==="chars"?oe=or(t):l==="lines"?oe=Ot(t):oe=kt(t);let se=oe.length;function ee(y,$){u?.opacity!==void 0&&(y.style.opacity=String(u.opacity+(1-u.opacity)*$));let ye=ir($,u);ye&&(y.style.transform=ye);}function T(y){t.style.setProperty("--scroll-draw-progress",String(y)),oe.forEach(($,ye)=>{let he=x(sr(y,ye,se,s));ee($,he);});}if(_)return T(1),S?.(),{destroy(){t.innerHTML=j,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};T(0);let W=0,L=0,A=0,F=false,B=false,C=-1,M=0,me=false,D=()=>window.scrollY,de=()=>window.innerHeight;function ve(){let y=t.getBoundingClientRect(),$=Le({top:y.top,height:y.height},D(),de(),ne,ke);W=$.tStart,L=$.tEnd;}function ge(){if(!F||B)return;let y=Z(D(),W,L,1);d&&(C=Math.max(C,y),y=C),M=y,T(y),y>=1&&!me?(me=true,S?.()):y<1&&!d&&(me=false),A=requestAnimationFrame(ge);}ve();let Ee=new IntersectionObserver(y=>{y.forEach($=>{F=$.isIntersecting,F&&!B?A=requestAnimationFrame(ge):cancelAnimationFrame(A);});}),g;function v(){clearTimeout(g),g=setTimeout(()=>{if(l==="lines"){let y=M;t.innerHTML=j,t.setAttribute("aria-label",t.textContent??""),oe=Ot(t),T(y);}ve();},150);}return window.addEventListener("resize",v),window.addEventListener("orientationchange",v),Ee.observe(t),Oe(t,{type:"text",getProgress:()=>M,getTrigger:()=>({tStart:W,tEnd:L})}),{destroy(){cancelAnimationFrame(A),Ee.disconnect(),window.removeEventListener("resize",v),window.removeEventListener("orientationchange",v),clearTimeout(g),t.innerHTML=j,t.removeAttribute("aria-label"),Ie(t);},replay(){C=-1,me=false,M=0,B=false,T(0);},pause(){B=true,cancelAnimationFrame(A);},resume(){B&&(B=false,F&&(A=requestAnimationFrame(ge)));},seek(y){let $=Math.min(1,Math.max(0,y));M=$,C=$,B=true,cancelAnimationFrame(A),T($);},getProgress(){return M}}}function ar(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let t=typeof e=="string"?document.querySelector(e):e;return t?et(t,n):(K("Container not found:",e),r)}function Ge(){return typeof document>"u"?null:document}function lr(e=Ge()){return e?Array.from(e.querySelectorAll("[data-scroll-draw]")).map(n=>{let r={};try{let t=n.dataset.scrollDrawOptions??n.dataset.scrollDrawoptions??"";t&&(r=JSON.parse(t));}catch{}return et(n,r)}):[]}function cr(e=Ge()){return e?Array.from(e.querySelectorAll("[data-scroll-animate]")).map(n=>{let r={props:{}};try{let t=n.dataset.scrollAnimateOptions??"";t&&(r=JSON.parse(t));}catch{}return Ct(n,r)}):[]}function ur(e=Ge()){return e?Array.from(e.querySelectorAll("[data-scroll-counter]")).map(n=>{let r={};try{let t=n.dataset.scrollCounterOptions??"";t&&(r=JSON.parse(t));}catch{}return !r.to&&r.to!==0&&(K('initScrollCounter: element missing "to" in options JSON:',n),r.to=0),Dt(n,r)}):[]}function mr(e=Ge()){return e?Array.from(e.querySelectorAll("[data-scroll-text]")).map(n=>{let r={};try{let t=n.dataset.scrollTextOptions??"";t&&(r=JSON.parse(t));}catch{}return Rt(n,r)}):[]}function Gr(e=Ge()){return {draw:lr(e),animate:cr(e),counter:ur(e),text:mr(e)}}export{Gr as initAll,cr as initScrollAnimate,ur as initScrollCounter,lr as initScrollDraw,mr as initScrollText,ar as scrollDraw};
|
|
@@ -309,11 +309,25 @@ var SvgScrollDraw = (() => {
|
|
|
309
309
|
// animation-timeline reference would not resolve and nothing would animate.
|
|
310
310
|
CSS.supports("view-timeline-name: --x");
|
|
311
311
|
}
|
|
312
|
+
function paintOf(el, prop) {
|
|
313
|
+
let computed = "";
|
|
314
|
+
try {
|
|
315
|
+
computed = getComputedStyle(el).getPropertyValue(prop).trim();
|
|
316
|
+
} catch {
|
|
317
|
+
}
|
|
318
|
+
return computed || (el.getAttribute(prop) ?? "").trim();
|
|
319
|
+
}
|
|
320
|
+
var NO_PAINT = /* @__PURE__ */ new Set(["", "none", "transparent", "rgba(0, 0, 0, 0)"]);
|
|
312
321
|
function checkElement(el) {
|
|
313
|
-
|
|
314
|
-
const
|
|
315
|
-
if (!stroke || stroke === "none")
|
|
316
|
-
|
|
322
|
+
if (!IS_DEV) return;
|
|
323
|
+
const stroke = paintOf(el, "stroke");
|
|
324
|
+
if (!stroke || stroke === "none") {
|
|
325
|
+
warn("Element has no stroke \u2014 path will not be visible.", el);
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
const declaredFill = (el.getAttribute("fill") ?? "").trim();
|
|
329
|
+
if (declaredFill && !NO_PAINT.has(declaredFill) && !NO_PAINT.has(paintOf(el, "fill")))
|
|
330
|
+
warn("Element has a fill \u2014 it may obscure the stroke animation.", el);
|
|
317
331
|
}
|
|
318
332
|
function createDebugOverlay(tStart, tEnd, axis) {
|
|
319
333
|
const overlay = document.createElement("div");
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var SvgScrollDraw=(()=>{var lt=Object.defineProperty;var
|
|
1
|
+
"use strict";var SvgScrollDraw=(()=>{var lt=Object.defineProperty;var jt=Object.getOwnPropertyDescriptor;var Yt=Object.getOwnPropertyNames;var Ut=Object.prototype.hasOwnProperty;var Xt=(e,t)=>{for(var r in t)lt(e,r,{get:t[r],enumerable:!0})},Qt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Yt(t))!Ut.call(e,i)&&i!==r&<(e,i,{get:()=>t[i],enumerable:!(n=jt(t,i))||n.enumerable});return e};var Zt=e=>Qt(lt({},"__esModule",{value:!0}),e);var br={};Xt(br,{Cinematic:()=>rt,PRESETS:()=>Ze,createBounce:()=>ct,createElastic:()=>ut,createSpring:()=>$t,scrollAnimate:()=>Ht,scrollCounter:()=>Vt,scrollDraw:()=>hr,scrollParallax:()=>_t});function $t({tension:e=2.5,friction:t=2.2}={}){return r=>1-Math.cos(r*Math.PI*e)*Math.pow(1-r,t)}function ct({bounces:e=3,decay:t=.5}={}){let r=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,t)),i=Math.sqrt(n),a=0,f=[];for(let p=0;p<r;p++){let x=Math.pow(i,p);f.push(x),a+=x}let m=[0],c=0;for(let p=0;p<r;p++)c+=f[p]/a,m.push(c);return p=>{if(p<=0)return 0;if(p>=1)return 1;for(let x=0;x<r;x++)if(p<=m[x+1]){let I=(p-m[x])/(m[x+1]-m[x]);if(x===0)return I*(2-I);let A=1-Math.pow(n,x);return A+(1-A)*(2*I-1)*(2*I-1)}return 1}}function ut({amplitude:e=1,period:t=.4}={}){let r=Math.max(1,e),n=Math.max(.1,t),i=r<=1?n/4:n/(2*Math.PI)*Math.asin(1/r);return a=>a<=0?0:a>=1?1:r*Math.pow(2,-10*a)*Math.sin((a-i)*(2*Math.PI)/n)+1}var Z={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:ct(),elastic:ut()};function $e(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return{element:"top",viewport:t};let[r="top",n="bottom"]=t.split(/\s+/).filter(Boolean);return{element:r,viewport:n}}function xt(e,t,r,n){switch(n){case"top":return e+r;case"center":return e+r+t/2;case"bottom":return e+r+t;default:return e+r}}function Tt(e,t){if(/^\d+(\.\d+)?%$/.test(e))return t*(parseFloat(e)/100);switch(e){case"top":return 0;case"center":return t/2;case"bottom":return t;default:return t}}function Ve(e){let t=e.tagName.toLowerCase();if(t==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),n=parseFloat(e.getAttribute("height")??"0");return 2*(r+n)}if(t==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function Kt(e,t,r){return Math.min(r,Math.max(t,e))}function le(e,t,r,n){return r===t?0:Kt((e-t)/(r-t)*n,0,1)}function Qe(e,t,r){let n=e.getBoundingClientRect(),i=r==="x"?n.width:n.height;return t?{top:r==="x"?n.left-t.getBoundingClientRect().left+t.scrollLeft:n.top-t.getBoundingClientRect().top+t.scrollTop,height:i,scroll:0}:{top:r==="x"?n.left:n.top,height:i,scroll:r==="x"?window.scrollX:window.scrollY}}function Fe(e,t,r,n,i){let a=xt(e.top,e.height,t,n.element)-Tt(n.viewport,r),f=xt(e.top,e.height,t,i.element)-Tt(i.viewport,r);return{tStart:a,tEnd:f}}function At(e){let t=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(t)return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let n=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return n?[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])]:null}function ze(e,t,r){let n=At(e),i=At(t);return!n||!i?e:`rgb(${Math.round(n[0]+(i[0]-n[0])*r)},${Math.round(n[1]+(i[1]-n[1])*r)},${Math.round(n[2]+(i[2]-n[2])*r)})`}var Ze={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:!1},reveal:{easing:"ease-out",fade:!0,speed:1.2,once:!0},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:!0,speed:.75},spring:{easing:"spring",speed:1.1}};function K(e,...t){}var Jt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",er="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Mt=33;function tr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function rr(e){let t=[];for(let r=0;r<Mt;r++){let n=r/(Mt-1);t.push(String(Math.round(e(n)*1e5)/1e5))}return`linear(${t.join(",")})`}function Ke(e){switch(e){case"linear":return"linear";case"ease-in":return Jt;case"ease-out":return er;case"ease-in-out":return tr()?rr(Z["ease-in-out"]):null;default:return null}}var Pt=Symbol.for("svg-scroll-draw.registry");function kt(){let e=globalThis;return e[Pt]||(e[Pt]=new Map)}function Me(e,t){kt().set(e,t)}function Pe(e){kt().delete(e)}var nr=0;function or(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Lt(e,t){let r="";try{r=getComputedStyle(e).getPropertyValue(t).trim()}catch{}return r||(e.getAttribute(t)??"").trim()}var Ct=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function sr(e){if(!!1)return;let t=Lt(e,"stroke");if(!t||t==="none"){K("Element has no stroke \u2014 path will not be visible.",e);return}let r=(e.getAttribute("fill")??"").trim();r&&!Ct.has(r)&&!Ct.has(Lt(e,"fill"))&&K("Element has a fill \u2014 it may obscure the stroke animation.",e)}function ir(e,t,r){let n=document.createElement("div");n.setAttribute("data-svg-scroll-draw-debug",""),n.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function i(){let a=r==="x"?window.scrollX:window.scrollY,f=e-a,m=t-a,c=r==="x";n.innerHTML=`
|
|
2
2
|
<div style="position:absolute;${c?`left:${f}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${f}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
-
<div style="position:absolute;${c?`left:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`}return document.body.appendChild(n),window.addEventListener("scroll",i,{passive:!0}),i(),{el:n,destroy(){window.removeEventListener("scroll",i),n.remove()}}}var kt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Lt=/[MmLlHhVvCcSsQqTtAaZz]/g;function sr(e,t,r){if(!!1)return;let n=(e.match(Lt)??[]).join("").toUpperCase(),i=(t.match(Lt)??[]).join("").toUpperCase(),a=(e.match(kt)??[]).length,f=(t.match(kt)??[]).length;if(n!==i){K(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${i||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}a!==f&&K(`morphTo: coordinate count differs (${a} \u2192 ${f}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r)}function mt(e,t,r){let n=(t.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),i=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,a=>{let f=parseFloat(a),m=n[i++]??f;return String(+(f+(m-f)*r).toFixed(4))})}function Je(e,t={}){if(typeof window>"u")return{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...n}=t,i=r?{...Ze[r],...n}:n,a=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:f="path, polyline, line, polygon, rect, circle",speed:m=1,fade:c=!1,easing:p="linear",trigger:x={},stagger:I=0,direction:A="forward",once:J=!1,debug:Ee=!1,axis:S="y",scrollContainer:$,autoReverse:g=!1,delay:E=0,strokeColor:b,strokeWidth:z,fillOpacity:F,waypoints:B,velocityScale:ee=!1,threshold:ge=0,rootMargin:j="0px",repeat:q=0,repeatDelay:ke=0,morphTo:N,clip:ye,autoplay:Le=!1,duration:Ce=1e3,native:De=!0,onProgress:w,onStart:P,onComplete:ne,onEnter:he,onLeave:Ne,onEnterBack:be,onLeaveBack:xe}=i,te=ye===!0?"left":typeof ye=="string"?ye:!1,me=typeof p=="function"?p:Z[p]??Z.linear,we=$e(x.start??"top bottom"),He=$e(x.end??"bottom top"),ce=typeof $=="string"?document.querySelector($):$??null,ue=Array.isArray(b)?b[0]:null,Y=Array.isArray(b)?b[1]:typeof b=="string"?b:null,U=Array.isArray(z)?z[0]:null,H=Array.isArray(z)?z[1]:typeof z=="number"?z:null,re=Array.isArray(F)?F[0]:null,W=Array.isArray(F)?F[1]:typeof F=="number"?F:null;function ve(o){let l=o*100;switch(te){case"right":return`inset(0 0 0 ${100-l}%)`;case"top":return`inset(0 0 ${100-l}% 0)`;case"bottom":return`inset(${100-l}% 0 0 0)`;case"center":return`circle(${o*150}% at 50% 50%)`;default:return`inset(0 ${100-l}% 0 0)`}}let C=te?[]:Array.from(e.querySelectorAll(f)),T=[],s=[],u=0,oe=0,k=!1,D=!1,O=0,pe=!1,se=-1,G=-1,_=!1,ie=0,Te=0,Ie,nt=null;function dt(){nt?.destroy(),nt=null}let Oe=new Set,gt=NaN,Re=!0,Be=-1,yt=performance.now(),_e=NaN;function ot(){return ce?S==="x"?ce.scrollLeft:ce.scrollTop:S==="x"?window.scrollX:window.scrollY}function ht(){return ce?S==="x"?ce.clientWidth:ce.clientHeight:S==="x"?window.innerWidth:window.innerHeight}function bt(){let o=Qe(e,ce,S);return Fe(o,o.scroll,ht(),we,He)}function wt(){({tStart:u,tEnd:oe}=bt()),Ee&&!1&&(dt(),nt=or(u,oe,S))}function st(o,l=bt){Me(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:l});let h=o.destroy;return o.destroy=()=>{h.call(o),Pe(e)},o}function Vt(o,l){if(e.style.setProperty("--scroll-draw-progress",String(o)),te){let h=l==="reverse"?1-o:o;e.style.clipPath=ve(h);return}C.forEach((h,X)=>{h.style.strokeDashoffset=l==="reverse"?`${T[X]*o}`:`${T[X]*(1-o)}`,c&&(h.style.opacity=l==="reverse"?`${1-o}`:`${o}`),ue&&Y?h.style.stroke=ze(ue,Y,o):Y&&(h.style.stroke=Y),U!==null&&H!==null?h.style.strokeWidth=`${U+(H-U)*o}`:H!==null&&(h.style.strokeWidth=`${H}`),re!==null&&W!==null?h.style.fillOpacity=`${re+(W-re)*o}`:W!==null&&(h.style.fillOpacity=`${W}`),N&&h.tagName.toLowerCase()==="path"&&s[X]&&h.setAttribute("d",mt(s[X],N,o))})}function Ge(){if(e.style.setProperty("--scroll-draw-progress","0"),te){e.style.clipPath=ve(0);return}C.forEach((o,l)=>{o.style.strokeDasharray=`${T[l]}`,o.style.strokeDashoffset=A==="reverse"?"0":`${T[l]}`,c?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",ue&&(o.style.stroke=ue),U!==null&&(o.style.strokeWidth=`${U}`),re!==null&&(o.style.fillOpacity=`${re}`),N&&o.tagName.toLowerCase()==="path"&&s[l]&&o.setAttribute("d",s[l])})}if(C.forEach(o=>{nr(o);let l=Ve(o);T.push(l);let h=o.tagName.toLowerCase()==="path";h?s.push(o.getAttribute("d")??""):s.push(""),N&&(h?sr(s[s.length-1],N,o):K(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),a?(o.style.strokeDasharray=`${l}`,o.style.strokeDashoffset=A==="reverse"?`${l}`:"0",c&&(o.style.opacity="1"),Y&&(o.style.stroke=Y),H!==null&&(o.style.strokeWidth=`${H}`),W!==null&&(o.style.fillOpacity=`${W}`),N&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",N)):(o.style.strokeDasharray=`${l}`,o.style.strokeDashoffset=A==="reverse"?"0":`${l}`,c?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",ue&&(o.style.stroke=ue),U!==null&&(o.style.strokeWidth=`${U}`),re!==null&&(o.style.fillOpacity=`${re}`))}),te){if(a)return e.style.clipPath=ve(1),ne?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=ve(0)}else if(a)return ne?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let vt=typeof p=="string"?Ke(p):null;function zt(){return!(De===!1||!rr()||!C.length||!vt||te||S!=="y"||ce||m!==1||I!==0||J||g||ee!==!1||N||B||q||E>0||w||P||ne||he||Ne||be||xe||b!=null||z!=null||F!=null||(x.start??"top bottom").trim()!=="top bottom"||(x.end??"bottom top").trim()!=="bottom top")}function qt(){let o=++tr,l=`svg-scroll-draw-${o}`,h=`svg-scroll-draw-host-${o}`,X=`--svg-scroll-draw-${o}`,Ae=A==="reverse"?"0":"var(--ssd-len)",Se=A==="reverse"?"var(--ssd-len)":"0",de=`stroke-dashoffset:${Ae};`,v=`stroke-dashoffset:${Se};`;c&&(de+=`opacity:${A==="reverse"?1:0};`,v+=`opacity:${A==="reverse"?0:1};`);let M=document.createElement("style");M.setAttribute("data-svg-scroll-draw",""),M.textContent=`@keyframes ${l}{from{${de}}to{${v}}}.${h}{view-timeline-name:${X};view-timeline-axis:block;}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${vt};animation-fill-mode:both;animation-timeline:${X};animation-range:cover 0% cover 100%;}`,document.head.appendChild(M),e.classList.add(h);function Q(d,V){d.style.setProperty("--ssd-len",String(T[V])),d.style.strokeDasharray=`${T[V]}`,d.style.strokeDashoffset="",d.style.opacity="",d.style.animationPlayState="",d.classList.add(l)}C.forEach(Q);let y=!1,L=-1;function R(){if(L>=0)return L;let d=e.getBoundingClientRect(),{tStart:V,tEnd:fe}=Fe({top:d.top,height:d.height},ot(),ht(),we,He);return me(le(ot(),V,fe,m))}return{destroy(){e.classList.remove(h),C.forEach(d=>{d.classList.remove(l),d.style.removeProperty("--ssd-len"),d.style.animationPlayState=""}),M.remove()},replay(){y=!1,L=-1,C.forEach(Q)},pause(){y=!0,C.forEach(d=>{d.style.animationPlayState="paused"})},resume(){y&&(y=!1,C.forEach(d=>{d.style.animationPlayState="running"}))},seek(d){let V=Math.min(1,Math.max(0,d));L=V,y=!0,C.forEach((fe,ae)=>{fe.classList.remove(l),fe.style.strokeDashoffset=A==="reverse"?`${T[ae]*V}`:`${T[ae]*(1-V)}`,c&&(fe.style.opacity=A==="reverse"?`${1-V}`:`${V}`)})},getProgress(){return R()},refresh(){C.forEach((d,V)=>{T[V]=Ve(d),d.style.setProperty("--ssd-len",String(T[V])),d.style.strokeDasharray=`${T[V]}`})}}}if(zt())return st(qt());function Wt(){let o=Math.max(1,Ce),l=0,h=0,X=!1;function Ae(y){let L=!0;if(te){let R=Math.min(1,Math.max(0,y/o)),d=me(R);ie=d,e.style.setProperty("--scroll-draw-progress",String(d)),e.style.clipPath=ve(A==="reverse"?1-d:d),w?.(d),R<1&&(L=!1)}else C.forEach((R,d)=>{let V=d*I*o,fe=Math.min(1,Math.max(0,(y-V)/o)),ae=me(fe);R.style.strokeDashoffset=A==="reverse"?`${T[d]*ae}`:`${T[d]*(1-ae)}`,c&&(R.style.opacity=A==="reverse"?`${1-ae}`:`${ae}`),ue&&Y?R.style.stroke=ze(ue,Y,ae):Y&&(R.style.stroke=Y),U!==null&&H!==null?R.style.strokeWidth=`${U+(H-U)*ae}`:H!==null&&(R.style.strokeWidth=`${H}`),re!==null&&W!==null?R.style.fillOpacity=`${re+(W-re)*ae}`:W!==null&&(R.style.fillOpacity=`${W}`),N&&R.tagName.toLowerCase()==="path"&&s[d]&&R.setAttribute("d",mt(s[d],N,ae)),d===0&&(ie=ae,w?.(ae),e.style.setProperty("--scroll-draw-progress",String(ae))),fe<1&&(L=!1)});if(B){let R=Math.min(1,Math.max(0,y/o)),d=me(R);for(let V in B){let fe=parseFloat(V);d>=fe&&!Oe.has(fe)&&(Oe.add(fe),B[V]?.())}}return L}function Se(y){if(_)return;let L=y-l;D||(D=!0,P?.());let R=Ae(L);if(R&&!k){k=!0,Ae(o*(1+Math.max(0,C.length-1)*I)),ne?.(),Te<(q==="infinite"?1/0:q??0)&&(Te++,Ie=setTimeout(()=>{l=performance.now(),D=!1,k=!1,Oe.clear(),Ge(),O=requestAnimationFrame(Se)},ke));return}R||(O=requestAnimationFrame(Se))}function de(){cancelAnimationFrame(O),clearTimeout(Ie),l=performance.now(),h=0,_=!1,D=!1,k=!1,Te=0,X=!0,ie=0,Oe.clear(),Ge(),O=requestAnimationFrame(Se)}let v=new IntersectionObserver(y=>{y.forEach(L=>{L.isIntersecting&&!(J&&k)?de():!L.isIntersecting&&!J&&!k&&(cancelAnimationFrame(O),clearTimeout(Ie),X=!1)})},{root:ce??null,threshold:ge,rootMargin:j}),M;function Q(){clearTimeout(M),M=setTimeout(()=>{C.forEach((y,L)=>{T[L]=Ve(y),y.style.strokeDasharray=`${T[L]}`})},150)}return window.addEventListener("resize",Q),window.addEventListener("orientationchange",Q),E>0?setTimeout(()=>v.observe(e),E):v.observe(e),{destroy(){cancelAnimationFrame(O),clearTimeout(Ie),v.disconnect(),window.removeEventListener("resize",Q),window.removeEventListener("orientationchange",Q),clearTimeout(M)},replay(){Te=0,de()},pause(){_||!X||(_=!0,h=performance.now()-l,cancelAnimationFrame(O))},resume(){_&&(_=!1,X=!0,l=performance.now()-h,O=requestAnimationFrame(Se))},seek(y){let L=Math.min(1,Math.max(0,y));ie=L,_=!0,h=L*o,l=performance.now()-h,cancelAnimationFrame(O),Ae(h)},getProgress(){return ie},refresh(){clearTimeout(M),C.forEach((y,L)=>{T[L]=Ve(y),y.style.strokeDasharray=`${T[L]}`})}}}if(Le)return st(Wt());wt();function je(){if(!pe||_)return;let o=performance.now(),l=ot();if(!Re&&ee===!1&&l===gt){O=requestAnimationFrame(je);return}Re=!1,gt=l;let h=m;if(ee!==!1){let v=o-yt,M=v>0?Math.abs(l-(Be<0?l:Be))/v:0;h=m*Math.max(.2,1+M*(typeof ee=="number"?ee:1)*.04)}Be=l,yt=o;let X=g?G===-1||l>=G?"forward":"reverse":A;G=l;let Ae=oe-u,Se=!0,de=Ae===0?0:(l-u)/Ae;if(isNaN(_e)||(_e<=0&&de>0?he?.():_e>0&&de<=0&&xe?.(),_e<1&&de>=1?Ne?.():_e>=1&&de<1&&be?.()),_e=de,te){let v=me(le(l,u,oe,h));J&&!g&&(se=Math.max(se,v),v=se),ie=v,e.style.setProperty("--scroll-draw-progress",String(v));let M=X==="reverse"?1-v:v;e.style.clipPath=ve(M),w?.(v),!D&&le(l,u,oe,h)>0&&(D=!0,P?.()),v>=1&&!k?(k=!0,ne?.(),Te<(q==="infinite"?1/0:q??0)&&(Te++,Ie=setTimeout(()=>{se=-1,D=!1,k=!1,e.style.clipPath=ve(0)},ke))):v<1&&!J&&(k=!1),O=requestAnimationFrame(je);return}if(C.forEach((v,M)=>{let Q=M*I*Ae,y=me(le(l,u+Q,oe+Q,h));J&&!g&&(se=Math.max(se,y),y=se),ie=y,v.style.strokeDashoffset=X==="reverse"?`${T[M]*y}`:`${T[M]*(1-y)}`,c&&(v.style.opacity=X==="reverse"?`${1-y}`:`${y}`),ue&&Y?v.style.stroke=ze(ue,Y,y):Y&&(v.style.stroke=Y),U!==null&&H!==null?v.style.strokeWidth=`${U+(H-U)*y}`:H!==null&&(v.style.strokeWidth=`${H}`),re!==null&&W!==null?v.style.fillOpacity=`${re+(W-re)*y}`:W!==null&&(v.style.fillOpacity=`${W}`),N&&v.tagName.toLowerCase()==="path"&&s[M]&&v.setAttribute("d",mt(s[M],N,y)),M===0&&(w?.(y),e.style.setProperty("--scroll-draw-progress",String(y))),y<1&&(Se=!1)}),B){let v=me(le(l,u,oe,h));for(let M in B){let Q=parseFloat(M);v>=Q&&!Oe.has(Q)&&(Oe.add(Q),B[M]?.())}}!D&&le(l,u,oe,h)>0&&(D=!0,P?.()),Se&&!k?(k=!0,ne?.(),Te<(q==="infinite"?1/0:q??0)&&(Te++,Ie=setTimeout(()=>{se=-1,D=!1,k=!1,Oe.clear(),Ge(),Re=!0},ke))):!Se&&!J&&(k=!1),O=requestAnimationFrame(je)}let it=!1;function Ye(){it||(it=!0,O=requestAnimationFrame(function(){je()}))}function Ue(){it=!1,cancelAnimationFrame(O)}let at=new IntersectionObserver(o=>{o.forEach(l=>{pe=l.isIntersecting,pe&&!_?(Re=!0,Ye()):Ue()})},{root:ce??null,threshold:ge,rootMargin:j});function St(){C.forEach((o,l)=>{T[l]=Ve(o),o.style.strokeDasharray=`${T[l]}`}),wt(),Re=!0}let Xe;function qe(){clearTimeout(Xe),Xe=setTimeout(St,150)}window.addEventListener("resize",qe),window.addEventListener("orientationchange",qe);let We;return typeof ResizeObserver<"u"&&(We=new ResizeObserver(()=>qe()),We.observe(document.body),We.observe(document.documentElement),We.observe(e)),E>0?setTimeout(()=>at.observe(e),E):at.observe(e),st({destroy(){cancelAnimationFrame(O),clearTimeout(Ie),Ue(),at.disconnect(),We?.disconnect(),window.removeEventListener("resize",qe),window.removeEventListener("orientationchange",qe),clearTimeout(Xe),dt()},replay(){se=-1,G=-1,Be=-1,D=!1,k=!1,Te=0,_=!1,ie=0,Oe.clear(),clearTimeout(Ie),Ge(),Re=!0,pe&&Ye()},pause(){_=!0,Ue()},resume(){_&&(_=!1,Re=!0,pe&&Ye())},seek(o){let l=Math.min(1,Math.max(0,o));ie=l,se=l,_=!0,Ue(),Vt(l,A),Re=!0},getProgress(){return ie},refresh(){clearTimeout(Xe),St(),pe&&!_&&Ye()}},()=>({tStart:u,tEnd:oe}))}function ir(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Dt(e){let t=[],r=/([\w]+)\(([^)]*)\)/g,n;for(;(n=r.exec(e))!==null;){let i=[],a=[],f=n[2].trim();if(f)for(let m of f.split(/[\s,]+/)){let c=m.match(/^([-+]?[\d.eE]+)(.*)$/);i.push(c?parseFloat(c[1]):0),a.push(c?c[2]:"")}t.push({fn:n[1],nums:i,units:a})}return t}function ar(e,t,r){let n=Dt(e),i=Dt(t);return n.length===0||n.length!==i.length?r<1?e:t:n.map((a,f)=>{let m=i[f];return a.fn!==m.fn||a.nums.length!==m.nums.length?r<1?`${a.fn}(${a.nums.map((c,p)=>`${c}${a.units[p]}`).join(", ")})`:`${m.fn}(${m.nums.map((c,p)=>`${c}${m.units[p]}`).join(", ")})`:`${a.fn}(${a.nums.map((c,p)=>`${c+(m.nums[p]-c)*r}${a.units[p]}`).join(", ")})`}).join(" ")}function It(e,t,r){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*r);let n=String(e),i=String(t);if(ir(n))return ze(n,i,r);if(n.includes("("))return ar(n,i,r);let a=n.match(/^([-+]?[\d.]+)(.*)$/),f=i.match(/^([-+]?[\d.]+)(.*)$/);if(a&&f){let m=parseFloat(a[1]),c=parseFloat(f[1]);return`${m+(c-m)*r}${a[2]||f[2]}`}return r<1?n:i}function lr(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var cr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),ur=0,Ot="--scroll-draw-progress";function mr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Rt(e,t){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:n,trigger:i={},easing:a="ease-out",speed:f=1,once:m=!1,axis:c="y",scrollContainer:p,native:x=!0,velocityScale:I=!1,respectReducedMotion:A=!0,triggerElement:J,onProgress:Ee,onComplete:S,onEnter:$,onLeave:g,onEnterBack:E,onLeaveBack:b}=t,z=A&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,F=typeof a=="function"?a:Z[a]??Z["ease-out"],B=$e(i.start??"top bottom"),ee=$e(i.end??"bottom top"),ge=J??e,j=typeof p=="string"?document.querySelector(p):p??null,q=Object.entries(n).map(([s,u])=>({prop:lr(s),from:Array.isArray(u)?u[0]:"",to:Array.isArray(u)?u[1]:u}));function ke(){let s=window.getComputedStyle(e);for(let u of q)u.from===""&&(u.from=s.getPropertyValue(u.prop).trim()||"0")}function N(){for(let s of q)e.style.setProperty(s.prop,String(s.to))}let ye=new Map;for(let s of[...q.map(u=>u.prop),Ot])ye.set(s,e.style.getPropertyValue(s));function Le(){for(let[s,u]of ye)u?e.style.setProperty(s,u):e.style.removeProperty(s)}if(z)return N(),S?.(),{...r,destroy:Le,getProgress:()=>1};ke();let Ce=typeof a=="string"?Ke(a):null;function De(){if(!x||!mr()||!Ce||c!=="y"||j||ge!==e||m||f!==1||Ee||S||$||g||E||b||I!==!1||(i.start??"top bottom").trim()!=="top bottom"||(i.end??"bottom top").trim()!=="bottom top")return!1;for(let s of q)if(!cr.has(s.prop))return!1;return!0}function w(){let s=`ssd-a-${++ur}`,u=q.map(G=>`${G.prop}:${G.from}`).join(";"),oe=q.map(G=>`${G.prop}:${G.to}`).join(";"),k=document.createElement("style");k.setAttribute("data-ssd-animate",""),k.textContent=`@keyframes ${s}{from{${u}}to{${oe}}}.${s}{animation-name:${s};animation-duration:auto;animation-timing-function:${Ce};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(k),e.classList.add(s);let D=()=>c==="x"?window.scrollX:window.scrollY,O=()=>c==="x"?window.innerWidth:window.innerHeight,pe=()=>{let G=e.getBoundingClientRect();return Fe({top:G.top,height:G.height},D(),O(),B,ee)};Me(e,{type:"animate",getProgress:()=>se.getProgress(),getTrigger:pe});let se={destroy(){e.classList.remove(s),k.remove(),e.style.animationPlayState="",Le(),Pe(e)},replay(){e.classList.remove(s),e.offsetWidth,e.classList.add(s)},pause(){e.style.animationPlayState="paused"},resume(){e.style.animationPlayState=""},seek(G){let _=Math.min(1,Math.max(0,G));e.classList.remove(s);for(let ie of q)e.style.setProperty(ie.prop,It(ie.from,ie.to,_))},getProgress(){let{tStart:G,tEnd:_}=pe();return F(le(D(),G,_,f))}};return se}if(De())return w();let P=0,ne=0,he=0,Ne=!1,be=!1,xe=-1,te=0,me=!1,we=NaN,He=-1,ce=0,ue=()=>j?c==="x"?j.scrollLeft:j.scrollTop:c==="x"?window.scrollX:window.scrollY,Y=()=>j?c==="x"?j.clientWidth:j.clientHeight:c==="x"?window.innerWidth:window.innerHeight;function U(){let s=Qe(ge,j,c),u=Fe(s,s.scroll,Y(),B,ee);P=u.tStart,ne=u.tEnd}function H(s){e.style.setProperty(Ot,String(s));for(let u of q)e.style.setProperty(u.prop,It(u.from,u.to,s));Ee?.(s)}function re(s){if(isNaN(we)){we=s;return}we<=0&&s>0?$?.():we>0&&s<=0&&b?.(),we<1&&s>=1?g?.():we>=1&&s<1&&E?.(),we=s}function W(){if(!Ne||be)return;let s=performance.now(),u=ue(),oe=f;if(I!==!1){let O=s-ce,pe=O>0?Math.abs(u-(He<0?u:He))/O:0;oe=f*Math.max(.2,1+pe*(typeof I=="number"?I:1)*.04)}He=u,ce=s;let k=ne===P?0:(u-P)/(ne-P);re(k);let D=F(le(u,P,ne,oe));m&&(xe=Math.max(xe,D),D=xe),te=D,H(D),D>=1&&!me?(me=!0,S?.()):D<1&&!m&&(me=!1),he=requestAnimationFrame(W)}U(),ne===P&&K("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let s=F(le(ue(),P,ne,f));m&&s>0&&(xe=s),te=s,H(s)}let ve=new IntersectionObserver(s=>{s.forEach(u=>{Ne=u.isIntersecting,Ne&&!be?he=requestAnimationFrame(W):cancelAnimationFrame(he)})},{root:j??null}),C;function T(){clearTimeout(C),C=setTimeout(U,150)}return window.addEventListener("resize",T),window.addEventListener("orientationchange",T),ve.observe(e),Me(e,{type:"animate",getProgress:()=>te,getTrigger:()=>({tStart:P,tEnd:ne})}),{destroy(){cancelAnimationFrame(he),ve.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("orientationchange",T),clearTimeout(C),Le(),Pe(e)},replay(){xe=-1,me=!1,te=0,be=!1,H(0)},pause(){be=!0,cancelAnimationFrame(he)},resume(){be&&(be=!1,Ne&&(he=requestAnimationFrame(W)))},seek(s){let u=Math.min(1,Math.max(0,s));te=u,xe=u,be=!0,cancelAnimationFrame(he),H(u)},getProgress(){return te}}}var et={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ft(e,t){if(typeof window>"u")return et;let r=typeof e=="string"?document.querySelector(e):e;return r?Rt(r,t):(K("scrollAnimate: element not found:",e),et)}function Nt(e,t={}){if(typeof window>"u")return et;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return K("scrollParallax: element not found:",e),et;let{speed:n=.3,axis:i="y",easing:a="linear",trigger:f,onProgress:m}=t,c=r.getBoundingClientRect(),p=i==="x"?c.width:c.height,x=n*p;return Rt(r,{props:i==="x"?{transform:["translateX(0px)",`translateX(${-x}px)`]}:{transform:["translateY(0px)",`translateY(${-x}px)`]},trigger:f??{start:"top bottom",end:"bottom top"},easing:a,native:!1,onProgress:m})}var ft={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ht(e,t){if(typeof window>"u")return ft;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return K("scrollCounter: element not found:",e),ft;let n=r,{from:i=0,to:a,format:f,easing:m="ease-out",trigger:c={},once:p=!0,decimals:x,onComplete:I}=t,A=x!==void 0?w=>w.toFixed(x):f??(w=>String(Math.round(w))),J=typeof m=="function"?m:Z[m]??Z["ease-out"],Ee=$e(c.start??"top 80%"),S=$e(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return n.textContent=A(a),I?.(),ft;let g=0,E=0,b=0,z=!1,F=!1,B=-1,ee=0,ge=!1,j=()=>window.scrollY,q=()=>window.innerHeight;function ke(){let w=n.getBoundingClientRect(),P=Fe({top:w.top,height:w.height},j(),q(),Ee,S);g=P.tStart,E=P.tEnd}function N(w){n.textContent=A(i+(a-i)*w),n.style.setProperty("--scroll-draw-progress",String(w))}function ye(){if(!z||F)return;let w=J(le(j(),g,E,1));p&&(B=Math.max(B,w),w=B),ee=w,N(w),w>=1&&!ge?(ge=!0,I?.()):w<1&&!p&&(ge=!1),b=requestAnimationFrame(ye)}ke();{let w=J(le(j(),g,E,1));p&&w>0&&(B=w),ee=w,N(w)}let Le=new IntersectionObserver(w=>{w.forEach(P=>{z=P.isIntersecting,z&&!F?b=requestAnimationFrame(ye):cancelAnimationFrame(b)})}),Ce;function De(){clearTimeout(Ce),Ce=setTimeout(ke,150)}return window.addEventListener("resize",De),window.addEventListener("orientationchange",De),Le.observe(n),Me(n,{type:"counter",getProgress:()=>ee,getTrigger:()=>({tStart:g,tEnd:E})}),{destroy(){cancelAnimationFrame(b),Le.disconnect(),window.removeEventListener("resize",De),window.removeEventListener("orientationchange",De),clearTimeout(Ce),Pe(n)},replay(){B=-1,ge=!1,ee=0,F=!1,N(0)},pause(){F=!0,cancelAnimationFrame(b)},resume(){F&&(F=!1,z&&(b=requestAnimationFrame(ye)))},seek(w){let P=Math.min(1,Math.max(0,w));ee=P,B=P,F=!0,cancelAnimationFrame(b),N(P)},getProgress(){return ee}}}var _t="http://www.w3.org/2000/svg",fr="cinematic-photo",pt=e=>e<0?0:e>1?1:e;function tt(e){let t=parseFloat(e);return Number.isFinite(t)?pt(t/100):0}function pr(e){return Z[e]??Z.linear}var dr={destroy:()=>{},getProgress:()=>0},rt=class{constructor(t){if(typeof document>"u"){this.mount=null;return}this.mount=typeof t.wrapper=="string"?document.querySelector(t.wrapper):t.wrapper,this.mount||K("Cinematic: wrapper not found:",t.wrapper)}loadStory(t){let r=this.mount;if(typeof window>"u"||!r)return dr;r.style.position="relative",r.style.height=t.totalHeight,r.style.display="block";let n=document.createElement("div");n.setAttribute("data-cinematic-stage",""),n.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",r.appendChild(n);let i=[];for(let S of t.scenes){if(S.background){let g=document.createElement("img");g.id=fr,g.src=S.background,g.alt="",g.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(g)}let $=S.animations.filter(g=>g.type==="draw");if($.length){let g=document.createElementNS(_t,"svg");g.setAttribute("viewBox",`0 0 ${t.canvas.width} ${t.canvas.height}`),g.setAttribute("preserveAspectRatio","xMidYMid meet"),g.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(g);for(let E of $){let b=document.createElementNS(_t,"path");b.id=E.target.replace(/^#/,""),b.setAttribute("d",E.d),b.setAttribute("fill","none"),b.setAttribute("stroke",E.stroke),b.setAttribute("stroke-width",String(E.strokeWidth)),b.setAttribute("stroke-linecap","round"),b.setAttribute("stroke-linejoin","round");let z=E.length||b.getTotalLength?.()||0;b.style.strokeDasharray=String(z),b.style.strokeDashoffset=String(z),g.appendChild(b),i.push({kind:"draw",el:b,start:tt(E.start),end:tt(E.end),ease:pr(E.easing),length:z})}}for(let g of S.animations){if(g.type!=="fade")continue;let E=n.querySelector(g.target)??document.querySelector(g.target);E&&(E.style.opacity=String(g.from),i.push({kind:"fade",el:E,start:tt(g.start),end:tt(g.end),ease:Z["ease-in-out"]??Z.linear,from:g.from,to:g.to}))}}let a=0,f=()=>{let S=r.offsetHeight-window.innerHeight;return S<=0?r.getBoundingClientRect().top<=0?1:0:pt(-r.getBoundingClientRect().top/S)},m=S=>{for(let $ of i){let g=$.end-$.start,E=g<=0?S>=$.end?1:0:pt((S-$.start)/g),b=$.ease(E);$.kind==="draw"?$.el.style.strokeDashoffset=String($.length*(1-b)):$.el.style.opacity=String($.from+($.to-$.from)*b)}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return m(1),{destroy:()=>{},getProgress:()=>1};let c=0,p=!1,x=!1,I=()=>{a=f(),m(a),p&&(c=requestAnimationFrame(I))},A=()=>{p||(p=!0,c=requestAnimationFrame(I))},J=()=>{p=!1,cancelAnimationFrame(c)},Ee=new IntersectionObserver(S=>{for(let $ of S)x=$.isIntersecting,x?A():J()},{threshold:0});return Ee.observe(n),a=f(),m(a),Me(r,{type:"draw",getProgress:()=>a,getTrigger:()=>{let S=r.getBoundingClientRect().top+window.scrollY;return{tStart:S,tEnd:S+Math.max(0,r.offsetHeight-window.innerHeight)}}}),{destroy(){J(),Ee.disconnect(),Pe(r)},getProgress:()=>a}}};function gr(e,t){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let n=typeof e=="string"?document.querySelector(e):e;return n?Je(n,t):(K("Container not found:",e),r)}if(typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("scroll-draw")){class e extends HTMLElement{constructor(){super(...arguments);this.instance=null}connectedCallback(){let n={},i=this.getAttribute("speed"),a=this.getAttribute("easing"),f=this.getAttribute("stagger"),m=this.getAttribute("direction"),c=this.getAttribute("selector");i&&(n.speed=parseFloat(i)),a&&(n.easing=a),f&&(n.stagger=parseFloat(f)),m&&(n.direction=m),c&&(n.selector=c),this.hasAttribute("fade")&&(n.fade=this.getAttribute("fade")!=="false"),this.hasAttribute("once")&&(n.once=this.getAttribute("once")!=="false"),this.instance=Je(this,n)}disconnectedCallback(){this.instance?.destroy(),this.instance=null}}customElements.define("scroll-draw",e)}return Xt(yr);})();
|
|
3
|
+
<div style="position:absolute;${c?`left:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`}return document.body.appendChild(n),window.addEventListener("scroll",i,{passive:!0}),i(),{el:n,destroy(){window.removeEventListener("scroll",i),n.remove()}}}var Dt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,It=/[MmLlHhVvCcSsQqTtAaZz]/g;function ar(e,t,r){if(!!1)return;let n=(e.match(It)??[]).join("").toUpperCase(),i=(t.match(It)??[]).join("").toUpperCase(),a=(e.match(Dt)??[]).length,f=(t.match(Dt)??[]).length;if(n!==i){K(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${i||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}a!==f&&K(`morphTo: coordinate count differs (${a} \u2192 ${f}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r)}function mt(e,t,r){let n=(t.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),i=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,a=>{let f=parseFloat(a),m=n[i++]??f;return String(+(f+(m-f)*r).toFixed(4))})}function Je(e,t={}){if(typeof window>"u")return{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...n}=t,i=r?{...Ze[r],...n}:n,a=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:f="path, polyline, line, polygon, rect, circle",speed:m=1,fade:c=!1,easing:p="linear",trigger:x={},stagger:I=0,direction:A="forward",once:J=!1,debug:Ee=!1,axis:S="y",scrollContainer:$,autoReverse:g=!1,delay:E=0,strokeColor:b,strokeWidth:z,fillOpacity:F,waypoints:B,velocityScale:ee=!1,threshold:ge=0,rootMargin:j="0px",repeat:q=0,repeatDelay:ke=0,morphTo:N,clip:ye,autoplay:Le=!1,duration:Ce=1e3,native:De=!0,onProgress:w,onStart:P,onComplete:ne,onEnter:he,onLeave:Ne,onEnterBack:be,onLeaveBack:xe}=i,te=ye===!0?"left":typeof ye=="string"?ye:!1,me=typeof p=="function"?p:Z[p]??Z.linear,we=$e(x.start??"top bottom"),He=$e(x.end??"bottom top"),ce=typeof $=="string"?document.querySelector($):$??null,ue=Array.isArray(b)?b[0]:null,Y=Array.isArray(b)?b[1]:typeof b=="string"?b:null,U=Array.isArray(z)?z[0]:null,H=Array.isArray(z)?z[1]:typeof z=="number"?z:null,re=Array.isArray(F)?F[0]:null,W=Array.isArray(F)?F[1]:typeof F=="number"?F:null;function ve(o){let l=o*100;switch(te){case"right":return`inset(0 0 0 ${100-l}%)`;case"top":return`inset(0 0 ${100-l}% 0)`;case"bottom":return`inset(${100-l}% 0 0 0)`;case"center":return`circle(${o*150}% at 50% 50%)`;default:return`inset(0 ${100-l}% 0 0)`}}let C=te?[]:Array.from(e.querySelectorAll(f)),T=[],s=[],u=0,oe=0,k=!1,D=!1,O=0,pe=!1,se=-1,G=-1,_=!1,ie=0,Te=0,Ie,nt=null;function gt(){nt?.destroy(),nt=null}let Oe=new Set,yt=NaN,Re=!0,Be=-1,ht=performance.now(),_e=NaN;function ot(){return ce?S==="x"?ce.scrollLeft:ce.scrollTop:S==="x"?window.scrollX:window.scrollY}function bt(){return ce?S==="x"?ce.clientWidth:ce.clientHeight:S==="x"?window.innerWidth:window.innerHeight}function wt(){let o=Qe(e,ce,S);return Fe(o,o.scroll,bt(),we,He)}function vt(){({tStart:u,tEnd:oe}=wt()),Ee&&!1&&(gt(),nt=ir(u,oe,S))}function st(o,l=wt){Me(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:l});let h=o.destroy;return o.destroy=()=>{h.call(o),Pe(e)},o}function qt(o,l){if(e.style.setProperty("--scroll-draw-progress",String(o)),te){let h=l==="reverse"?1-o:o;e.style.clipPath=ve(h);return}C.forEach((h,X)=>{h.style.strokeDashoffset=l==="reverse"?`${T[X]*o}`:`${T[X]*(1-o)}`,c&&(h.style.opacity=l==="reverse"?`${1-o}`:`${o}`),ue&&Y?h.style.stroke=ze(ue,Y,o):Y&&(h.style.stroke=Y),U!==null&&H!==null?h.style.strokeWidth=`${U+(H-U)*o}`:H!==null&&(h.style.strokeWidth=`${H}`),re!==null&&W!==null?h.style.fillOpacity=`${re+(W-re)*o}`:W!==null&&(h.style.fillOpacity=`${W}`),N&&h.tagName.toLowerCase()==="path"&&s[X]&&h.setAttribute("d",mt(s[X],N,o))})}function Ge(){if(e.style.setProperty("--scroll-draw-progress","0"),te){e.style.clipPath=ve(0);return}C.forEach((o,l)=>{o.style.strokeDasharray=`${T[l]}`,o.style.strokeDashoffset=A==="reverse"?"0":`${T[l]}`,c?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",ue&&(o.style.stroke=ue),U!==null&&(o.style.strokeWidth=`${U}`),re!==null&&(o.style.fillOpacity=`${re}`),N&&o.tagName.toLowerCase()==="path"&&s[l]&&o.setAttribute("d",s[l])})}if(C.forEach(o=>{sr(o);let l=Ve(o);T.push(l);let h=o.tagName.toLowerCase()==="path";h?s.push(o.getAttribute("d")??""):s.push(""),N&&(h?ar(s[s.length-1],N,o):K(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),a?(o.style.strokeDasharray=`${l}`,o.style.strokeDashoffset=A==="reverse"?`${l}`:"0",c&&(o.style.opacity="1"),Y&&(o.style.stroke=Y),H!==null&&(o.style.strokeWidth=`${H}`),W!==null&&(o.style.fillOpacity=`${W}`),N&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",N)):(o.style.strokeDasharray=`${l}`,o.style.strokeDashoffset=A==="reverse"?"0":`${l}`,c?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",ue&&(o.style.stroke=ue),U!==null&&(o.style.strokeWidth=`${U}`),re!==null&&(o.style.fillOpacity=`${re}`))}),te){if(a)return e.style.clipPath=ve(1),ne?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=ve(0)}else if(a)return ne?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let St=typeof p=="string"?Ke(p):null;function Wt(){return!(De===!1||!or()||!C.length||!St||te||S!=="y"||ce||m!==1||I!==0||J||g||ee!==!1||N||B||q||E>0||w||P||ne||he||Ne||be||xe||b!=null||z!=null||F!=null||(x.start??"top bottom").trim()!=="top bottom"||(x.end??"bottom top").trim()!=="bottom top")}function Bt(){let o=++nr,l=`svg-scroll-draw-${o}`,h=`svg-scroll-draw-host-${o}`,X=`--svg-scroll-draw-${o}`,Ae=A==="reverse"?"0":"var(--ssd-len)",Se=A==="reverse"?"var(--ssd-len)":"0",de=`stroke-dashoffset:${Ae};`,v=`stroke-dashoffset:${Se};`;c&&(de+=`opacity:${A==="reverse"?1:0};`,v+=`opacity:${A==="reverse"?0:1};`);let M=document.createElement("style");M.setAttribute("data-svg-scroll-draw",""),M.textContent=`@keyframes ${l}{from{${de}}to{${v}}}.${h}{view-timeline-name:${X};view-timeline-axis:block;}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${St};animation-fill-mode:both;animation-timeline:${X};animation-range:cover 0% cover 100%;}`,document.head.appendChild(M),e.classList.add(h);function Q(d,V){d.style.setProperty("--ssd-len",String(T[V])),d.style.strokeDasharray=`${T[V]}`,d.style.strokeDashoffset="",d.style.opacity="",d.style.animationPlayState="",d.classList.add(l)}C.forEach(Q);let y=!1,L=-1;function R(){if(L>=0)return L;let d=e.getBoundingClientRect(),{tStart:V,tEnd:fe}=Fe({top:d.top,height:d.height},ot(),bt(),we,He);return me(le(ot(),V,fe,m))}return{destroy(){e.classList.remove(h),C.forEach(d=>{d.classList.remove(l),d.style.removeProperty("--ssd-len"),d.style.animationPlayState=""}),M.remove()},replay(){y=!1,L=-1,C.forEach(Q)},pause(){y=!0,C.forEach(d=>{d.style.animationPlayState="paused"})},resume(){y&&(y=!1,C.forEach(d=>{d.style.animationPlayState="running"}))},seek(d){let V=Math.min(1,Math.max(0,d));L=V,y=!0,C.forEach((fe,ae)=>{fe.classList.remove(l),fe.style.strokeDashoffset=A==="reverse"?`${T[ae]*V}`:`${T[ae]*(1-V)}`,c&&(fe.style.opacity=A==="reverse"?`${1-V}`:`${V}`)})},getProgress(){return R()},refresh(){C.forEach((d,V)=>{T[V]=Ve(d),d.style.setProperty("--ssd-len",String(T[V])),d.style.strokeDasharray=`${T[V]}`})}}}if(Wt())return st(Bt());function Gt(){let o=Math.max(1,Ce),l=0,h=0,X=!1;function Ae(y){let L=!0;if(te){let R=Math.min(1,Math.max(0,y/o)),d=me(R);ie=d,e.style.setProperty("--scroll-draw-progress",String(d)),e.style.clipPath=ve(A==="reverse"?1-d:d),w?.(d),R<1&&(L=!1)}else C.forEach((R,d)=>{let V=d*I*o,fe=Math.min(1,Math.max(0,(y-V)/o)),ae=me(fe);R.style.strokeDashoffset=A==="reverse"?`${T[d]*ae}`:`${T[d]*(1-ae)}`,c&&(R.style.opacity=A==="reverse"?`${1-ae}`:`${ae}`),ue&&Y?R.style.stroke=ze(ue,Y,ae):Y&&(R.style.stroke=Y),U!==null&&H!==null?R.style.strokeWidth=`${U+(H-U)*ae}`:H!==null&&(R.style.strokeWidth=`${H}`),re!==null&&W!==null?R.style.fillOpacity=`${re+(W-re)*ae}`:W!==null&&(R.style.fillOpacity=`${W}`),N&&R.tagName.toLowerCase()==="path"&&s[d]&&R.setAttribute("d",mt(s[d],N,ae)),d===0&&(ie=ae,w?.(ae),e.style.setProperty("--scroll-draw-progress",String(ae))),fe<1&&(L=!1)});if(B){let R=Math.min(1,Math.max(0,y/o)),d=me(R);for(let V in B){let fe=parseFloat(V);d>=fe&&!Oe.has(fe)&&(Oe.add(fe),B[V]?.())}}return L}function Se(y){if(_)return;let L=y-l;D||(D=!0,P?.());let R=Ae(L);if(R&&!k){k=!0,Ae(o*(1+Math.max(0,C.length-1)*I)),ne?.(),Te<(q==="infinite"?1/0:q??0)&&(Te++,Ie=setTimeout(()=>{l=performance.now(),D=!1,k=!1,Oe.clear(),Ge(),O=requestAnimationFrame(Se)},ke));return}R||(O=requestAnimationFrame(Se))}function de(){cancelAnimationFrame(O),clearTimeout(Ie),l=performance.now(),h=0,_=!1,D=!1,k=!1,Te=0,X=!0,ie=0,Oe.clear(),Ge(),O=requestAnimationFrame(Se)}let v=new IntersectionObserver(y=>{y.forEach(L=>{L.isIntersecting&&!(J&&k)?de():!L.isIntersecting&&!J&&!k&&(cancelAnimationFrame(O),clearTimeout(Ie),X=!1)})},{root:ce??null,threshold:ge,rootMargin:j}),M;function Q(){clearTimeout(M),M=setTimeout(()=>{C.forEach((y,L)=>{T[L]=Ve(y),y.style.strokeDasharray=`${T[L]}`})},150)}return window.addEventListener("resize",Q),window.addEventListener("orientationchange",Q),E>0?setTimeout(()=>v.observe(e),E):v.observe(e),{destroy(){cancelAnimationFrame(O),clearTimeout(Ie),v.disconnect(),window.removeEventListener("resize",Q),window.removeEventListener("orientationchange",Q),clearTimeout(M)},replay(){Te=0,de()},pause(){_||!X||(_=!0,h=performance.now()-l,cancelAnimationFrame(O))},resume(){_&&(_=!1,X=!0,l=performance.now()-h,O=requestAnimationFrame(Se))},seek(y){let L=Math.min(1,Math.max(0,y));ie=L,_=!0,h=L*o,l=performance.now()-h,cancelAnimationFrame(O),Ae(h)},getProgress(){return ie},refresh(){clearTimeout(M),C.forEach((y,L)=>{T[L]=Ve(y),y.style.strokeDasharray=`${T[L]}`})}}}if(Le)return st(Gt());vt();function je(){if(!pe||_)return;let o=performance.now(),l=ot();if(!Re&&ee===!1&&l===yt){O=requestAnimationFrame(je);return}Re=!1,yt=l;let h=m;if(ee!==!1){let v=o-ht,M=v>0?Math.abs(l-(Be<0?l:Be))/v:0;h=m*Math.max(.2,1+M*(typeof ee=="number"?ee:1)*.04)}Be=l,ht=o;let X=g?G===-1||l>=G?"forward":"reverse":A;G=l;let Ae=oe-u,Se=!0,de=Ae===0?0:(l-u)/Ae;if(isNaN(_e)||(_e<=0&&de>0?he?.():_e>0&&de<=0&&xe?.(),_e<1&&de>=1?Ne?.():_e>=1&&de<1&&be?.()),_e=de,te){let v=me(le(l,u,oe,h));J&&!g&&(se=Math.max(se,v),v=se),ie=v,e.style.setProperty("--scroll-draw-progress",String(v));let M=X==="reverse"?1-v:v;e.style.clipPath=ve(M),w?.(v),!D&&le(l,u,oe,h)>0&&(D=!0,P?.()),v>=1&&!k?(k=!0,ne?.(),Te<(q==="infinite"?1/0:q??0)&&(Te++,Ie=setTimeout(()=>{se=-1,D=!1,k=!1,e.style.clipPath=ve(0)},ke))):v<1&&!J&&(k=!1),O=requestAnimationFrame(je);return}if(C.forEach((v,M)=>{let Q=M*I*Ae,y=me(le(l,u+Q,oe+Q,h));J&&!g&&(se=Math.max(se,y),y=se),ie=y,v.style.strokeDashoffset=X==="reverse"?`${T[M]*y}`:`${T[M]*(1-y)}`,c&&(v.style.opacity=X==="reverse"?`${1-y}`:`${y}`),ue&&Y?v.style.stroke=ze(ue,Y,y):Y&&(v.style.stroke=Y),U!==null&&H!==null?v.style.strokeWidth=`${U+(H-U)*y}`:H!==null&&(v.style.strokeWidth=`${H}`),re!==null&&W!==null?v.style.fillOpacity=`${re+(W-re)*y}`:W!==null&&(v.style.fillOpacity=`${W}`),N&&v.tagName.toLowerCase()==="path"&&s[M]&&v.setAttribute("d",mt(s[M],N,y)),M===0&&(w?.(y),e.style.setProperty("--scroll-draw-progress",String(y))),y<1&&(Se=!1)}),B){let v=me(le(l,u,oe,h));for(let M in B){let Q=parseFloat(M);v>=Q&&!Oe.has(Q)&&(Oe.add(Q),B[M]?.())}}!D&&le(l,u,oe,h)>0&&(D=!0,P?.()),Se&&!k?(k=!0,ne?.(),Te<(q==="infinite"?1/0:q??0)&&(Te++,Ie=setTimeout(()=>{se=-1,D=!1,k=!1,Oe.clear(),Ge(),Re=!0},ke))):!Se&&!J&&(k=!1),O=requestAnimationFrame(je)}let it=!1;function Ye(){it||(it=!0,O=requestAnimationFrame(function(){je()}))}function Ue(){it=!1,cancelAnimationFrame(O)}let at=new IntersectionObserver(o=>{o.forEach(l=>{pe=l.isIntersecting,pe&&!_?(Re=!0,Ye()):Ue()})},{root:ce??null,threshold:ge,rootMargin:j});function Et(){C.forEach((o,l)=>{T[l]=Ve(o),o.style.strokeDasharray=`${T[l]}`}),vt(),Re=!0}let Xe;function qe(){clearTimeout(Xe),Xe=setTimeout(Et,150)}window.addEventListener("resize",qe),window.addEventListener("orientationchange",qe);let We;return typeof ResizeObserver<"u"&&(We=new ResizeObserver(()=>qe()),We.observe(document.body),We.observe(document.documentElement),We.observe(e)),E>0?setTimeout(()=>at.observe(e),E):at.observe(e),st({destroy(){cancelAnimationFrame(O),clearTimeout(Ie),Ue(),at.disconnect(),We?.disconnect(),window.removeEventListener("resize",qe),window.removeEventListener("orientationchange",qe),clearTimeout(Xe),gt()},replay(){se=-1,G=-1,Be=-1,D=!1,k=!1,Te=0,_=!1,ie=0,Oe.clear(),clearTimeout(Ie),Ge(),Re=!0,pe&&Ye()},pause(){_=!0,Ue()},resume(){_&&(_=!1,Re=!0,pe&&Ye())},seek(o){let l=Math.min(1,Math.max(0,o));ie=l,se=l,_=!0,Ue(),qt(l,A),Re=!0},getProgress(){return ie},refresh(){clearTimeout(Xe),Et(),pe&&!_&&Ye()}},()=>({tStart:u,tEnd:oe}))}function lr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Ot(e){let t=[],r=/([\w]+)\(([^)]*)\)/g,n;for(;(n=r.exec(e))!==null;){let i=[],a=[],f=n[2].trim();if(f)for(let m of f.split(/[\s,]+/)){let c=m.match(/^([-+]?[\d.eE]+)(.*)$/);i.push(c?parseFloat(c[1]):0),a.push(c?c[2]:"")}t.push({fn:n[1],nums:i,units:a})}return t}function cr(e,t,r){let n=Ot(e),i=Ot(t);return n.length===0||n.length!==i.length?r<1?e:t:n.map((a,f)=>{let m=i[f];return a.fn!==m.fn||a.nums.length!==m.nums.length?r<1?`${a.fn}(${a.nums.map((c,p)=>`${c}${a.units[p]}`).join(", ")})`:`${m.fn}(${m.nums.map((c,p)=>`${c}${m.units[p]}`).join(", ")})`:`${a.fn}(${a.nums.map((c,p)=>`${c+(m.nums[p]-c)*r}${a.units[p]}`).join(", ")})`}).join(" ")}function Rt(e,t,r){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*r);let n=String(e),i=String(t);if(lr(n))return ze(n,i,r);if(n.includes("("))return cr(n,i,r);let a=n.match(/^([-+]?[\d.]+)(.*)$/),f=i.match(/^([-+]?[\d.]+)(.*)$/);if(a&&f){let m=parseFloat(a[1]),c=parseFloat(f[1]);return`${m+(c-m)*r}${a[2]||f[2]}`}return r<1?n:i}function ur(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var mr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),fr=0,Ft="--scroll-draw-progress";function pr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Nt(e,t){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:n,trigger:i={},easing:a="ease-out",speed:f=1,once:m=!1,axis:c="y",scrollContainer:p,native:x=!0,velocityScale:I=!1,respectReducedMotion:A=!0,triggerElement:J,onProgress:Ee,onComplete:S,onEnter:$,onLeave:g,onEnterBack:E,onLeaveBack:b}=t,z=A&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,F=typeof a=="function"?a:Z[a]??Z["ease-out"],B=$e(i.start??"top bottom"),ee=$e(i.end??"bottom top"),ge=J??e,j=typeof p=="string"?document.querySelector(p):p??null,q=Object.entries(n).map(([s,u])=>({prop:ur(s),from:Array.isArray(u)?u[0]:"",to:Array.isArray(u)?u[1]:u}));function ke(){let s=window.getComputedStyle(e);for(let u of q)u.from===""&&(u.from=s.getPropertyValue(u.prop).trim()||"0")}function N(){for(let s of q)e.style.setProperty(s.prop,String(s.to))}let ye=new Map;for(let s of[...q.map(u=>u.prop),Ft])ye.set(s,e.style.getPropertyValue(s));function Le(){for(let[s,u]of ye)u?e.style.setProperty(s,u):e.style.removeProperty(s)}if(z)return N(),S?.(),{...r,destroy:Le,getProgress:()=>1};ke();let Ce=typeof a=="string"?Ke(a):null;function De(){if(!x||!pr()||!Ce||c!=="y"||j||ge!==e||m||f!==1||Ee||S||$||g||E||b||I!==!1||(i.start??"top bottom").trim()!=="top bottom"||(i.end??"bottom top").trim()!=="bottom top")return!1;for(let s of q)if(!mr.has(s.prop))return!1;return!0}function w(){let s=`ssd-a-${++fr}`,u=q.map(G=>`${G.prop}:${G.from}`).join(";"),oe=q.map(G=>`${G.prop}:${G.to}`).join(";"),k=document.createElement("style");k.setAttribute("data-ssd-animate",""),k.textContent=`@keyframes ${s}{from{${u}}to{${oe}}}.${s}{animation-name:${s};animation-duration:auto;animation-timing-function:${Ce};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(k),e.classList.add(s);let D=()=>c==="x"?window.scrollX:window.scrollY,O=()=>c==="x"?window.innerWidth:window.innerHeight,pe=()=>{let G=e.getBoundingClientRect();return Fe({top:G.top,height:G.height},D(),O(),B,ee)};Me(e,{type:"animate",getProgress:()=>se.getProgress(),getTrigger:pe});let se={destroy(){e.classList.remove(s),k.remove(),e.style.animationPlayState="",Le(),Pe(e)},replay(){e.classList.remove(s),e.offsetWidth,e.classList.add(s)},pause(){e.style.animationPlayState="paused"},resume(){e.style.animationPlayState=""},seek(G){let _=Math.min(1,Math.max(0,G));e.classList.remove(s);for(let ie of q)e.style.setProperty(ie.prop,Rt(ie.from,ie.to,_))},getProgress(){let{tStart:G,tEnd:_}=pe();return F(le(D(),G,_,f))}};return se}if(De())return w();let P=0,ne=0,he=0,Ne=!1,be=!1,xe=-1,te=0,me=!1,we=NaN,He=-1,ce=0,ue=()=>j?c==="x"?j.scrollLeft:j.scrollTop:c==="x"?window.scrollX:window.scrollY,Y=()=>j?c==="x"?j.clientWidth:j.clientHeight:c==="x"?window.innerWidth:window.innerHeight;function U(){let s=Qe(ge,j,c),u=Fe(s,s.scroll,Y(),B,ee);P=u.tStart,ne=u.tEnd}function H(s){e.style.setProperty(Ft,String(s));for(let u of q)e.style.setProperty(u.prop,Rt(u.from,u.to,s));Ee?.(s)}function re(s){if(isNaN(we)){we=s;return}we<=0&&s>0?$?.():we>0&&s<=0&&b?.(),we<1&&s>=1?g?.():we>=1&&s<1&&E?.(),we=s}function W(){if(!Ne||be)return;let s=performance.now(),u=ue(),oe=f;if(I!==!1){let O=s-ce,pe=O>0?Math.abs(u-(He<0?u:He))/O:0;oe=f*Math.max(.2,1+pe*(typeof I=="number"?I:1)*.04)}He=u,ce=s;let k=ne===P?0:(u-P)/(ne-P);re(k);let D=F(le(u,P,ne,oe));m&&(xe=Math.max(xe,D),D=xe),te=D,H(D),D>=1&&!me?(me=!0,S?.()):D<1&&!m&&(me=!1),he=requestAnimationFrame(W)}U(),ne===P&&K("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let s=F(le(ue(),P,ne,f));m&&s>0&&(xe=s),te=s,H(s)}let ve=new IntersectionObserver(s=>{s.forEach(u=>{Ne=u.isIntersecting,Ne&&!be?he=requestAnimationFrame(W):cancelAnimationFrame(he)})},{root:j??null}),C;function T(){clearTimeout(C),C=setTimeout(U,150)}return window.addEventListener("resize",T),window.addEventListener("orientationchange",T),ve.observe(e),Me(e,{type:"animate",getProgress:()=>te,getTrigger:()=>({tStart:P,tEnd:ne})}),{destroy(){cancelAnimationFrame(he),ve.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("orientationchange",T),clearTimeout(C),Le(),Pe(e)},replay(){xe=-1,me=!1,te=0,be=!1,H(0)},pause(){be=!0,cancelAnimationFrame(he)},resume(){be&&(be=!1,Ne&&(he=requestAnimationFrame(W)))},seek(s){let u=Math.min(1,Math.max(0,s));te=u,xe=u,be=!0,cancelAnimationFrame(he),H(u)},getProgress(){return te}}}var et={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ht(e,t){if(typeof window>"u")return et;let r=typeof e=="string"?document.querySelector(e):e;return r?Nt(r,t):(K("scrollAnimate: element not found:",e),et)}function _t(e,t={}){if(typeof window>"u")return et;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return K("scrollParallax: element not found:",e),et;let{speed:n=.3,axis:i="y",easing:a="linear",trigger:f,onProgress:m}=t,c=r.getBoundingClientRect(),p=i==="x"?c.width:c.height,x=n*p;return Nt(r,{props:i==="x"?{transform:["translateX(0px)",`translateX(${-x}px)`]}:{transform:["translateY(0px)",`translateY(${-x}px)`]},trigger:f??{start:"top bottom",end:"bottom top"},easing:a,native:!1,onProgress:m})}var pt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Vt(e,t){if(typeof window>"u")return pt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return K("scrollCounter: element not found:",e),pt;let n=r,{from:i=0,to:a,format:f,easing:m="ease-out",trigger:c={},once:p=!0,decimals:x,onComplete:I}=t,A=x!==void 0?w=>w.toFixed(x):f??(w=>String(Math.round(w))),J=typeof m=="function"?m:Z[m]??Z["ease-out"],Ee=$e(c.start??"top 80%"),S=$e(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return n.textContent=A(a),I?.(),pt;let g=0,E=0,b=0,z=!1,F=!1,B=-1,ee=0,ge=!1,j=()=>window.scrollY,q=()=>window.innerHeight;function ke(){let w=n.getBoundingClientRect(),P=Fe({top:w.top,height:w.height},j(),q(),Ee,S);g=P.tStart,E=P.tEnd}function N(w){n.textContent=A(i+(a-i)*w),n.style.setProperty("--scroll-draw-progress",String(w))}function ye(){if(!z||F)return;let w=J(le(j(),g,E,1));p&&(B=Math.max(B,w),w=B),ee=w,N(w),w>=1&&!ge?(ge=!0,I?.()):w<1&&!p&&(ge=!1),b=requestAnimationFrame(ye)}ke();{let w=J(le(j(),g,E,1));p&&w>0&&(B=w),ee=w,N(w)}let Le=new IntersectionObserver(w=>{w.forEach(P=>{z=P.isIntersecting,z&&!F?b=requestAnimationFrame(ye):cancelAnimationFrame(b)})}),Ce;function De(){clearTimeout(Ce),Ce=setTimeout(ke,150)}return window.addEventListener("resize",De),window.addEventListener("orientationchange",De),Le.observe(n),Me(n,{type:"counter",getProgress:()=>ee,getTrigger:()=>({tStart:g,tEnd:E})}),{destroy(){cancelAnimationFrame(b),Le.disconnect(),window.removeEventListener("resize",De),window.removeEventListener("orientationchange",De),clearTimeout(Ce),Pe(n)},replay(){B=-1,ge=!1,ee=0,F=!1,N(0)},pause(){F=!0,cancelAnimationFrame(b)},resume(){F&&(F=!1,z&&(b=requestAnimationFrame(ye)))},seek(w){let P=Math.min(1,Math.max(0,w));ee=P,B=P,F=!0,cancelAnimationFrame(b),N(P)},getProgress(){return ee}}}var zt="http://www.w3.org/2000/svg",dr="cinematic-photo",dt=e=>e<0?0:e>1?1:e;function tt(e){let t=parseFloat(e);return Number.isFinite(t)?dt(t/100):0}function gr(e){return Z[e]??Z.linear}var yr={destroy:()=>{},getProgress:()=>0},rt=class{constructor(t){if(typeof document>"u"){this.mount=null;return}this.mount=typeof t.wrapper=="string"?document.querySelector(t.wrapper):t.wrapper,this.mount||K("Cinematic: wrapper not found:",t.wrapper)}loadStory(t){let r=this.mount;if(typeof window>"u"||!r)return yr;r.style.position="relative",r.style.height=t.totalHeight,r.style.display="block";let n=document.createElement("div");n.setAttribute("data-cinematic-stage",""),n.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",r.appendChild(n);let i=[];for(let S of t.scenes){if(S.background){let g=document.createElement("img");g.id=dr,g.src=S.background,g.alt="",g.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(g)}let $=S.animations.filter(g=>g.type==="draw");if($.length){let g=document.createElementNS(zt,"svg");g.setAttribute("viewBox",`0 0 ${t.canvas.width} ${t.canvas.height}`),g.setAttribute("preserveAspectRatio","xMidYMid meet"),g.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(g);for(let E of $){let b=document.createElementNS(zt,"path");b.id=E.target.replace(/^#/,""),b.setAttribute("d",E.d),b.setAttribute("fill","none"),b.setAttribute("stroke",E.stroke),b.setAttribute("stroke-width",String(E.strokeWidth)),b.setAttribute("stroke-linecap","round"),b.setAttribute("stroke-linejoin","round");let z=E.length||b.getTotalLength?.()||0;b.style.strokeDasharray=String(z),b.style.strokeDashoffset=String(z),g.appendChild(b),i.push({kind:"draw",el:b,start:tt(E.start),end:tt(E.end),ease:gr(E.easing),length:z})}}for(let g of S.animations){if(g.type!=="fade")continue;let E=n.querySelector(g.target)??document.querySelector(g.target);E&&(E.style.opacity=String(g.from),i.push({kind:"fade",el:E,start:tt(g.start),end:tt(g.end),ease:Z["ease-in-out"]??Z.linear,from:g.from,to:g.to}))}}let a=0,f=()=>{let S=r.offsetHeight-window.innerHeight;return S<=0?r.getBoundingClientRect().top<=0?1:0:dt(-r.getBoundingClientRect().top/S)},m=S=>{for(let $ of i){let g=$.end-$.start,E=g<=0?S>=$.end?1:0:dt((S-$.start)/g),b=$.ease(E);$.kind==="draw"?$.el.style.strokeDashoffset=String($.length*(1-b)):$.el.style.opacity=String($.from+($.to-$.from)*b)}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return m(1),{destroy:()=>{},getProgress:()=>1};let c=0,p=!1,x=!1,I=()=>{a=f(),m(a),p&&(c=requestAnimationFrame(I))},A=()=>{p||(p=!0,c=requestAnimationFrame(I))},J=()=>{p=!1,cancelAnimationFrame(c)},Ee=new IntersectionObserver(S=>{for(let $ of S)x=$.isIntersecting,x?A():J()},{threshold:0});return Ee.observe(n),a=f(),m(a),Me(r,{type:"draw",getProgress:()=>a,getTrigger:()=>{let S=r.getBoundingClientRect().top+window.scrollY;return{tStart:S,tEnd:S+Math.max(0,r.offsetHeight-window.innerHeight)}}}),{destroy(){J(),Ee.disconnect(),Pe(r)},getProgress:()=>a}}};function hr(e,t){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let n=typeof e=="string"?document.querySelector(e):e;return n?Je(n,t):(K("Container not found:",e),r)}if(typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("scroll-draw")){class e extends HTMLElement{constructor(){super(...arguments);this.instance=null}connectedCallback(){let n={},i=this.getAttribute("speed"),a=this.getAttribute("easing"),f=this.getAttribute("stagger"),m=this.getAttribute("direction"),c=this.getAttribute("selector");i&&(n.speed=parseFloat(i)),a&&(n.easing=a),f&&(n.stagger=parseFloat(f)),m&&(n.direction=m),c&&(n.selector=c),this.hasAttribute("fade")&&(n.fade=this.getAttribute("fade")!=="false"),this.hasAttribute("once")&&(n.once=this.getAttribute("once")!=="false"),this.instance=Je(this,n)}disconnectedCallback(){this.instance?.destroy(),this.instance=null}}customElements.define("scroll-draw",e)}return Zt(br);})();
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
type StoryEasing = 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'spring' | 'bounce' | 'elastic';
|
|
2
|
+
/** A traced path that strokes itself on across a scroll range. */
|
|
3
|
+
interface DrawAnimation {
|
|
4
|
+
type: 'draw';
|
|
5
|
+
/** DOM id the runtime binds to (with leading '#'), e.g. "#path-3". */
|
|
6
|
+
target: string;
|
|
7
|
+
/** SVG path data, in canvas coordinates. */
|
|
8
|
+
d: string;
|
|
9
|
+
/** Pre-measured total path length (px). */
|
|
10
|
+
length: number;
|
|
11
|
+
/** Scroll progress where the draw begins, e.g. "20%". */
|
|
12
|
+
start: string;
|
|
13
|
+
/** Scroll progress where the draw completes, e.g. "50%". */
|
|
14
|
+
end: string;
|
|
15
|
+
stroke: string;
|
|
16
|
+
strokeWidth: number;
|
|
17
|
+
easing: StoryEasing;
|
|
18
|
+
}
|
|
19
|
+
/** Any layer fading opacity across a scroll range. */
|
|
20
|
+
interface FadeAnimation {
|
|
21
|
+
type: 'fade';
|
|
22
|
+
target: string;
|
|
23
|
+
start: string;
|
|
24
|
+
end: string;
|
|
25
|
+
from: number;
|
|
26
|
+
to: number;
|
|
27
|
+
}
|
|
28
|
+
type StoryAnimation = DrawAnimation | FadeAnimation;
|
|
29
|
+
interface StoryScene {
|
|
30
|
+
id: string;
|
|
31
|
+
/** Optional background layer (a product photo) as a data URL or remote URL. */
|
|
32
|
+
background?: string;
|
|
33
|
+
animations: StoryAnimation[];
|
|
34
|
+
}
|
|
35
|
+
interface Story {
|
|
36
|
+
version: 1;
|
|
37
|
+
/** Total scroll height of the experience, e.g. "400vh". */
|
|
38
|
+
totalHeight: string;
|
|
39
|
+
/** The authoring viewBox the coordinates are expressed in. */
|
|
40
|
+
canvas: {
|
|
41
|
+
width: number;
|
|
42
|
+
height: number;
|
|
43
|
+
};
|
|
44
|
+
scenes: StoryScene[];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface CinematicOptions {
|
|
48
|
+
/** Mount point — a selector or element. Becomes the scroll wrapper. */
|
|
49
|
+
wrapper: string | HTMLElement;
|
|
50
|
+
}
|
|
51
|
+
interface CinematicInstance {
|
|
52
|
+
/** Stop the scroll loop and detach observers (built DOM is left in place). */
|
|
53
|
+
destroy: () => void;
|
|
54
|
+
/** Current global scroll progress through the story (0–1). */
|
|
55
|
+
getProgress: () => number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The viral loader. Reads a Cinematic Story (authored in the Studio) and wires
|
|
59
|
+
* a scroll-scrubbed timeline: paths stroke themselves on and layers fade in as
|
|
60
|
+
* the user scrolls, all driven off the wrapper's scroll progress.
|
|
61
|
+
*
|
|
62
|
+
* import { Cinematic } from "svg-scroll-draw";
|
|
63
|
+
* import story from "./story.json";
|
|
64
|
+
* new Cinematic({ wrapper: "#app" }).loadStory(story);
|
|
65
|
+
*/
|
|
66
|
+
declare class Cinematic {
|
|
67
|
+
private mount;
|
|
68
|
+
constructor(options: CinematicOptions);
|
|
69
|
+
loadStory(story: Story): CinematicInstance;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export { Cinematic, type CinematicInstance, type CinematicOptions, type DrawAnimation, type FadeAnimation, type Story, type StoryAnimation, type StoryEasing, type StoryScene };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
type StoryEasing = 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'spring' | 'bounce' | 'elastic';
|
|
2
|
+
/** A traced path that strokes itself on across a scroll range. */
|
|
3
|
+
interface DrawAnimation {
|
|
4
|
+
type: 'draw';
|
|
5
|
+
/** DOM id the runtime binds to (with leading '#'), e.g. "#path-3". */
|
|
6
|
+
target: string;
|
|
7
|
+
/** SVG path data, in canvas coordinates. */
|
|
8
|
+
d: string;
|
|
9
|
+
/** Pre-measured total path length (px). */
|
|
10
|
+
length: number;
|
|
11
|
+
/** Scroll progress where the draw begins, e.g. "20%". */
|
|
12
|
+
start: string;
|
|
13
|
+
/** Scroll progress where the draw completes, e.g. "50%". */
|
|
14
|
+
end: string;
|
|
15
|
+
stroke: string;
|
|
16
|
+
strokeWidth: number;
|
|
17
|
+
easing: StoryEasing;
|
|
18
|
+
}
|
|
19
|
+
/** Any layer fading opacity across a scroll range. */
|
|
20
|
+
interface FadeAnimation {
|
|
21
|
+
type: 'fade';
|
|
22
|
+
target: string;
|
|
23
|
+
start: string;
|
|
24
|
+
end: string;
|
|
25
|
+
from: number;
|
|
26
|
+
to: number;
|
|
27
|
+
}
|
|
28
|
+
type StoryAnimation = DrawAnimation | FadeAnimation;
|
|
29
|
+
interface StoryScene {
|
|
30
|
+
id: string;
|
|
31
|
+
/** Optional background layer (a product photo) as a data URL or remote URL. */
|
|
32
|
+
background?: string;
|
|
33
|
+
animations: StoryAnimation[];
|
|
34
|
+
}
|
|
35
|
+
interface Story {
|
|
36
|
+
version: 1;
|
|
37
|
+
/** Total scroll height of the experience, e.g. "400vh". */
|
|
38
|
+
totalHeight: string;
|
|
39
|
+
/** The authoring viewBox the coordinates are expressed in. */
|
|
40
|
+
canvas: {
|
|
41
|
+
width: number;
|
|
42
|
+
height: number;
|
|
43
|
+
};
|
|
44
|
+
scenes: StoryScene[];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface CinematicOptions {
|
|
48
|
+
/** Mount point — a selector or element. Becomes the scroll wrapper. */
|
|
49
|
+
wrapper: string | HTMLElement;
|
|
50
|
+
}
|
|
51
|
+
interface CinematicInstance {
|
|
52
|
+
/** Stop the scroll loop and detach observers (built DOM is left in place). */
|
|
53
|
+
destroy: () => void;
|
|
54
|
+
/** Current global scroll progress through the story (0–1). */
|
|
55
|
+
getProgress: () => number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The viral loader. Reads a Cinematic Story (authored in the Studio) and wires
|
|
59
|
+
* a scroll-scrubbed timeline: paths stroke themselves on and layers fade in as
|
|
60
|
+
* the user scrolls, all driven off the wrapper's scroll progress.
|
|
61
|
+
*
|
|
62
|
+
* import { Cinematic } from "svg-scroll-draw";
|
|
63
|
+
* import story from "./story.json";
|
|
64
|
+
* new Cinematic({ wrapper: "#app" }).loadStory(story);
|
|
65
|
+
*/
|
|
66
|
+
declare class Cinematic {
|
|
67
|
+
private mount;
|
|
68
|
+
constructor(options: CinematicOptions);
|
|
69
|
+
loadStory(story: Story): CinematicInstance;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export { Cinematic, type CinematicInstance, type CinematicOptions, type DrawAnimation, type FadeAnimation, type Story, type StoryAnimation, type StoryEasing, type StoryScene };
|