svg-scroll-draw 2.23.6 → 2.24.0
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 +84 -3
- package/dist/angular/index.mjs +1 -1
- package/dist/astro/index.mjs +1 -1
- package/dist/cdn/svg-scroll-draw.dev.global.js +33 -49
- package/dist/cdn/svg-scroll-draw.global.js +3 -3
- package/dist/{chunk-XNM3VKEK.mjs → chunk-32ZCSGFZ.mjs} +1 -1
- package/dist/{chunk-OSGWGHQJ.mjs → chunk-5SKWSPQT.mjs} +1 -1
- package/dist/{chunk-VJ5ZU55P.mjs → chunk-7USW2XFB.mjs} +1 -1
- package/dist/{chunk-K6VATIJH.mjs → chunk-7XOFQCQE.mjs} +1 -1
- package/dist/chunk-BDXWPUBJ.mjs +2 -0
- package/dist/{chunk-NYQJPPMP.mjs → chunk-BRV2B2YW.mjs} +1 -1
- package/dist/chunk-EBU6E26L.mjs +1 -0
- package/dist/{chunk-22B37AWY.mjs → chunk-NX74KN5X.mjs} +1 -1
- package/dist/{chunk-CZLUBJAI.mjs → chunk-QZKYGS74.mjs} +1 -1
- package/dist/{chunk-PAGN26EH.mjs → chunk-U5TKLHGW.mjs} +1 -1
- package/dist/cinematic/index.cjs +2 -2
- package/dist/cinematic/index.d.mts +1 -1
- package/dist/cinematic/index.d.ts +1 -1
- package/dist/cinematic/index.mjs +1 -1
- package/dist/devtools/index.cjs +1 -1
- package/dist/devtools/index.mjs +1 -1
- package/dist/frames/index.cjs +1 -0
- package/dist/frames/index.d.mts +42 -0
- package/dist/frames/index.d.ts +42 -0
- package/dist/frames/index.mjs +1 -0
- package/dist/group/index.mjs +1 -1
- package/dist/horizontal/index.mjs +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.mjs +1 -1
- package/dist/nuxt/index.mjs +1 -1
- package/dist/pin/index.mjs +1 -1
- package/dist/progress/index.mjs +1 -1
- package/dist/react/index.mjs +1 -1
- package/dist/reveal/index.mjs +1 -1
- package/dist/snap/index.mjs +1 -1
- package/dist/solid/index.mjs +1 -1
- package/dist/svelte/index.mjs +1 -1
- package/dist/text/index.mjs +1 -1
- package/dist/timeline/index.mjs +1 -1
- package/dist/video/index.mjs +1 -1
- package/dist/vue/index.mjs +1 -1
- package/dist/web-component/index.mjs +1 -1
- package/package.json +18 -2
- package/dist/chunk-BCV4RAIX.mjs +0 -1
- package/dist/chunk-BSW7W2Y5.mjs +0 -2
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
Each drop-in is tested side by side against the original in real browsers (AOS 2.3.4, which has had no release since; ScrollReveal 4.0.9, which is GPL-3.0 where this is MIT; vivus 0.4.6). `npx svg-scroll-draw migrate` makes the change across a project.
|
|
24
24
|
|
|
25
|
-
**And the rest of scroll animation.** Reveal, pin, snap, parallax, counters, video scrub and text splitting, each its own entry point, so you load only what you import. Works in React, Next.js, Vue, Svelte, Solid, Angular, Astro, Nuxt and vanilla JS. Plus [free in-browser tools](https://svg-scroll-draw.vercel.app/tools) — generators, editors and converters — that write the code for you.
|
|
25
|
+
**And the rest of scroll animation.** Reveal, pin, snap, parallax, counters, video and image-sequence scrub and text splitting, each its own entry point, so you load only what you import. Works in React, Next.js, Vue, Svelte, Solid, Angular, Astro, Nuxt and vanilla JS. Plus [free in-browser tools](https://svg-scroll-draw.vercel.app/tools) — generators, editors and converters — that write the code for you.
|
|
26
26
|
|
|
27
27
|
**[Live Demo](https://svg-scroll-draw.vercel.app)** · [npm](https://www.npmjs.com/package/svg-scroll-draw) · [Docs](https://svg-scroll-draw.vercel.app/docs) · [Examples](https://svg-scroll-draw.vercel.app/examples) · [Report a bug](https://github.com/DhruvilChauahan0210/ink-scroll/issues)
|
|
28
28
|
|
|
@@ -47,6 +47,7 @@ Each drop-in is tested side by side against the original in real browsers (AOS 2
|
|
|
47
47
|
| `scrollParallax` | `svg-scroll-draw` | Move any element at a different rate than scroll. Speed multiplier, reverse direction. |
|
|
48
48
|
| `scrollDraw` | `svg-scroll-draw` | The original — scroll-driven SVG path drawing via `stroke-dashoffset`. |
|
|
49
49
|
| `scrollVideo` | `svg-scroll-draw/video` | Tie `<video>.currentTime` to scroll. The Apple/Stripe product-page pattern. |
|
|
50
|
+
| `scrollFrames` | `svg-scroll-draw/frames` | Scrub an image sequence on a `<canvas>` with the scroll: the frame-by-frame version of the same pattern, for footage a video decoder cannot seek smoothly. |
|
|
50
51
|
| `scrollText` | `svg-scroll-draw/text` | Split text into chars/words/lines and stagger-animate each on scroll. 3.5 KB, nothing else to load. |
|
|
51
52
|
| `devtools` | `svg-scroll-draw/devtools` | Visual overlay showing every active animation's triggers and progress. Dev-only. |
|
|
52
53
|
| `AOS` | `svg-scroll-draw/aos` | Drop-in replacement for AOS: same `AOS.init()`, same `data-aos` markup, no `aos.css`. |
|
|
@@ -246,6 +247,84 @@ import { ScrollVideo } from 'svg-scroll-draw/react';
|
|
|
246
247
|
|
|
247
248
|
---
|
|
248
249
|
|
|
250
|
+
## scrollFrames — image-sequence scrubbing on a canvas
|
|
251
|
+
|
|
252
|
+
The product-page film drawn one still at a time: frame `round(progress × (count − 1))` of a numbered image sequence, painted on a `<canvas>` as you scroll. A video seeks to a keyframe and decodes forward, so a fast scrub stutters; a sequence of decoded images shows any frame at once, in every browser.
|
|
253
|
+
|
|
254
|
+
```js
|
|
255
|
+
import { scrollFrames } from 'svg-scroll-draw/frames';
|
|
256
|
+
|
|
257
|
+
// 120 frames: /film/0001.jpg … /film/0120.jpg
|
|
258
|
+
scrollFrames('#film', {
|
|
259
|
+
frames: (i) => `/film/${String(i + 1).padStart(4, '0')}.jpg`,
|
|
260
|
+
count: 120,
|
|
261
|
+
trigger: { start: 'top top', end: 'bottom top' },
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
// Or a list of URLs, and the whole picture inside the box
|
|
265
|
+
scrollFrames('#turntable', { frames: urls, fit: 'contain' });
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
```html
|
|
269
|
+
<!-- The library adds no ARIA: say what the film shows. -->
|
|
270
|
+
<canvas id="film" role="img" aria-label="The headphones turning to show the hinge" style="width:100%;height:100vh"></canvas>
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Size the canvas with CSS. The library sets its drawing buffer to that box × `devicePixelRatio` (capped at 2) and redraws when the box changes size.
|
|
274
|
+
|
|
275
|
+
Frame 0 loads first, then the last frame, then the midpoints of every gap, coarse to fine, so a reader who scrolls fast has a frame near wherever they land early on; at most `concurrency` images load at once. Until the frame the scroll calls for arrives, the nearest loaded one shows, and the canvas redraws as closer ones come in. A frame that fails to load is skipped the same way, with one console warning naming its URL. The canvas is redrawn only when the frame to show changes, not on every animation frame.
|
|
276
|
+
|
|
277
|
+
Under `prefers-reduced-motion: reduce` only the last frame is loaded and drawn. Turned on mid-visit, the scrub stops on the last frame and nothing more is loaded. Only that frame exists then, so `seek()` and `replay()` do not change the picture.
|
|
278
|
+
|
|
279
|
+
Every frame stays decoded in memory for the life of the instance, at its full pixel size, so keep the budget modest: as few frames as the motion needs, each no larger than the canvas shows it (WebP or JPEG at the display size, not camera originals). A hundred 1920×1080 frames hold about 800 MB decoded.
|
|
280
|
+
|
|
281
|
+
If the canvas has no CSS size of its own (it takes its box from its `width` and `height` attributes), the library holds that box with an inline size or `aspect-ratio` the first time it writes the drawing buffer, so the buffer cannot resize the box it is measured from.
|
|
282
|
+
|
|
283
|
+
For the pinned-film pattern, put the canvas in a `position: sticky` stage and point `triggerElement` at the tall track around it, as with `scrollVideo`.
|
|
284
|
+
|
|
285
|
+
#### React
|
|
286
|
+
|
|
287
|
+
There is no component; call it from an effect and return its `destroy`:
|
|
288
|
+
|
|
289
|
+
```tsx
|
|
290
|
+
import { useEffect, useRef } from 'react';
|
|
291
|
+
import { scrollFrames } from 'svg-scroll-draw/frames';
|
|
292
|
+
|
|
293
|
+
export function Film() {
|
|
294
|
+
const ref = useRef<HTMLCanvasElement>(null);
|
|
295
|
+
useEffect(() => {
|
|
296
|
+
const film = scrollFrames(ref.current!, {
|
|
297
|
+
frames: (i) => `/film/${String(i + 1).padStart(4, '0')}.jpg`,
|
|
298
|
+
count: 120,
|
|
299
|
+
});
|
|
300
|
+
return () => film.destroy();
|
|
301
|
+
}, []);
|
|
302
|
+
return <canvas ref={ref} role="img" aria-label="The headphones turning" style={{ width: '100%', height: '100vh' }} />;
|
|
303
|
+
}
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
#### scrollFrames options
|
|
307
|
+
|
|
308
|
+
| Option | Type | Default | Description |
|
|
309
|
+
|---|---|---|---|
|
|
310
|
+
| `frames` | `string[] \| (index: number) => string` | — | The image URLs in order, or a function from a 0-based index to a URL. Required |
|
|
311
|
+
| `count` | `number` | `frames.length` | How many frames. Required when `frames` is a function |
|
|
312
|
+
| `trigger` | `TriggerConfig` | `{ start: 'top top', end: 'bottom top' }` | — |
|
|
313
|
+
| `easing` | `string \| fn` | `"linear"` | — |
|
|
314
|
+
| `once` | `boolean` | `false` | Hold the furthest frame reached when scrolling back |
|
|
315
|
+
| `axis` | `"x" \| "y"` | `"y"` | — |
|
|
316
|
+
| `triggerElement` | `Element` | the canvas | Measure the trigger window from this element: the tall track behind a `position: sticky` stage |
|
|
317
|
+
| `fit` | `"cover" \| "contain"` | `"cover"` | How each frame fills the canvas: `cover` fills it and crops, `contain` shows the whole frame; both centred |
|
|
318
|
+
| `concurrency` | `number` | `6` | How many images load at once |
|
|
319
|
+
| `onReady` | `() => void` | — | The first frame is drawn |
|
|
320
|
+
| `onLoad` | `() => void` | — | Every frame has loaded or failed |
|
|
321
|
+
| `onProgress` | `(alpha: number, frame: number) => void` | — | Progress, and the index of the frame it calls for |
|
|
322
|
+
| `onComplete` | `() => void` | — | — |
|
|
323
|
+
|
|
324
|
+
It returns the same instance as every other API: `{ destroy, replay, pause, resume, seek, getProgress }`. `destroy()` stops the loads still in flight.
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
249
328
|
## scrollText — text reveal on scroll
|
|
250
329
|
|
|
251
330
|
A 3.5 KB alternative to GSAP SplitText. SplitText is free and 3.6 KB, but it only splits — animating the pieces needs GSAP core (27.7 KB) on top.
|
|
@@ -630,6 +709,7 @@ devtools.highlight('#my-element'); // outline for 2 seconds
|
|
|
630
709
|
| `svg-scroll-draw/astro` | `initScrollDraw()` · **v2:** `initScrollAnimate()`, `initScrollCounter()`, `initScrollText()`, `initAll()` |
|
|
631
710
|
| `svg-scroll-draw/nuxt` | All Vue v1+v2 composables and components, `createScrollDrawPlugin()` |
|
|
632
711
|
| `svg-scroll-draw/video` | `scrollVideo` |
|
|
712
|
+
| `svg-scroll-draw/frames` | `scrollFrames` |
|
|
633
713
|
| `svg-scroll-draw/text` | `scrollText` |
|
|
634
714
|
| `svg-scroll-draw/group` | `scrollDrawGroup`, `scrollDrawSequence` · **v2:** `scrollAnimateGroup`, `scrollAnimateSequence`, `scrollParallaxGroup` |
|
|
635
715
|
| `svg-scroll-draw/timeline` | `scrollDrawTimeline` |
|
|
@@ -649,12 +729,13 @@ devtools.highlight('#my-element'); // outline for 2 seconds
|
|
|
649
729
|
<!-- size-table:start -->
|
|
650
730
|
| Entry | Gzipped |
|
|
651
731
|
|---|---|
|
|
652
|
-
| `svg-scroll-draw` (main, every core API) | 11.
|
|
732
|
+
| `svg-scroll-draw` (main, every core API) | 11.5 KB |
|
|
653
733
|
| `svg-scroll-draw/react` (includes the engine) | 12.8 KB |
|
|
654
|
-
| `svg-scroll-draw` + `svg-scroll-draw/react` (together; the engine ships once) | 14.
|
|
734
|
+
| `svg-scroll-draw` + `svg-scroll-draw/react` (together; the engine ships once) | 14.4 KB |
|
|
655
735
|
| `svg-scroll-draw/reveal` | 5.7 KB |
|
|
656
736
|
| `svg-scroll-draw/text` | 3.5 KB |
|
|
657
737
|
| `svg-scroll-draw/video` | 2.9 KB |
|
|
738
|
+
| `svg-scroll-draw/frames` | 4.0 KB |
|
|
658
739
|
| `svg-scroll-draw/scrollreveal` | 4.7 KB |
|
|
659
740
|
| `svg-scroll-draw/vivus` | 4.2 KB |
|
|
660
741
|
| `svg-scroll-draw/aos` (styles included) | 3.2 KB |
|
package/dist/angular/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a,b}from'../chunk-XSVTHCLO.mjs';import {a as a$3}from'../chunk-
|
|
1
|
+
import {a,b}from'../chunk-XSVTHCLO.mjs';import {a as a$3}from'../chunk-BRV2B2YW.mjs';import {a as a$4}from'../chunk-32ZCSGFZ.mjs';import {a as a$2}from'../chunk-U5TKLHGW.mjs';import {a as a$1}from'../chunk-7USW2XFB.mjs';import {b as b$1}from'../chunk-7XOFQCQE.mjs';import'../chunk-V3Z6G5JE.mjs';import'../chunk-UPWWULKI.mjs';import'../chunk-XC5NR2MU.mjs';import'../chunk-2PYLM3E7.mjs';import'../chunk-NV6YTPHI.mjs';import'../chunk-THPTANES.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-5PJEKEEP.mjs';import'../chunk-EBU6E26L.mjs';import'../chunk-LFSU6LR3.mjs';var r=class{constructor(t){this.create=t;this.instance=null;this.el=null;this.key="";}init(t,e){return this.destroy(),this.el=t,this.latest=e,this.key=a(e),this.instance=this.create(t,b(e,()=>this.latest)),this}update(t){return this.el?a(t)!==this.key?this.init(this.el,t):(this.latest=t,this):this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(t){return this.instance?.seek(t),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=this.el=null,this}},u=class extends r{constructor(){super(b$1);}init(t,e={}){return super.init(t,e)}},h=class extends r{constructor(){super(a$1);}},m=class extends r{constructor(){super(a$2);}},O=class extends r{constructor(){super(a$3);}init(t,e={}){return super.init(t,e)}},d=class extends r{constructor(){super(a$4);}init(t,e={}){return super.init(t,e)}};export{r as EngineRef,h as ScrollAnimateRef,m as ScrollCounterRef,u as ScrollDrawRef,d as ScrollTextRef,O as ScrollVideoRef};
|
package/dist/astro/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as scrollDraw}from'../chunk-
|
|
1
|
+
export{a as scrollDraw}from'../chunk-NX74KN5X.mjs';import {a as a$2}from'../chunk-32ZCSGFZ.mjs';import {a as a$1}from'../chunk-U5TKLHGW.mjs';import {a}from'../chunk-7USW2XFB.mjs';import {b}from'../chunk-7XOFQCQE.mjs';import'../chunk-V3Z6G5JE.mjs';import'../chunk-UPWWULKI.mjs';import'../chunk-XC5NR2MU.mjs';import'../chunk-2PYLM3E7.mjs';import'../chunk-NV6YTPHI.mjs';import'../chunk-THPTANES.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-5PJEKEEP.mjs';import'../chunk-EBU6E26L.mjs';import {b as b$1}from'../chunk-LFSU6LR3.mjs';function i(){return typeof document>"u"?null:document}var p=new WeakMap,g;function c(r,t,n,o){let l=p.get(r)??new Map;p.set(r,l);let f=()=>{let e=n(),s=l.get(t);s&&s.key===e||(s?.inst.destroy(),l.set(t,{inst:o(e),key:e,build:f,users:s?.users??0}));};f(),l.get(t).users++;let S=true;typeof MutationObserver<"u"&&(g??(g=new MutationObserver(e=>e.forEach(s=>p.get(s.target)?.forEach(O=>O.build())))),g.observe(r,{attributes:true,attributeFilter:["draw","animate","counter","text"].map(e=>`data-scroll-${e}-options`).concat("data-scroll-drawoptions")}));let a=()=>l.get(t)?.inst;return {destroy:()=>{let e=l.get(t);!S||!e||(S=false,!(--e.users>0)&&(e.inst.destroy(),l.delete(t)));},replay:()=>a()?.replay(),pause:()=>a()?.pause(),resume:()=>a()?.resume(),seek:e=>a()?.seek(e),getProgress:()=>a()?.getProgress()??0,refresh:()=>a()?.refresh?.()}}function u(r,t){try{return r?JSON.parse(r):t}catch{return t}}function E(r=i()){return r?Array.from(r.querySelectorAll("[data-scroll-draw]")).map(t=>c(t,"draw",()=>t.dataset.scrollDrawOptions??t.dataset.scrollDrawoptions??"",n=>b(t,u(n,{})))):[]}function A(r=i()){return r?Array.from(r.querySelectorAll("[data-scroll-animate]")).map(t=>c(t,"animate",()=>t.dataset.scrollAnimateOptions??"",n=>a(t,u(n,{props:{}})))):[]}function I(r=i()){return r?Array.from(r.querySelectorAll("[data-scroll-counter]")).map(t=>c(t,"counter",()=>t.dataset.scrollCounterOptions??"",n=>{let o=u(n,{});return !o.to&&o.to!==0&&(b$1('initScrollCounter: element missing "to" in options JSON:',t),o.to=0),typeof o.format!="function"&&o.format!==void 0&&(b$1('initScrollCounter: "format" must be a function, so it cannot come from JSON; use "decimals":',t),delete o.format),a$1(t,o)})):[]}function M(r=i()){return r?Array.from(r.querySelectorAll("[data-scroll-text]")).map(t=>c(t,"text",()=>t.dataset.scrollTextOptions??"",n=>a$2(t,u(n,{})))):[]}function H(r=i()){return {draw:E(r),animate:A(r),counter:I(r),text:M(r)}}export{H as initAll,A as initScrollAnimate,I as initScrollCounter,E as initScrollDraw,M as initScrollText};
|
|
@@ -1221,17 +1221,17 @@ var SvgScrollDraw = (() => {
|
|
|
1221
1221
|
|
|
1222
1222
|
// src/core/scroll-draw.ts
|
|
1223
1223
|
function scrollDraw(target, options) {
|
|
1224
|
-
const
|
|
1224
|
+
const noop = { destroy: () => {
|
|
1225
1225
|
}, replay: () => {
|
|
1226
1226
|
}, pause: () => {
|
|
1227
1227
|
}, resume: () => {
|
|
1228
1228
|
}, seek: () => {
|
|
1229
1229
|
}, getProgress: () => 0 };
|
|
1230
|
-
if (typeof window === "undefined") return
|
|
1230
|
+
if (typeof window === "undefined") return noop;
|
|
1231
1231
|
const container = typeof target === "string" ? document.querySelector(target) : target;
|
|
1232
1232
|
if (!container) {
|
|
1233
1233
|
warn("Container not found:", target);
|
|
1234
|
-
return
|
|
1234
|
+
return noop;
|
|
1235
1235
|
}
|
|
1236
1236
|
return createEngine(container, options);
|
|
1237
1237
|
}
|
|
@@ -1789,8 +1789,8 @@ var SvgScrollDraw = (() => {
|
|
|
1789
1789
|
function easeOf(name) {
|
|
1790
1790
|
return EASINGS[name] ?? EASINGS.linear;
|
|
1791
1791
|
}
|
|
1792
|
-
var
|
|
1793
|
-
}, getProgress: () =>
|
|
1792
|
+
var still = (progress) => ({ destroy() {
|
|
1793
|
+
}, getProgress: () => progress });
|
|
1794
1794
|
var Cinematic = class {
|
|
1795
1795
|
constructor(options) {
|
|
1796
1796
|
if (typeof document === "undefined") {
|
|
@@ -1802,7 +1802,7 @@ var SvgScrollDraw = (() => {
|
|
|
1802
1802
|
}
|
|
1803
1803
|
loadStory(story) {
|
|
1804
1804
|
const mount = this.mount;
|
|
1805
|
-
if (typeof window === "undefined" || !mount) return
|
|
1805
|
+
if (typeof window === "undefined" || !mount) return still(0);
|
|
1806
1806
|
mount.style.position = "relative";
|
|
1807
1807
|
mount.style.height = story.totalHeight;
|
|
1808
1808
|
mount.style.display = "block";
|
|
@@ -1860,17 +1860,30 @@ var SvgScrollDraw = (() => {
|
|
|
1860
1860
|
el,
|
|
1861
1861
|
start: parsePercent(a.start),
|
|
1862
1862
|
end: parsePercent(a.end),
|
|
1863
|
-
ease:
|
|
1863
|
+
ease: easeOf("ease-in-out"),
|
|
1864
1864
|
from: a.from,
|
|
1865
1865
|
to: a.to
|
|
1866
1866
|
});
|
|
1867
1867
|
}
|
|
1868
1868
|
}
|
|
1869
1869
|
let progress = 0;
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
if (
|
|
1873
|
-
|
|
1870
|
+
let sc = null;
|
|
1871
|
+
for (let n = mount.parentElement; n?.parentElement; n = n.parentElement) {
|
|
1872
|
+
if (/[ao]/.test(getComputedStyle(n).overflowY) && n.scrollHeight > n.clientHeight && (n !== document.body || /[aoh]/.test(getComputedStyle(n.parentElement).overflowY))) {
|
|
1873
|
+
sc = n;
|
|
1874
|
+
break;
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
let tStart = 0;
|
|
1878
|
+
let tEnd = 0;
|
|
1879
|
+
const measure = () => {
|
|
1880
|
+
const top = mount.getBoundingClientRect().top;
|
|
1881
|
+
tStart = sc ? top - sc.getBoundingClientRect().top - sc.clientTop + sc.scrollTop : top + window.scrollY;
|
|
1882
|
+
tEnd = tStart + Math.max(0, mount.offsetHeight - (sc ? sc.clientHeight : window.innerHeight));
|
|
1883
|
+
};
|
|
1884
|
+
const at = () => {
|
|
1885
|
+
const y = sc ? sc.scrollTop : window.scrollY;
|
|
1886
|
+
return tEnd <= tStart ? y >= tStart ? 1 : 0 : computeProgress(y, tStart, tEnd, 1);
|
|
1874
1887
|
};
|
|
1875
1888
|
const apply = (global) => {
|
|
1876
1889
|
for (const r of records) {
|
|
@@ -1886,52 +1899,24 @@ var SvgScrollDraw = (() => {
|
|
|
1886
1899
|
};
|
|
1887
1900
|
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
1888
1901
|
apply(1);
|
|
1889
|
-
return
|
|
1890
|
-
}, getProgress: () => 1 };
|
|
1902
|
+
return still(1);
|
|
1891
1903
|
}
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
let visible = false;
|
|
1895
|
-
const tick = () => {
|
|
1896
|
-
progress = computeProgress2();
|
|
1904
|
+
const frame = () => {
|
|
1905
|
+
progress = at();
|
|
1897
1906
|
apply(progress);
|
|
1898
|
-
if (running) rafId = requestAnimationFrame(tick);
|
|
1899
|
-
};
|
|
1900
|
-
const start = () => {
|
|
1901
|
-
if (running) return;
|
|
1902
|
-
running = true;
|
|
1903
|
-
rafId = requestAnimationFrame(tick);
|
|
1904
1907
|
};
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
};
|
|
1909
|
-
const observer2 = new IntersectionObserver(
|
|
1910
|
-
(entries) => {
|
|
1911
|
-
for (const e of entries) {
|
|
1912
|
-
visible = e.isIntersecting;
|
|
1913
|
-
if (visible) start();
|
|
1914
|
-
else stop();
|
|
1915
|
-
}
|
|
1916
|
-
},
|
|
1917
|
-
{ threshold: 0 }
|
|
1918
|
-
);
|
|
1919
|
-
observer2.observe(stage);
|
|
1920
|
-
progress = computeProgress2();
|
|
1921
|
-
apply(progress);
|
|
1908
|
+
measure();
|
|
1909
|
+
frame();
|
|
1910
|
+
const gate = frameGate(sc || window, [mount], at, frame, measure);
|
|
1922
1911
|
_register(mount, {
|
|
1923
1912
|
type: "draw",
|
|
1924
1913
|
getProgress: () => progress,
|
|
1925
|
-
getTrigger: () => {
|
|
1926
|
-
const tStart = mount.getBoundingClientRect().top + window.scrollY;
|
|
1927
|
-
return { tStart, tEnd: tStart + Math.max(0, mount.offsetHeight - window.innerHeight) };
|
|
1928
|
-
}
|
|
1914
|
+
getTrigger: () => ({ tStart, tEnd })
|
|
1929
1915
|
});
|
|
1930
1916
|
const unwatchMotion = watchReducedMotion((reduced) => {
|
|
1931
1917
|
if (!reduced) return;
|
|
1932
1918
|
unwatchMotion();
|
|
1933
|
-
|
|
1934
|
-
observer2.disconnect();
|
|
1919
|
+
gate.off();
|
|
1935
1920
|
_unregister(mount);
|
|
1936
1921
|
progress = 1;
|
|
1937
1922
|
apply(1);
|
|
@@ -1939,8 +1924,7 @@ var SvgScrollDraw = (() => {
|
|
|
1939
1924
|
return {
|
|
1940
1925
|
destroy() {
|
|
1941
1926
|
unwatchMotion();
|
|
1942
|
-
|
|
1943
|
-
observer2.disconnect();
|
|
1927
|
+
gate.off();
|
|
1944
1928
|
_unregister(mount);
|
|
1945
1929
|
},
|
|
1946
1930
|
getProgress: () => progress
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var SvgScrollDraw=(()=>{var ht=Object.defineProperty;var
|
|
2
|
-
<div style="position:absolute;${
|
|
3
|
-
<div style="position:absolute;${u?`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",s,{passive:!0}),s(),{el:n,destroy(){window.removeEventListener("scroll",s),n.remove()}}}var Ut=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Xt=/[MmLlHhVvCcSsQqTtAaZz]/g;function kr(e,t,r){if(!!1)return;let n=(e.match(Xt)??[]).join("").toUpperCase(),s=(t.match(Xt)??[]).join("").toUpperCase(),i=(e.match(Ut)??[]).length,c=(t.match(Ut)??[]).length;if(n!==s){W(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${s||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}i!==c&&W(`morphTo: coordinate count differs (${i} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r)}function Cr(e,t,r){let n=(t.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let c=parseFloat(i),m=n[s++]??c;return String(+(c+(m-c)*r).toFixed(4))})}function it(e,t={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:Fe(t,(r,n)=>$r(e,r,n))}function $r(e,t,r){let{preset:n,...s}=t,i=n?{...et[n],...s}:s,{selector:c="path, polyline, line, polygon, rect, circle",speed:m=1,fade:u=!1,easing:f="linear",trigger:h={},stagger:S=0,direction:b="forward",once:O=!1,debug:ee=!1,axis:A="y",scrollContainer:y,autoReverse:x=!1,delay:g=0,strokeColor:w,strokeWidth:v,fillOpacity:I,waypoints:z,velocityScale:N=!1,threshold:te=0,rootMargin:Ve="0px",repeat:le=0,repeatDelay:de=0,morphTo:B,clip:re,autoplay:Ae=!1,duration:L=1e3,native:H=!0,onProgress:Ce,onStart:Z,onComplete:ne,onEnter:ge,onLeave:Ie,onEnterBack:ye,onLeaveBack:me}=i,J=re===!0?"left":typeof re=="string"?re:!1,q=typeof f=="function"?f:U[f]??U.linear,Re=Te(h.start||"top bottom"),Ge=Te(h.end||"bottom top"),F=typeof y=="string"?document.querySelector(y):y??null,he=Array.isArray(w)?w[0]:null,be=Array.isArray(w)?w[1]:typeof w=="string"?w:null,ce=Array.isArray(v)?v[0]:null,Pe=Array.isArray(v)?v[1]:typeof v=="number"?v:null,we=Array.isArray(I)?I[0]:null,ue=Array.isArray(I)?I[1]:typeof I=="number"?I:null;function ve(o){let l=o*100;switch(J){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 a=J?[]:Array.from(e.querySelectorAll(c)),p=[],_=[],M=0,k=0,R=S,C=0,Le=0,V=!1,Se=!1,Ee=0,ut=-1,Qe=[],Ye=-1,ie=!1,fe=0,$e=0,De,mt=!1,ft=null;function Tt(){ft?.destroy(),ft=null}let Oe=new Set,Mt=NaN,Ne=!0,Ue=-1,At=performance.now(),He=NaN;function Xe(){return F?A==="x"?F.scrollLeft:F.scrollTop:A==="x"?window.scrollX:window.scrollY}function Pt(){return F?A==="x"?F.clientWidth:F.clientHeight:A==="x"?window.innerWidth:window.innerHeight}function Lt(){let o=Ze(e,F,A);return ke(o,o.scroll,Pt(),Re,Ge)}function ar(){let o=k-M,l=a.length-1,d=F??document.documentElement,T=A==="x"?"Width":"Height";if(R=S,S>0&&l>0&&o>0){let j=d[`scroll${T}`]-d[`client${T}`]-1-M-o/m;j>=0&&(R=Math.min(S,j/(l*o)))}let G=Math.max(0,l)*R*o,oe=o/Math.min(m,1);C=M+Math.min(0,G,oe,G+oe),Le=M+Math.max(0,G,oe,G+oe)}function kt(){({tStart:M,tEnd:k}=Lt()),ar(),ee&&!1&&(Tt(),ft=Lr(M,k,A))}function pt(o,l=Lt){Me(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:l});let d=o.destroy;return o.destroy=()=>{d.call(o),pe(e)},o}function Ct(o,l){return O&&!x?Math.max(ut,q(Qe[o]=Math.max(Qe[o]??0,l))):q(l)}function lr(o,l){if(e.style.setProperty("--scroll-draw-progress",String(o)),J){let d=l==="reverse"?1-o:o;e.style.clipPath=ve(d);return}a.forEach((d,T)=>dt(d,T,o,l))}function dt(o,l,d,T){o.style.strokeDashoffset=T==="reverse"?`${p[l]*d}`:`${p[l]*(1-d)}`,u&&(o.style.opacity=T==="reverse"?`${1-d}`:`${d}`),he&&be?o.style.stroke=Ke(he,be,d):be&&(o.style.stroke=be),ce!==null&&Pe!==null?o.style.strokeWidth=`${ce+(Pe-ce)*d}`:Pe!==null&&(o.style.strokeWidth=`${Pe}`),we!==null&&ue!==null?o.style.fillOpacity=`${we+(ue-we)*d}`:ue!==null&&(o.style.fillOpacity=`${ue}`),B&&o.tagName.toLowerCase()==="path"&&_[l]&&o.setAttribute("d",Cr(_[l],B,d))}function gt(){if(e.style.setProperty("--scroll-draw-progress","0"),J){e.style.clipPath=ve(b==="reverse"?1:0);return}a.forEach((o,l)=>{o.style.strokeDasharray=`${p[l]}`,o.style.strokeDashoffset=b==="reverse"?"0":`${p[l]}`,u?o.style.opacity=b==="reverse"?"1":"0":o.style.opacity="",he&&(o.style.stroke=he),ce!==null&&(o.style.strokeWidth=`${ce}`),we!==null&&(o.style.fillOpacity=`${we}`),B&&o.tagName.toLowerCase()==="path"&&_[l]&&o.setAttribute("d",_[l])})}function We(o,l){let d=o.getAttribute("d"),T=Je(o);if(B&&_[l]){o.setAttribute("d",B);let G=Je(o);o.setAttribute("d",_[l]),T=Math.max(Je(o),G),o.setAttribute("d",d)}p[l]=T,o.style.strokeDasharray=`${T}`}if(a.forEach((o,l)=>{Pr(o);let d=o.tagName.toLowerCase()==="path";d?_.push(o.getAttribute("d")??""):_.push(""),We(o,l);let T=p[l];B&&(d?kr(_[_.length-1],B,o):W(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),r?(o.style.strokeDashoffset=b==="reverse"?`${T}`:"0",u&&(o.style.opacity="1"),be&&(o.style.stroke=be),Pe!==null&&(o.style.strokeWidth=`${Pe}`),ue!==null&&(o.style.fillOpacity=`${ue}`),B&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",B)):(o.style.strokeDashoffset=b==="reverse"?"0":`${T}`,u?o.style.opacity=b==="reverse"?"1":"0":o.style.opacity="",he&&(o.style.stroke=he),ce!==null&&(o.style.strokeWidth=`${ce}`),we!==null&&(o.style.fillOpacity=`${we}`))}),r)return J&&(e.style.clipPath=ve(1)),ne?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};J&&(e.style.clipPath=ve(b==="reverse"?1:0));let $t=typeof f=="string"?tt(f):null;function cr(){return!(H===!1||Ae||ee&&!1||!Ar()||!a.length||!$t||J||A!=="y"||F||m!==1||S!==0||O||x||N!==!1||B||z||le||g>0||Ce||Z||ne||ge||Ie||ye||me||w!=null||v!=null||I!=null||(h.start||"top bottom").trim()!=="top bottom"||(h.end||"bottom top").trim()!=="bottom top")}function ur(){let o=++Mr,l=`svg-scroll-draw-${o}`,d=`svg-scroll-draw-host-${o}`,T=`--svg-scroll-draw-${o}`,G=b==="reverse"?"0":"var(--ssd-len)",oe=b==="reverse"?"var(--ssd-len)":"0",j=`stroke-dashoffset:${G};`,$=`stroke-dashoffset:${oe};`;u&&(j+=`opacity:${b==="reverse"?1:0};`,$+=`opacity:${b==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${l}{from{${j}}to{${$}}}.${d}{view-timeline-name:${T};view-timeline-axis:block;}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${$t};animation-fill-mode:both;animation-timeline:${T};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(d);function K(E,P){E.style.setProperty("--ssd-len",String(p[P])),E.style.strokeDasharray=`${p[P]}`,E.style.strokeDashoffset="",E.style.opacity="",E.style.animationPlayState="",E.classList.add(l)}a.forEach(K);let Q=!1,se=-1;function ae(){if(se>=0)return se;let E=e.getBoundingClientRect(),{tStart:P,tEnd:Y}=ke({top:E.top,height:E.height},Xe(),Pt(),Re,Ge);return q(X(Xe(),P,Y,m))}return{destroy(){e.classList.remove(d),a.forEach(E=>{E.classList.remove(l),E.style.removeProperty("--ssd-len"),E.style.animationPlayState=""}),D.remove()},replay(){Q=!1,se=-1,a.forEach(K)},pause(){Q=!0,a.forEach(E=>{E.style.animationPlayState="paused"})},resume(){Q&&(Q=!1,a.forEach(E=>{E.style.animationPlayState="running"}))},seek(E){let P=Math.min(1,Math.max(0,E));se=P,Q=!0,a.forEach((Y,xe)=>{Y.classList.remove(l),Y.style.strokeDashoffset=b==="reverse"?`${p[xe]*P}`:`${p[xe]*(1-P)}`,u&&(Y.style.opacity=b==="reverse"?`${1-P}`:`${P}`)})},getProgress(){return ae()},refresh(){a.forEach((E,P)=>{We(E,P),E.style.setProperty("--ssd-len",String(p[P]))})}}}if(cr())return pt(ur());function mr(){let o=Math.max(1,L),l=J?o:o*(1+Math.max(0,a.length-1)*S),d=0,T=0,G=!1;function oe(se){let ae=!0,E=Math.min(1,Math.max(0,se/l));if(J){let P=Math.min(1,Math.max(0,se/o)),Y=q(P);fe=Y,e.style.setProperty("--scroll-draw-progress",String(Y)),e.style.clipPath=ve(b==="reverse"?1-Y:Y),Ce?.(Y),P<1&&(ae=!1)}else{a.forEach((Y,xe)=>{let pr=xe*S*o,Nt=Math.min(1,Math.max(0,(se-pr)/o));dt(Y,xe,q(Nt),b),Nt<1&&(ae=!1)});let P=q(E);fe=P,Ce?.(P),e.style.setProperty("--scroll-draw-progress",String(P))}if(z){let P=q(E);for(let Y in z){let xe=parseFloat(Y);P>=xe&&!Oe.has(xe)&&(Oe.add(xe),z[Y]?.())}}return ae}function j(se){if(ie)return;let ae=se-d;Se||(Se=!0,Z?.());let E=oe(ae);if(E&&!V){V=!0,oe(l),ne?.(),$e<(le==="infinite"?1/0:le??0)&&($e++,De=setTimeout(()=>{d=performance.now(),Se=!1,V=!1,Oe.clear(),gt(),Ee=requestAnimationFrame(j)},de));return}E||(Ee=requestAnimationFrame(j))}function $(){cancelAnimationFrame(Ee),clearTimeout(De),d=performance.now(),T=0,ie=!1,Se=!1,V=!1,$e=0,G=!0,fe=0,Oe.clear(),gt(),Ee=requestAnimationFrame(j)}let D=new IntersectionObserver(se=>{se.forEach(ae=>{ae.isIntersecting&&!(O&&V)?$():!ae.isIntersecting&&!O&&!V&&(cancelAnimationFrame(Ee),clearTimeout(De),G=!1)})},{root:F??null,threshold:te,rootMargin:Ve}),K;function Q(){clearTimeout(K),K=setTimeout(()=>a.forEach(We),150)}return window.addEventListener("resize",Q),window.addEventListener("orientationchange",Q),g>0?setTimeout(()=>D.observe(e),g):D.observe(e),{destroy(){cancelAnimationFrame(Ee),clearTimeout(De),D.disconnect(),window.removeEventListener("resize",Q),window.removeEventListener("orientationchange",Q),clearTimeout(K)},replay(){$e=0,$()},pause(){ie||!G||(ie=!0,T=performance.now()-d,cancelAnimationFrame(Ee))},resume(){ie&&(ie=!1,G=!0,d=performance.now()-T,Ee=requestAnimationFrame(j))},seek(se){let ae=Math.min(1,Math.max(0,se));fe=ae,ie=!0,T=ae*l,d=performance.now()-T,cancelAnimationFrame(Ee),oe(T)},getProgress(){return fe},refresh(){clearTimeout(K),a.forEach(We)}}}if(Ae)return pt(mr());kt();let Dt=()=>X(Xe(),C,Le,1);function Ot(){V=!0,ne?.(),$e<(le==="infinite"?1/0:le)&&($e++,De=setTimeout(()=>{mt=!0},de))}function It(){ut=-1,Qe=[],Se=!1,V=!1,mt=!1,Oe.clear(),gt(),Ne=!0}function fr(){let o=performance.now(),l=Xe();if(mt&&Dt()%1&&It(),!Ne&&N===!1&&l===Mt)return;Ne=!1,Mt=l;let d=m;if(N!==!1){let $=o-At,D=$>0?Math.abs(l-(Ue<0?l:Ue))/$:0;d=m*Math.max(.2,1+D*(typeof N=="number"?N:1)*.04)}Ue=l,At=o;let T=x?Ye===-1||l>=Ye?"forward":"reverse":b;Ye=l;let G=k-M,oe=!0,j=G===0?0:(l-M)/G;if(isNaN(He)||(He<=0&&j>0&&ge?.(),He<1&&j>=1&&Ie?.(),He>=1&&j<1&&ye?.(),He>0&&j<=0&&me?.()),He=j,J){let $=Ct(0,X(l,M,k,d));fe=$,e.style.setProperty("--scroll-draw-progress",String($));let D=T==="reverse"?1-$:$;e.style.clipPath=ve(D),Ce?.($),!Se&&X(l,M,k,d)>0&&(Se=!0,Z?.()),$>=1&&!V?Ot():$<1&&!O&&(V=!1);return}if(a.forEach(($,D)=>{let K=D*R*G,Q=Ct(D,X(l,M+K,k+K,d));dt($,D,Q,T),D===0&&(fe=Q,Ce?.(Q),e.style.setProperty("--scroll-draw-progress",String(Q))),Q<1&&(oe=!1)}),z){let $=q(X(l,M,k,d));for(let D in z){let K=parseFloat(D);$>=K&&!Oe.has(K)&&(Oe.add(K),z[D]?.())}}!Se&&X(l,M,k,d)>0&&(Se=!0,Z?.()),oe&&!V?Ot():!oe&&!O&&(V=!1)}let ze=_e(F??window,[e],Dt,fr,()=>{let o=p.join();a.forEach(We),kt(),Ne=!0,p.join()!==o&&Be()}),yt=g>0;function Be(){ze.hold(ie||yt)}let Rt;return yt&&(Rt=setTimeout(()=>{yt=!1,Be()},g)),Be(),pt({destroy(){clearTimeout(De),clearTimeout(Rt),ze.off(),Tt()},replay(){It(),Ye=-1,Ue=-1,$e=0,ie=!1,fe=0,clearTimeout(De),Be()},pause(){ie=!0,ze.hold(!0)},resume(){ie&&(ie=!1,Ne=!0,Be())},seek(o){let l=Math.min(1,Math.max(0,o));fe=l,ut=l,Qe=[],ie=!0,ze.hold(!0),lr(l,b),Ne=!0},getProgress(){return fe},refresh:ze.remeasure},()=>({tStart:M,tEnd:k}))}function Zt(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?it(n,t):(W("Container not found:",e),r)}function Dr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Jt(e){let t=[],r=/([\w]+)\(([^)]*)\)/g,n;for(;(n=r.exec(e))!==null;){let s=[],i=[],c=n[2].trim();if(c)for(let m of c.split(/[\s,]+/)){let u=m.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(u?parseFloat(u[1]):0),i.push(u?u[2]:"")}t.push({fn:n[1],nums:s,units:i})}return t}function Or(e,t,r){let n=Jt(e),s=Jt(t);return n.length===0||n.length!==s.length?r<1?e:t:n.map((i,c)=>{let m=s[c];return i.fn!==m.fn||i.nums.length!==m.nums.length?r<1?`${i.fn}(${i.nums.map((u,f)=>`${u}${i.units[f]}`).join(", ")})`:`${m.fn}(${m.nums.map((u,f)=>`${u}${m.units[f]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,f)=>`${u+(m.nums[f]-u)*r}${i.units[f]}`).join(", ")})`}).join(" ")}function Kt(e,t,r){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*r);let n=String(e),s=String(t);if(Dr(n))return Ke(n,s,r);if(n.includes("("))return Or(n,s,r);let i=n.match(/^([-+]?[\d.]+)(.*)$/),c=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&c){let m=parseFloat(i[1]),u=parseFloat(c[1]);return`${m+(u-m)*r}${i[2]||c[2]}`}return r<1?n:s}function Ir(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var Rr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Nr=0,er="--scroll-draw-progress";function Hr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var rr={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function St(e,t){return typeof window>"u"?rr:t.respectReducedMotion===!1?tr(e,t,!1):Fe(t,(r,n)=>tr(e,r,n))}function tr(e,t,r){let{props:n,trigger:s={},easing:i="ease-out",speed:c=1,once:m=!1,axis:u="y",scrollContainer:f,native:h=!0,velocityScale:S=!1,triggerElement:b,onProgress:O,onComplete:ee,onEnter:A,onLeave:y,onEnterBack:x,onLeaveBack:g}=t,w=typeof i=="function"?i:U[i]??U["ease-out"],v=Te(s.start||"top bottom"),I=Te(s.end||"bottom top"),z=b??e,N=typeof f=="string"?document.querySelector(f):f??null,te=Object.entries(n).map(([a,p])=>({prop:Ir(a),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function Ve(){let a=window.getComputedStyle(e);for(let p of te)p.from===""&&(p.from=a.getPropertyValue(p.prop).trim()||"0")}function le(){for(let a of te)e.style.setProperty(a.prop,String(a.to))}let de=new Map;for(let a of[...te.map(p=>p.prop),er])de.set(a,e.style.getPropertyValue(a));function B(){for(let[a,p]of de)p?e.style.setProperty(a,p):e.style.removeProperty(a)}if(r)return le(),ee?.(),{...rr,destroy:B,getProgress:()=>1};Ve();let re=()=>N?u==="x"?N.scrollLeft:N.scrollTop:u==="x"?window.scrollX:window.scrollY,Ae=()=>N?u==="x"?N.clientWidth:N.clientHeight:u==="x"?window.innerWidth:window.innerHeight,L=typeof i=="string"?tt(i):null;function H(){if(!h||!Hr()||!L||u!=="y"||N||z!==e||m||c!==1||O||ee||A||y||x||g||S!==!1||(s.start||"top bottom").trim()!=="top bottom"||(s.end||"bottom top").trim()!=="bottom top")return!1;for(let a of te)if(!Rr.has(a.prop))return!1;return!0}function Ce(){let a=`ssd-a-${++Nr}`,p=te.map(C=>`${C.prop}:${C.from}`).join(";"),_=te.map(C=>`${C.prop}:${C.to}`).join(";"),M=document.createElement("style");M.setAttribute("data-ssd-animate",""),M.textContent=`@keyframes ${a}{from{${p}}to{${_}}}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${L};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(M),e.classList.add(a);let k=()=>{let C=e.getBoundingClientRect();return ke({top:C.top,height:C.height},re(),Ae(),v,I)};Me(e,{type:"animate",getProgress:()=>R.getProgress(),getTrigger:k});let R={refresh(){},destroy(){e.classList.remove(a),M.remove(),e.style.animationPlayState="",B(),pe(e)},replay(){e.classList.remove(a),e.offsetWidth,e.classList.add(a)},pause(){e.style.animationPlayState="paused"},resume(){e.style.animationPlayState=""},seek(C){let Le=Math.min(1,Math.max(0,C));e.classList.remove(a);for(let V of te)e.style.setProperty(V.prop,Kt(V.from,V.to,Le))},getProgress(){let{tStart:C,tEnd:Le}=k();return w(X(re(),C,Le,c))}};return R}if(H())return Ce();let Z=0,ne=0,ge=!1,Ie=-1,ye=0,me=0,J=!1,q=NaN,Re=-1,Ge=0,F=z===e?te:[],he=!1;function be(){let a=e.style,p=F.map(R=>a.getPropertyValue(R.prop)),_=a.transition;F.length&&(a.transition="none"),F.forEach(R=>a.setProperty(R.prop,de.get(R.prop)??""));let M=Ze(z,N,u);F.forEach((R,C)=>a.setProperty(R.prop,p[C])),F.length&&(e.offsetWidth,a.transition=_);let k=ke(M,M.scroll,Ae(),v,I);he&&Math.abs(k.tStart-Z)<1&&Math.abs(k.tEnd-ne)<1||(he=!0,Z=k.tStart,ne=k.tEnd)}function ce(a){e.style.setProperty(er,String(a));for(let p of te)e.style.setProperty(p.prop,Kt(p.from,p.to,a));O?.(a)}function Pe(a){if(isNaN(q)){q=a;return}q<=0&&a>0&&A?.(),q<1&&a>=1&&y?.(),q>=1&&a<1&&x?.(),q>0&&a<=0&&g?.(),q=a}function we(){if(ge)return;let a=performance.now(),p=re(),_=c;if(S!==!1){let C=a-Ge,Le=C>0?Math.abs(p-(Re<0?p:Re))/C:0;_=c*Math.max(.2,1+Le*(typeof S=="number"?S:1)*.04)}Re=p,Ge=a;let M=ne===Z?0:(p-Z)/(ne-Z);Pe(M);let k=X(p,Z,ne,_),R=m?Math.max(Ie,w(ye=Math.max(ye,k))):w(k);me=R,ce(R),R>=1&&!J?(J=!0,ee?.()):R<1&&!m&&(J=!1)}let ue=_e(N??window,[z],()=>X(re(),Z,ne,Math.min(c,1)),we,be);be(),ne===Z&&W("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),ye=X(re(),Z,ne,c),me=w(ye),ce(me),Me(e,{type:"animate",getProgress:()=>me,getTrigger:()=>({tStart:Z,tEnd:ne})});function ve(){ge=!0,ue.hold(!0)}return{destroy(){ge=!0,ue.off(),B(),pe(e)},replay(){Ie=-1,ye=0,J=!1,me=0,ge=!1,ce(0),ue.hold(!1)},pause:ve,resume(){ge&&(ge=!1,ue.hold(!1))},seek(a){let p=Math.min(1,Math.max(0,a));me=p,Ie=p,ye=0,ve(),ce(p)},getProgress(){return me},refresh:ue.remeasure}}var at={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function nr(e,t){if(typeof window>"u")return at;let r=typeof e=="string"?document.querySelector(e):e;return r?St(r,t):(W("scrollAnimate: element not found:",e),at)}function or(e,t={}){if(typeof window>"u")return at;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return W("scrollParallax: element not found:",e),at;let{speed:n=.3,axis:s="y",easing:i="linear",trigger:c,onProgress:m}=t,u=-n*100,f=r.style,h=!!r.ownerSVGElement,S=f.getPropertyValue("transform-box");h&&f.setProperty("transform-box","fill-box");let b=St(r,{props:s==="x"?{transform:["translateX(0%)",`translateX(${u}%)`]}:{transform:["translateY(0%)",`translateY(${u}%)`]},trigger:c??{start:"top bottom",end:"bottom top"},easing:i,native:!1,onProgress:m});return h?{...b,destroy(){b.destroy(),f.setProperty("transform-box",S)}}:b}var Et={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function sr(e,t){if(typeof window>"u")return Et;let r=typeof e=="string"?document.querySelector(e):e;return r?Fe(t,(n,s)=>Fr(r,n,s)):(W("scrollCounter: element not found:",e),Et)}function Fr(e,t,r){let{from:n=0,to:s,format:i,easing:c="ease-out",trigger:m={},once:u=!0,decimals:f,onComplete:h}=t,S=f!==void 0?L=>L.toFixed(f):i??(L=>String(Math.round(L))),b=typeof c=="function"?c:U[c]??U["ease-out"],O=Te(m.start||"top 80%"),ee=Te(m.end||"top 20%");if(r)return e.textContent=S(s),h?.(),{...Et,getProgress:()=>1};let A=0,y=0,x=!1,g=-1,w=0,v=0,I=!1,z=()=>window.scrollY,N=()=>window.innerHeight;function te(){let L=e.getBoundingClientRect(),H=ke({top:L.top,height:L.height},z(),N(),O,ee);x&&Math.abs(H.tStart-A)<1&&Math.abs(H.tEnd-y)<1||(x=!0,A=H.tStart,y=H.tEnd)}let Ve=e.style.getPropertyValue("--scroll-draw-progress");function le(L){e.textContent=S(n+(s-n)*L),e.style.setProperty("--scroll-draw-progress",String(L))}let de=()=>X(z(),A,y,1);function B(){let L=de(),H=u?Math.max(g,b(w=Math.max(w,L))):b(L);v=H,le(H),H>=1&&!I?(I=!0,h?.()):H<1&&!u&&(I=!1)}te();{w=X(z(),A,y,1);let L=b(w);v=L,le(L)}let re=_e(window,[e],de,B,te);Me(e,{type:"counter",getProgress:()=>v,getTrigger:()=>({tStart:A,tEnd:y})});let Ae=()=>re.hold(!1);return{destroy(){re.off(),e.style.setProperty("--scroll-draw-progress",Ve),pe(e)},replay(){g=-1,w=0,I=!1,v=0,le(0),Ae()},pause:()=>re.hold(!0),resume:Ae,seek(L){let H=Math.min(1,Math.max(0,L));v=H,g=H,w=0,re.hold(!0),le(H)},getProgress(){return v}}}var ir="http://www.w3.org/2000/svg",_r="cinematic-photo",xt=e=>e<0?0:e>1?1:e;function lt(e){let t=parseFloat(e);return Number.isFinite(t)?xt(t/100):0}function Vr(e){return U[e]??U.linear}var Gr={destroy:()=>{},getProgress:()=>0},ct=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||W("Cinematic: wrapper not found:",t.wrapper)}loadStory(t){let r=this.mount;if(typeof window>"u"||!r)return Gr;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 s=[];for(let y of t.scenes){if(y.background){let g=document.createElement("img");g.id=_r,g.src=y.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 x=y.animations.filter(g=>g.type==="draw");if(x.length){let g=document.createElementNS(ir,"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 w of x){let v=document.createElementNS(ir,"path");v.id=w.target.replace(/^#/,""),v.setAttribute("d",w.d),v.setAttribute("fill","none"),v.setAttribute("stroke",w.stroke),v.setAttribute("stroke-width",String(w.strokeWidth)),v.setAttribute("stroke-linecap","round"),v.setAttribute("stroke-linejoin","round");let I=w.length||v.getTotalLength?.()||0;v.style.strokeDasharray=String(I),v.style.strokeDashoffset=String(I),g.appendChild(v),s.push({kind:"draw",el:v,start:lt(w.start),end:lt(w.end),ease:Vr(w.easing),length:I})}}for(let g of y.animations){if(g.type!=="fade")continue;let w=n.querySelector(g.target)??document.querySelector(g.target);w&&(w.style.opacity=String(g.from),s.push({kind:"fade",el:w,start:lt(g.start),end:lt(g.end),ease:U["ease-in-out"]??U.linear,from:g.from,to:g.to}))}}let i=0,c=()=>{let y=r.offsetHeight-window.innerHeight;return y<=0?r.getBoundingClientRect().top<=0?1:0:xt(-r.getBoundingClientRect().top/y)},m=y=>{for(let x of s){let g=x.end-x.start,w=g<=0?y>=x.end?1:0:xt((y-x.start)/g),v=x.ease(w);x.kind==="draw"?x.el.style.strokeDashoffset=String(x.length*(1-v)):x.el.style.opacity=String(x.from+(x.to-x.from)*v)}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return m(1),{destroy:()=>{},getProgress:()=>1};let u=0,f=!1,h=!1,S=()=>{i=c(),m(i),f&&(u=requestAnimationFrame(S))},b=()=>{f||(f=!0,u=requestAnimationFrame(S))},O=()=>{f=!1,cancelAnimationFrame(u)},ee=new IntersectionObserver(y=>{for(let x of y)h=x.isIntersecting,h?b():O()},{threshold:0});ee.observe(n),i=c(),m(i),Me(r,{type:"draw",getProgress:()=>i,getTrigger:()=>{let y=r.getBoundingClientRect().top+window.scrollY;return{tStart:y,tEnd:y+Math.max(0,r.offsetHeight-window.innerHeight)}}});let A=rt(y=>{y&&(A(),O(),ee.disconnect(),pe(r),i=1,m(1))});return{destroy(){A(),O(),ee.disconnect(),pe(r)},getProgress:()=>i}}};if(typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("scroll-draw")){let e=["speed","easing","stagger","direction","selector","fade","once"];class t extends HTMLElement{constructor(){super(...arguments);this.instance=null;this.key=""}connectedCallback(){this.build()}attributeChangedCallback(){this.instance&&this.build()}build(){let s=JSON.stringify(e.map(S=>this.getAttribute(S)));if(this.instance&&s===this.key)return;this.instance?.destroy(),this.key=s;let i={},c=this.getAttribute("speed"),m=this.getAttribute("easing"),u=this.getAttribute("stagger"),f=this.getAttribute("direction"),h=this.getAttribute("selector");c&&(i.speed=parseFloat(c)),m&&(i.easing=m),u&&(i.stagger=parseFloat(u)),f&&(i.direction=f),h&&(i.selector=h),this.hasAttribute("fade")&&(i.fade=this.getAttribute("fade")!=="false"),this.hasAttribute("once")&&(i.once=this.getAttribute("once")!=="false"),this.instance=it(this,i)}disconnectedCallback(){this.instance?.destroy(),this.instance=null}}t.observedAttributes=e,customElements.define("scroll-draw",t)}return wr(Wr);})();
|
|
1
|
+
"use strict";var SvgScrollDraw=(()=>{var ht=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var hr=Object.getOwnPropertyNames;var br=Object.prototype.hasOwnProperty;var wr=(e,t)=>{for(var r in t)ht(e,r,{get:t[r],enumerable:!0})},vr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of hr(t))!br.call(e,s)&&s!==r&&ht(e,s,{get:()=>t[s],enumerable:!(n=yr(t,s))||n.enumerable});return e};var Er=e=>vr(ht({},"__esModule",{value:!0}),e);var Wr={};wr(Wr,{Cinematic:()=>ct,PRESETS:()=>et,createBounce:()=>wt,createElastic:()=>vt,createSpring:()=>bt,scrollAnimate:()=>rr,scrollCounter:()=>or,scrollDraw:()=>Xt,scrollParallax:()=>nr});function bt({tension:e=2.5,friction:t=2.2}={}){return r=>1-Math.cos(r*Math.PI*e)*Math.pow(1-r,t)}function wt({bounces:e=3,decay:t=.5}={}){let r=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,t)),s=Math.sqrt(n),i=0,a=[];for(let d=0;d<r;d++){let h=Math.pow(s,d);a.push(h),i+=h}let u=[0],m=0;for(let d=0;d<r;d++)m+=a[d]/i,u.push(m);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let h=0;h<r;h++)if(d<=u[h+1]){let E=(d-u[h])/(u[h+1]-u[h]);if(h===0)return E*(2-E);let y=1-Math.pow(n,h);return y+(1-y)*(2*E-1)*(2*E-1)}return 1}}function vt({amplitude:e=1,period:t=.4}={}){let r=Math.max(1,e),n=Math.max(.1,t),s=r<=1?n/4:n/(2*Math.PI)*Math.asin(1/r);return i=>i<=0?0:i>=1?1:r*Math.pow(2,-10*i)*Math.sin((i-s)*(2*Math.PI)/n)+1}var oe={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:bt(),bounce:wt(),elastic:vt()};function Nt(e,t,r){return Math.min(r,Math.max(t,e))}function Te(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}}var _t=(e,t)=>e==="top"?0:e==="center"?.5:e==="bottom"?1:t;function Ht(e,t,r,n){return e+r+t*_t(n,0)}function Ft(e,t){return t*(/^\d+(\.\d+)?%$/.test(e)?parseFloat(e)/100:_t(e,1))}function R(e,t,r,n){return r===t?0:Nt((e-t)/(r-t)*n,0,1)}function ke(e,t,r,n,s){let i=Ht(e.top,e.height,t,n.element)-Ft(n.viewport,r),a=Ht(e.top,e.height,t,s.element)-Ft(s.viewport,r);return{tStart:i,tEnd:a}}function Ze(e,t,r){let n=e.getBoundingClientRect(),s=r==="x"?n.width:n.height;return t?{top:r==="x"?n.left-t.getBoundingClientRect().left-t.clientLeft+t.scrollLeft:n.top-t.getBoundingClientRect().top-t.clientTop+t.scrollTop,height:s,scroll:0}:{top:r==="x"?n.left:n.top,height:s,scroll:r==="x"?window.scrollX:window.scrollY}}function Je(e){let t=parseFloat(e.getAttribute("pathLength")??"");if(t>0)return t;let r=e.tagName.toLowerCase();if(r==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),s=parseFloat(e.getAttribute("height")??"0");return 2*(n+s)}if(r==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function Vt(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 Ke(e,t,r){let n=Vt(e),s=Vt(t);return!n||!s?e:`rgb(${Math.round(n[0]+(s[0]-n[0])*r)},${Math.round(n[1]+(s[1]-n[1])*r)},${Math.round(n[2]+(s[2]-n[2])*r)})`}var et={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 W(e,...t){}var Sr="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",xr="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Gt=33;function Tr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Mr(e){let t=[];for(let r=0;r<Gt;r++){let n=r/(Gt-1);t.push(String(Math.round(e(n)*1e5)/1e5))}return`linear(${t.join(",")})`}function tt(e){switch(e){case"linear":return"linear";case"ease-in":return Sr;case"ease-out":return xr;case"ease-in-out":return Tr()?Mr(oe["ease-in-out"]):null;default:return null}}var Wt=Symbol.for("svg-scroll-draw.registry");function zt(){let e=globalThis;return e[Wt]||(e[Wt]=new Map)}function Me(e,t){zt().set(e,t)}function pe(e){zt().delete(e)}function rt(e){if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};let t=window.matchMedia("(prefers-reduced-motion: reduce)"),r=s=>e(!!s.matches);if(typeof t.addEventListener=="function")return t.addEventListener("change",r),()=>t.removeEventListener("change",r);let n=t;return n.addListener?.(r),()=>n.removeListener?.(r)}function _e(e,t){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t(e,!0);let r=t(e,!1),n=rt(i=>{if(!i)return;n();let a=(r.getProgress?.()??0)>=1;r.destroy(),r=t(a?{...e,onComplete:void 0}:e,!0)}),s={};for(let i of Object.keys(r))s[i]=(...a)=>r[i]?.(...a);return s.destroy=()=>{n(),r.destroy()},s}var qe,nt=new Set,ot=new WeakMap,je=new Map,Bt=e=>{let t=e.getBoundingClientRect();return t.width+" "+t.height};function Ar(e){let t=new Set;for(let r of e)for(;r&&r!==document.body;r=r.parentElement)for(let n=r;n;n=n.previousElementSibling)t.add(n);return t}function qt(e,t){if(typeof ResizeObserver>"u"||typeof document>"u")return()=>{};let r=()=>t();qe??(qe=new ResizeObserver(s=>{let i=!1;for(let{target:a}of s)ot.get(a)!==Bt(a)&&(i=!0),ot.set(a,"");i&&nt.forEach(a=>a())})),nt.add(r);let n=Ar(e);return[document.body,document.documentElement].forEach(s=>s&&n.add(s)),n.forEach(s=>{ot.has(s)||ot.set(s,Bt(s)),je.set(s,(je.get(s)??0)+1),qe.observe(s)}),()=>{nt.delete(r)&&(n.forEach(s=>{let i=(je.get(s)??1)-1;if(i)return void je.set(s,i);je.delete(s),qe?.unobserve(s)}),nt.size||(qe?.disconnect(),qe=void 0))}}function Ce(e,t,r,n,s){let i,a=NaN,u,m,d=()=>{i=0,n(),!u&&!i&&(a=r())>0&&a<1&&(i=requestAnimationFrame(d))},h=()=>{!i&&!u&&r()!==a&&(i=requestAnimationFrame(d))},E=v=>{u=v,cancelAnimationFrame(i),i=a=NaN,h()},y=()=>{clearTimeout(m),s(),h()},I=()=>{clearTimeout(m),m=setTimeout(y,150)},se=qt(t,I),f=v=>{e[v]("scroll",h,{passive:!0}),window[v]("resize",I),window[v]("orientationchange",I)};return f("addEventListener"),h(),{hold:E,remeasure:y,off(){E(!0),f("removeEventListener"),se(),clearTimeout(m)}}}var Pr=0;function Lr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function jt(e,t){let r="";try{r=getComputedStyle(e).getPropertyValue(t).trim()}catch{}return r||(e.getAttribute(t)??"").trim()}var Yt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function kr(e){if(!!1)return;let t=jt(e,"stroke");if(!t||t==="none"){W("Element has no stroke \u2014 path will not be visible.",e);return}let r=(e.getAttribute("fill")??"").trim();r&&!Yt.has(r)&&!Yt.has(jt(e,"fill"))&&W("Element has a fill \u2014 it may obscure the stroke animation.",e)}function Cr(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 s(){let i=r==="x"?window.scrollX:window.scrollY,a=e-i,u=t-i,m=r==="x";n.innerHTML=`
|
|
2
|
+
<div style="position:absolute;${m?`left:${a}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${a}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(n),window.addEventListener("scroll",s,{passive:!0}),s(),{el:n,destroy(){window.removeEventListener("scroll",s),n.remove()}}}var Qt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Ut=/[MmLlHhVvCcSsQqTtAaZz]/g;function $r(e,t,r){if(!!1)return;let n=(e.match(Ut)??[]).join("").toUpperCase(),s=(t.match(Ut)??[]).join("").toUpperCase(),i=(e.match(Qt)??[]).length,a=(t.match(Qt)??[]).length;if(n!==s){W(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${s||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}i!==a&&W(`morphTo: coordinate count differs (${i} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r)}function Dr(e,t,r){let n=(t.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let a=parseFloat(i),u=n[s++]??a;return String(+(a+(u-a)*r).toFixed(4))})}function it(e,t={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:_e(t,(r,n)=>Or(e,r,n))}function Or(e,t,r){let{preset:n,...s}=t,i=n?{...et[n],...s}:s,{selector:a="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=!1,easing:d="linear",trigger:h={},stagger:E=0,direction:y="forward",once:I=!1,debug:se=!1,axis:f="y",scrollContainer:v,autoReverse:b=!1,delay:x=0,strokeColor:w,strokeWidth:L,fillOpacity:U,waypoints:z,velocityScale:N=!1,threshold:K=0,rootMargin:Ve="0px",repeat:le=0,repeatDelay:de=0,morphTo:B,clip:ee,autoplay:Ae=!1,duration:P=1e3,native:H=!0,onProgress:$e,onStart:X,onComplete:te,onEnter:ge,onLeave:Re,onEnterBack:ye,onLeaveBack:me}=i,Z=ee===!0?"left":typeof ee=="string"?ee:!1,q=typeof d=="function"?d:oe[d]??oe.linear,Ne=Te(h.start||"top bottom"),Ge=Te(h.end||"bottom top"),F=typeof v=="string"?document.querySelector(v):v??null,he=Array.isArray(w)?w[0]:null,be=Array.isArray(w)?w[1]:typeof w=="string"?w:null,ce=Array.isArray(L)?L[0]:null,Pe=Array.isArray(L)?L[1]:typeof L=="number"?L:null,we=Array.isArray(U)?U[0]:null,ue=Array.isArray(U)?U[1]:typeof U=="number"?U:null;function ve(o){let c=o*100;switch(Z){case"right":return`inset(0 0 0 ${100-c}%)`;case"top":return`inset(0 0 ${100-c}% 0)`;case"bottom":return`inset(${100-c}% 0 0 0)`;case"center":return`circle(${o*150}% at 50% 50%)`;default:return`inset(0 ${100-c}% 0 0)`}}let l=Z?[]:Array.from(e.querySelectorAll(a)),p=[],_=[],M=0,k=0,O=E,C=0,Le=0,V=!1,Ee=!1,Se=0,ut=-1,Ye=[],Qe=-1,ie=!1,fe=0,De=0,Oe,mt=!1,ft=null;function xt(){ft?.destroy(),ft=null}let Ie=new Set,Tt=NaN,He=!0,Ue=-1,Mt=performance.now(),Fe=NaN;function Xe(){return F?f==="x"?F.scrollLeft:F.scrollTop:f==="x"?window.scrollX:window.scrollY}function At(){return F?f==="x"?F.clientWidth:F.clientHeight:f==="x"?window.innerWidth:window.innerHeight}function Pt(){let o=Ze(e,F,f);return ke(o,o.scroll,At(),Ne,Ge)}function cr(){let o=k-M,c=l.length-1,g=F??document.documentElement,T=f==="x"?"Width":"Height";if(O=E,E>0&&c>0&&o>0){let j=g[`scroll${T}`]-g[`client${T}`]-1-M-o/u;j>=0&&(O=Math.min(E,j/(c*o)))}let G=Math.max(0,c)*O*o,re=o/Math.min(u,1);C=M+Math.min(0,G,re,G+re),Le=M+Math.max(0,G,re,G+re)}function Lt(){({tStart:M,tEnd:k}=Pt()),cr(),se&&!1&&(xt(),ft=Cr(M,k,f))}function pt(o,c=Pt){Me(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:c});let g=o.destroy;return o.destroy=()=>{g.call(o),pe(e)},o}function kt(o,c){return I&&!b?Math.max(ut,q(Ye[o]=Math.max(Ye[o]??0,c))):q(c)}function ur(o,c){if(e.style.setProperty("--scroll-draw-progress",String(o)),Z){let g=c==="reverse"?1-o:o;e.style.clipPath=ve(g);return}l.forEach((g,T)=>dt(g,T,o,c))}function dt(o,c,g,T){o.style.strokeDashoffset=T==="reverse"?`${p[c]*g}`:`${p[c]*(1-g)}`,m&&(o.style.opacity=T==="reverse"?`${1-g}`:`${g}`),he&&be?o.style.stroke=Ke(he,be,g):be&&(o.style.stroke=be),ce!==null&&Pe!==null?o.style.strokeWidth=`${ce+(Pe-ce)*g}`:Pe!==null&&(o.style.strokeWidth=`${Pe}`),we!==null&&ue!==null?o.style.fillOpacity=`${we+(ue-we)*g}`:ue!==null&&(o.style.fillOpacity=`${ue}`),B&&o.tagName.toLowerCase()==="path"&&_[c]&&o.setAttribute("d",Dr(_[c],B,g))}function gt(){if(e.style.setProperty("--scroll-draw-progress","0"),Z){e.style.clipPath=ve(y==="reverse"?1:0);return}l.forEach((o,c)=>{o.style.strokeDasharray=`${p[c]}`,o.style.strokeDashoffset=y==="reverse"?"0":`${p[c]}`,m?o.style.opacity=y==="reverse"?"1":"0":o.style.opacity="",he&&(o.style.stroke=he),ce!==null&&(o.style.strokeWidth=`${ce}`),we!==null&&(o.style.fillOpacity=`${we}`),B&&o.tagName.toLowerCase()==="path"&&_[c]&&o.setAttribute("d",_[c])})}function We(o,c){let g=o.getAttribute("d"),T=Je(o);if(B&&_[c]){o.setAttribute("d",B);let G=Je(o);o.setAttribute("d",_[c]),T=Math.max(Je(o),G),o.setAttribute("d",g)}p[c]=T,o.style.strokeDasharray=`${T}`}if(l.forEach((o,c)=>{kr(o);let g=o.tagName.toLowerCase()==="path";g?_.push(o.getAttribute("d")??""):_.push(""),We(o,c);let T=p[c];B&&(g?$r(_[_.length-1],B,o):W(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),r?(o.style.strokeDashoffset=y==="reverse"?`${T}`:"0",m&&(o.style.opacity="1"),be&&(o.style.stroke=be),Pe!==null&&(o.style.strokeWidth=`${Pe}`),ue!==null&&(o.style.fillOpacity=`${ue}`),B&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",B)):(o.style.strokeDashoffset=y==="reverse"?"0":`${T}`,m?o.style.opacity=y==="reverse"?"1":"0":o.style.opacity="",he&&(o.style.stroke=he),ce!==null&&(o.style.strokeWidth=`${ce}`),we!==null&&(o.style.fillOpacity=`${we}`))}),r)return Z&&(e.style.clipPath=ve(1)),te?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};Z&&(e.style.clipPath=ve(y==="reverse"?1:0));let Ct=typeof d=="string"?tt(d):null;function mr(){return!(H===!1||Ae||se&&!1||!Lr()||!l.length||!Ct||Z||f!=="y"||F||u!==1||E!==0||I||b||N!==!1||B||z||le||x>0||$e||X||te||ge||Re||ye||me||w!=null||L!=null||U!=null||(h.start||"top bottom").trim()!=="top bottom"||(h.end||"bottom top").trim()!=="bottom top")}function fr(){let o=++Pr,c=`svg-scroll-draw-${o}`,g=`svg-scroll-draw-host-${o}`,T=`--svg-scroll-draw-${o}`,G=y==="reverse"?"0":"var(--ssd-len)",re=y==="reverse"?"var(--ssd-len)":"0",j=`stroke-dashoffset:${G};`,$=`stroke-dashoffset:${re};`;m&&(j+=`opacity:${y==="reverse"?1:0};`,$+=`opacity:${y==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${c}{from{${j}}to{${$}}}.${g}{view-timeline-name:${T};view-timeline-axis:block;}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${Ct};animation-fill-mode:both;animation-timeline:${T};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(g);function J(S,A){S.style.setProperty("--ssd-len",String(p[A])),S.style.strokeDasharray=`${p[A]}`,S.style.strokeDashoffset="",S.style.opacity="",S.style.animationPlayState="",S.classList.add(c)}l.forEach(J);let Y=!1,ne=-1;function ae(){if(ne>=0)return ne;let S=e.getBoundingClientRect(),{tStart:A,tEnd:Q}=ke({top:S.top,height:S.height},Xe(),At(),Ne,Ge);return q(R(Xe(),A,Q,u))}return{destroy(){e.classList.remove(g),l.forEach(S=>{S.classList.remove(c),S.style.removeProperty("--ssd-len"),S.style.animationPlayState=""}),D.remove()},replay(){Y=!1,ne=-1,l.forEach(J)},pause(){Y=!0,l.forEach(S=>{S.style.animationPlayState="paused"})},resume(){Y&&(Y=!1,l.forEach(S=>{S.style.animationPlayState="running"}))},seek(S){let A=Math.min(1,Math.max(0,S));ne=A,Y=!0,l.forEach((Q,xe)=>{Q.classList.remove(c),Q.style.strokeDashoffset=y==="reverse"?`${p[xe]*A}`:`${p[xe]*(1-A)}`,m&&(Q.style.opacity=y==="reverse"?`${1-A}`:`${A}`)})},getProgress(){return ae()},refresh(){l.forEach((S,A)=>{We(S,A),S.style.setProperty("--ssd-len",String(p[A]))})}}}if(mr())return pt(fr());function pr(){let o=Math.max(1,P),c=Z?o:o*(1+Math.max(0,l.length-1)*E),g=0,T=0,G=!1;function re(ne){let ae=!0,S=Math.min(1,Math.max(0,ne/c));if(Z){let A=Math.min(1,Math.max(0,ne/o)),Q=q(A);fe=Q,e.style.setProperty("--scroll-draw-progress",String(Q)),e.style.clipPath=ve(y==="reverse"?1-Q:Q),$e?.(Q),A<1&&(ae=!1)}else{l.forEach((Q,xe)=>{let gr=xe*E*o,Rt=Math.min(1,Math.max(0,(ne-gr)/o));dt(Q,xe,q(Rt),y),Rt<1&&(ae=!1)});let A=q(S);fe=A,$e?.(A),e.style.setProperty("--scroll-draw-progress",String(A))}if(z){let A=q(S);for(let Q in z){let xe=parseFloat(Q);A>=xe&&!Ie.has(xe)&&(Ie.add(xe),z[Q]?.())}}return ae}function j(ne){if(ie)return;let ae=ne-g;Ee||(Ee=!0,X?.());let S=re(ae);if(S&&!V){V=!0,re(c),te?.(),De<(le==="infinite"?1/0:le??0)&&(De++,Oe=setTimeout(()=>{g=performance.now(),Ee=!1,V=!1,Ie.clear(),gt(),Se=requestAnimationFrame(j)},de));return}S||(Se=requestAnimationFrame(j))}function $(){cancelAnimationFrame(Se),clearTimeout(Oe),g=performance.now(),T=0,ie=!1,Ee=!1,V=!1,De=0,G=!0,fe=0,Ie.clear(),gt(),Se=requestAnimationFrame(j)}let D=new IntersectionObserver(ne=>{ne.forEach(ae=>{ae.isIntersecting&&!(I&&V)?$():!ae.isIntersecting&&!I&&!V&&(cancelAnimationFrame(Se),clearTimeout(Oe),G=!1)})},{root:F??null,threshold:K,rootMargin:Ve}),J;function Y(){clearTimeout(J),J=setTimeout(()=>l.forEach(We),150)}return window.addEventListener("resize",Y),window.addEventListener("orientationchange",Y),x>0?setTimeout(()=>D.observe(e),x):D.observe(e),{destroy(){cancelAnimationFrame(Se),clearTimeout(Oe),D.disconnect(),window.removeEventListener("resize",Y),window.removeEventListener("orientationchange",Y),clearTimeout(J)},replay(){De=0,$()},pause(){ie||!G||(ie=!0,T=performance.now()-g,cancelAnimationFrame(Se))},resume(){ie&&(ie=!1,G=!0,g=performance.now()-T,Se=requestAnimationFrame(j))},seek(ne){let ae=Math.min(1,Math.max(0,ne));fe=ae,ie=!0,T=ae*c,g=performance.now()-T,cancelAnimationFrame(Se),re(T)},getProgress(){return fe},refresh(){clearTimeout(J),l.forEach(We)}}}if(Ae)return pt(pr());Lt();let $t=()=>R(Xe(),C,Le,1);function Dt(){V=!0,te?.(),De<(le==="infinite"?1/0:le)&&(De++,Oe=setTimeout(()=>{mt=!0},de))}function Ot(){ut=-1,Ye=[],Ee=!1,V=!1,mt=!1,Ie.clear(),gt(),He=!0}function dr(){let o=performance.now(),c=Xe();if(mt&&$t()%1&&Ot(),!He&&N===!1&&c===Tt)return;He=!1,Tt=c;let g=u;if(N!==!1){let $=o-Mt,D=$>0?Math.abs(c-(Ue<0?c:Ue))/$:0;g=u*Math.max(.2,1+D*(typeof N=="number"?N:1)*.04)}Ue=c,Mt=o;let T=b?Qe===-1||c>=Qe?"forward":"reverse":y;Qe=c;let G=k-M,re=!0,j=G===0?0:(c-M)/G;if(isNaN(Fe)||(Fe<=0&&j>0&&ge?.(),Fe<1&&j>=1&&Re?.(),Fe>=1&&j<1&&ye?.(),Fe>0&&j<=0&&me?.()),Fe=j,Z){let $=kt(0,R(c,M,k,g));fe=$,e.style.setProperty("--scroll-draw-progress",String($));let D=T==="reverse"?1-$:$;e.style.clipPath=ve(D),$e?.($),!Ee&&R(c,M,k,g)>0&&(Ee=!0,X?.()),$>=1&&!V?Dt():$<1&&!I&&(V=!1);return}if(l.forEach(($,D)=>{let J=D*O*G,Y=kt(D,R(c,M+J,k+J,g));dt($,D,Y,T),D===0&&(fe=Y,$e?.(Y),e.style.setProperty("--scroll-draw-progress",String(Y))),Y<1&&(re=!1)}),z){let $=q(R(c,M,k,g));for(let D in z){let J=parseFloat(D);$>=J&&!Ie.has(J)&&(Ie.add(J),z[D]?.())}}!Ee&&R(c,M,k,g)>0&&(Ee=!0,X?.()),re&&!V?Dt():!re&&!I&&(V=!1)}let ze=Ce(F??window,[e],$t,dr,()=>{let o=p.join();l.forEach(We),Lt(),He=!0,p.join()!==o&&Be()}),yt=x>0;function Be(){ze.hold(ie||yt)}let It;return yt&&(It=setTimeout(()=>{yt=!1,Be()},x)),Be(),pt({destroy(){clearTimeout(Oe),clearTimeout(It),ze.off(),xt()},replay(){Ot(),Qe=-1,Ue=-1,De=0,ie=!1,fe=0,clearTimeout(Oe),Be()},pause(){ie=!0,ze.hold(!0)},resume(){ie&&(ie=!1,He=!0,Be())},seek(o){let c=Math.min(1,Math.max(0,o));fe=c,ut=c,Ye=[],ie=!0,ze.hold(!0),ur(c,y),He=!0},getProgress(){return fe},refresh:ze.remeasure},()=>({tStart:M,tEnd:k}))}function Xt(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?it(n,t):(W("Container not found:",e),r)}function Ir(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Zt(e){let t=[],r=/([\w]+)\(([^)]*)\)/g,n;for(;(n=r.exec(e))!==null;){let s=[],i=[],a=n[2].trim();if(a)for(let u of a.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(m?parseFloat(m[1]):0),i.push(m?m[2]:"")}t.push({fn:n[1],nums:s,units:i})}return t}function Rr(e,t,r){let n=Zt(e),s=Zt(t);return n.length===0||n.length!==s.length?r<1?e:t:n.map((i,a)=>{let u=s[a];return i.fn!==u.fn||i.nums.length!==u.nums.length?r<1?`${i.fn}(${i.nums.map((m,d)=>`${m}${i.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,d)=>`${m}${u.units[d]}`).join(", ")})`:`${i.fn}(${i.nums.map((m,d)=>`${m+(u.nums[d]-m)*r}${i.units[d]}`).join(", ")})`}).join(" ")}function Jt(e,t,r){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*r);let n=String(e),s=String(t);if(Ir(n))return Ke(n,s,r);if(n.includes("("))return Rr(n,s,r);let i=n.match(/^([-+]?[\d.]+)(.*)$/),a=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&a){let u=parseFloat(i[1]),m=parseFloat(a[1]);return`${u+(m-u)*r}${i[2]||a[2]}`}return r<1?n:s}function Nr(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var Hr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Fr=0,Kt="--scroll-draw-progress";function _r(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var tr={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Et(e,t){return typeof window>"u"?tr:t.respectReducedMotion===!1?er(e,t,!1):_e(t,(r,n)=>er(e,r,n))}function er(e,t,r){let{props:n,trigger:s={},easing:i="ease-out",speed:a=1,once:u=!1,axis:m="y",scrollContainer:d,native:h=!0,velocityScale:E=!1,triggerElement:y,onProgress:I,onComplete:se,onEnter:f,onLeave:v,onEnterBack:b,onLeaveBack:x}=t,w=typeof i=="function"?i:oe[i]??oe["ease-out"],L=Te(s.start||"top bottom"),U=Te(s.end||"bottom top"),z=y??e,N=typeof d=="string"?document.querySelector(d):d??null,K=Object.entries(n).map(([l,p])=>({prop:Nr(l),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function Ve(){let l=window.getComputedStyle(e);for(let p of K)p.from===""&&(p.from=l.getPropertyValue(p.prop).trim()||"0")}function le(){for(let l of K)e.style.setProperty(l.prop,String(l.to))}let de=new Map;for(let l of[...K.map(p=>p.prop),Kt])de.set(l,e.style.getPropertyValue(l));function B(){for(let[l,p]of de)p?e.style.setProperty(l,p):e.style.removeProperty(l)}if(r)return le(),se?.(),{...tr,destroy:B,getProgress:()=>1};Ve();let ee=()=>N?m==="x"?N.scrollLeft:N.scrollTop:m==="x"?window.scrollX:window.scrollY,Ae=()=>N?m==="x"?N.clientWidth:N.clientHeight:m==="x"?window.innerWidth:window.innerHeight,P=typeof i=="string"?tt(i):null;function H(){if(!h||!_r()||!P||m!=="y"||N||z!==e||u||a!==1||I||se||f||v||b||x||E!==!1||(s.start||"top bottom").trim()!=="top bottom"||(s.end||"bottom top").trim()!=="bottom top")return!1;for(let l of K)if(!Hr.has(l.prop))return!1;return!0}function $e(){let l=`ssd-a-${++Fr}`,p=K.map(C=>`${C.prop}:${C.from}`).join(";"),_=K.map(C=>`${C.prop}:${C.to}`).join(";"),M=document.createElement("style");M.setAttribute("data-ssd-animate",""),M.textContent=`@keyframes ${l}{from{${p}}to{${_}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${P};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(M),e.classList.add(l);let k=()=>{let C=e.getBoundingClientRect();return ke({top:C.top,height:C.height},ee(),Ae(),L,U)};Me(e,{type:"animate",getProgress:()=>O.getProgress(),getTrigger:k});let O={refresh(){},destroy(){e.classList.remove(l),M.remove(),e.style.animationPlayState="",B(),pe(e)},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l)},pause(){e.style.animationPlayState="paused"},resume(){e.style.animationPlayState=""},seek(C){let Le=Math.min(1,Math.max(0,C));e.classList.remove(l);for(let V of K)e.style.setProperty(V.prop,Jt(V.from,V.to,Le))},getProgress(){let{tStart:C,tEnd:Le}=k();return w(R(ee(),C,Le,a))}};return O}if(H())return $e();let X=0,te=0,ge=!1,Re=-1,ye=0,me=0,Z=!1,q=NaN,Ne=-1,Ge=0,F=z===e?K:[],he=!1;function be(){let l=e.style,p=F.map(O=>l.getPropertyValue(O.prop)),_=l.transition;F.length&&(l.transition="none"),F.forEach(O=>l.setProperty(O.prop,de.get(O.prop)??""));let M=Ze(z,N,m);F.forEach((O,C)=>l.setProperty(O.prop,p[C])),F.length&&(e.offsetWidth,l.transition=_);let k=ke(M,M.scroll,Ae(),L,U);he&&Math.abs(k.tStart-X)<1&&Math.abs(k.tEnd-te)<1||(he=!0,X=k.tStart,te=k.tEnd)}function ce(l){e.style.setProperty(Kt,String(l));for(let p of K)e.style.setProperty(p.prop,Jt(p.from,p.to,l));I?.(l)}function Pe(l){if(isNaN(q)){q=l;return}q<=0&&l>0&&f?.(),q<1&&l>=1&&v?.(),q>=1&&l<1&&b?.(),q>0&&l<=0&&x?.(),q=l}function we(){if(ge)return;let l=performance.now(),p=ee(),_=a;if(E!==!1){let C=l-Ge,Le=C>0?Math.abs(p-(Ne<0?p:Ne))/C:0;_=a*Math.max(.2,1+Le*(typeof E=="number"?E:1)*.04)}Ne=p,Ge=l;let M=te===X?0:(p-X)/(te-X);Pe(M);let k=R(p,X,te,_),O=u?Math.max(Re,w(ye=Math.max(ye,k))):w(k);me=O,ce(O),O>=1&&!Z?(Z=!0,se?.()):O<1&&!u&&(Z=!1)}let ue=Ce(N??window,[z],()=>R(ee(),X,te,Math.min(a,1)),we,be);be(),te===X&&W("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),ye=R(ee(),X,te,a),me=w(ye),ce(me),Me(e,{type:"animate",getProgress:()=>me,getTrigger:()=>({tStart:X,tEnd:te})});function ve(){ge=!0,ue.hold(!0)}return{destroy(){ge=!0,ue.off(),B(),pe(e)},replay(){Re=-1,ye=0,Z=!1,me=0,ge=!1,ce(0),ue.hold(!1)},pause:ve,resume(){ge&&(ge=!1,ue.hold(!1))},seek(l){let p=Math.min(1,Math.max(0,l));me=p,Re=p,ye=0,ve(),ce(p)},getProgress(){return me},refresh:ue.remeasure}}var at={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function rr(e,t){if(typeof window>"u")return at;let r=typeof e=="string"?document.querySelector(e):e;return r?Et(r,t):(W("scrollAnimate: element not found:",e),at)}function nr(e,t={}){if(typeof window>"u")return at;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return W("scrollParallax: element not found:",e),at;let{speed:n=.3,axis:s="y",easing:i="linear",trigger:a,onProgress:u}=t,m=-n*100,d=r.style,h=!!r.ownerSVGElement,E=d.getPropertyValue("transform-box");h&&d.setProperty("transform-box","fill-box");let y=Et(r,{props:s==="x"?{transform:["translateX(0%)",`translateX(${m}%)`]}:{transform:["translateY(0%)",`translateY(${m}%)`]},trigger:a??{start:"top bottom",end:"bottom top"},easing:i,native:!1,onProgress:u});return h?{...y,destroy(){y.destroy(),d.setProperty("transform-box",E)}}:y}var St={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function or(e,t){if(typeof window>"u")return St;let r=typeof e=="string"?document.querySelector(e):e;return r?_e(t,(n,s)=>Vr(r,n,s)):(W("scrollCounter: element not found:",e),St)}function Vr(e,t,r){let{from:n=0,to:s,format:i,easing:a="ease-out",trigger:u={},once:m=!0,decimals:d,onComplete:h}=t,E=d!==void 0?P=>P.toFixed(d):i??(P=>String(Math.round(P))),y=typeof a=="function"?a:oe[a]??oe["ease-out"],I=Te(u.start||"top 80%"),se=Te(u.end||"top 20%");if(r)return e.textContent=E(s),h?.(),{...St,getProgress:()=>1};let f=0,v=0,b=!1,x=-1,w=0,L=0,U=!1,z=()=>window.scrollY,N=()=>window.innerHeight;function K(){let P=e.getBoundingClientRect(),H=ke({top:P.top,height:P.height},z(),N(),I,se);b&&Math.abs(H.tStart-f)<1&&Math.abs(H.tEnd-v)<1||(b=!0,f=H.tStart,v=H.tEnd)}let Ve=e.style.getPropertyValue("--scroll-draw-progress");function le(P){e.textContent=E(n+(s-n)*P),e.style.setProperty("--scroll-draw-progress",String(P))}let de=()=>R(z(),f,v,1);function B(){let P=de(),H=m?Math.max(x,y(w=Math.max(w,P))):y(P);L=H,le(H),H>=1&&!U?(U=!0,h?.()):H<1&&!m&&(U=!1)}K();{w=R(z(),f,v,1);let P=y(w);L=P,le(P)}let ee=Ce(window,[e],de,B,K);Me(e,{type:"counter",getProgress:()=>L,getTrigger:()=>({tStart:f,tEnd:v})});let Ae=()=>ee.hold(!1);return{destroy(){ee.off(),e.style.setProperty("--scroll-draw-progress",Ve),pe(e)},replay(){x=-1,w=0,U=!1,L=0,le(0),Ae()},pause:()=>ee.hold(!0),resume:Ae,seek(P){let H=Math.min(1,Math.max(0,P));L=H,x=H,w=0,ee.hold(!0),le(H)},getProgress(){return L}}}var sr="http://www.w3.org/2000/svg",Gr="cinematic-photo",lr=e=>e<0?0:e>1?1:e;function lt(e){let t=parseFloat(e);return Number.isFinite(t)?lr(t/100):0}function ir(e){return oe[e]??oe.linear}var ar=e=>({destroy(){},getProgress:()=>e}),ct=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||W("Cinematic: wrapper not found:",t.wrapper)}loadStory(t){let r=this.mount;if(typeof window>"u"||!r)return ar(0);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 s=[];for(let f of t.scenes){if(f.background){let b=document.createElement("img");b.id=Gr,b.src=f.background,b.alt="",b.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(b)}let v=f.animations.filter(b=>b.type==="draw");if(v.length){let b=document.createElementNS(sr,"svg");b.setAttribute("viewBox",`0 0 ${t.canvas.width} ${t.canvas.height}`),b.setAttribute("preserveAspectRatio","xMidYMid meet"),b.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(b);for(let x of v){let w=document.createElementNS(sr,"path");w.id=x.target.replace(/^#/,""),w.setAttribute("d",x.d),w.setAttribute("fill","none"),w.setAttribute("stroke",x.stroke),w.setAttribute("stroke-width",String(x.strokeWidth)),w.setAttribute("stroke-linecap","round"),w.setAttribute("stroke-linejoin","round");let L=x.length||w.getTotalLength?.()||0;w.style.strokeDasharray=String(L),w.style.strokeDashoffset=String(L),b.appendChild(w),s.push({kind:"draw",el:w,start:lt(x.start),end:lt(x.end),ease:ir(x.easing),length:L})}}for(let b of f.animations){if(b.type!=="fade")continue;let x=n.querySelector(b.target)??document.querySelector(b.target);x&&(x.style.opacity=String(b.from),s.push({kind:"fade",el:x,start:lt(b.start),end:lt(b.end),ease:ir("ease-in-out"),from:b.from,to:b.to}))}}let i=0,a=null;for(let f=r.parentElement;f?.parentElement;f=f.parentElement)if(/[ao]/.test(getComputedStyle(f).overflowY)&&f.scrollHeight>f.clientHeight&&(f!==document.body||/[aoh]/.test(getComputedStyle(f.parentElement).overflowY))){a=f;break}let u=0,m=0,d=()=>{let f=r.getBoundingClientRect().top;u=a?f-a.getBoundingClientRect().top-a.clientTop+a.scrollTop:f+window.scrollY,m=u+Math.max(0,r.offsetHeight-(a?a.clientHeight:window.innerHeight))},h=()=>{let f=a?a.scrollTop:window.scrollY;return m<=u?f>=u?1:0:R(f,u,m,1)},E=f=>{for(let v of s){let b=v.end-v.start,x=b<=0?f>=v.end?1:0:lr((f-v.start)/b),w=v.ease(x);v.kind==="draw"?v.el.style.strokeDashoffset=String(v.length*(1-w)):v.el.style.opacity=String(v.from+(v.to-v.from)*w)}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return E(1),ar(1);let y=()=>{i=h(),E(i)};d(),y();let I=Ce(a||window,[r],h,y,d);Me(r,{type:"draw",getProgress:()=>i,getTrigger:()=>({tStart:u,tEnd:m})});let se=rt(f=>{f&&(se(),I.off(),pe(r),i=1,E(1))});return{destroy(){se(),I.off(),pe(r)},getProgress:()=>i}}};if(typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("scroll-draw")){let e=["speed","easing","stagger","direction","selector","fade","once"];class t extends HTMLElement{constructor(){super(...arguments);this.instance=null;this.key=""}connectedCallback(){this.build()}attributeChangedCallback(){this.instance&&this.build()}build(){let s=JSON.stringify(e.map(E=>this.getAttribute(E)));if(this.instance&&s===this.key)return;this.instance?.destroy(),this.key=s;let i={},a=this.getAttribute("speed"),u=this.getAttribute("easing"),m=this.getAttribute("stagger"),d=this.getAttribute("direction"),h=this.getAttribute("selector");a&&(i.speed=parseFloat(a)),u&&(i.easing=u),m&&(i.stagger=parseFloat(m)),d&&(i.direction=d),h&&(i.selector=h),this.hasAttribute("fade")&&(i.fade=this.getAttribute("fade")!=="false"),this.hasAttribute("once")&&(i.once=this.getAttribute("once")!=="false"),this.instance=it(this,i)}disconnectedCallback(){this.instance?.destroy(),this.instance=null}}t.observedAttributes=e,customElements.define("scroll-draw",t)}return Er(Wr);})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'./chunk-2PYLM3E7.mjs';import {a as a$1,e,c,b as b$2}from'./chunk-NV6YTPHI.mjs';import {d}from'./chunk-THPTANES.mjs';import {a as a$3}from'./chunk-4DOJSIEQ.mjs';import {a as a$2,b as b$1}from'./chunk-
|
|
1
|
+
import {a}from'./chunk-2PYLM3E7.mjs';import {a as a$1,e,c,b as b$2}from'./chunk-NV6YTPHI.mjs';import {d}from'./chunk-THPTANES.mjs';import {a as a$3}from'./chunk-4DOJSIEQ.mjs';import {a as a$2,b as b$1}from'./chunk-EBU6E26L.mjs';import {b}from'./chunk-LFSU6LR3.mjs';function G(e,o){let t=document.createElement("span");t.textContent=o,t.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;user-select:none",e.appendChild(t);}function S(e=""){let o=document.createElement("span");return o.setAttribute("aria-hidden","true"),o.textContent=e,o}function W(e){let o=e.textContent??"";return e.textContent="",o.split(/(\s+)/).filter(Boolean).map(t=>{let n=e.appendChild(S(t)),i=/^\s+$/.test(t);return i?n.style.whiteSpace="pre":n.style.display="inline-block",i?null:n}).filter(t=>t!==null)}function X(e){let o=e.textContent??"";e.textContent="";let t=[],n=null;for(let i of o){let r=S(i),s=i===" ";s?r.style.whiteSpace="pre":(r.style.display="inline-block",t.push(r)),s||i>"\u0DFF"?n=null:n||(n=e.appendChild(S()),n.style.cssText="display:inline-block;white-space:nowrap"),(n??e).appendChild(r);}return t}function R(e){let o=W(e),t=new Map;for(let r of o){let s=r.offsetTop;t.has(s)||t.set(s,[]),t.get(s).push(r);}let n=[],i=Array.from(t.keys()).sort((r,s)=>r-s);for(let r of i){let s=t.get(r),p=S();p.style.display="inline-block",s.forEach((d,m)=>{let f=d.nextElementSibling;p.appendChild(d),m<s.length-1&&f&&f.style.whiteSpace==="pre"&&p.appendChild(f);}),n.push(p);}return e.textContent="",n.forEach((r,s)=>{e.appendChild(r),s<n.length-1&&e.appendChild(document.createTextNode(" "));}),n}function J(e,o,t,n){if(t<=1||n===0)return e;n=Math.min(n,1/t);let i=(t-1)*n,r=o*n,s=r+(1-i);return s<=r?e>=r?1:0:a$3((e-r)/(s-r),0,1)}function K(e,o){let t=[];if(o?.y!==void 0&&t.push(`translateY(${o.y*(1-e)}px)`),o?.x!==void 0&&t.push(`translateX(${o.x*(1-e)}px)`),o?.rotate!==void 0&&t.push(`rotate(${o.rotate*(1-e)}deg)`),o?.scale!==void 0){let n=o.scale+(1-o.scale)*e;t.push(`scale(${n})`);}return t.join(" ")}var v={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function se(e,o={}){if(typeof window>"u")return v;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return b("scrollText: element not found:",e),v;let n=t;return a(o,(i,r)=>Q(n,i,r))}function Q(e$1,o,t){let{split:n="words",stagger:i=.04,easing:r="ease-out",from:s={opacity:0,y:24},trigger:p={},once:d$1=true,onComplete:m}=o,f=typeof r=="function"?r:d[r]??d["ease-out"],_=a$1(p.start||"top 85%"),j=a$1(p.end||"top 40%"),b=e$1.innerHTML,I=e$1.textContent??"",a;n==="chars"?a=X(e$1):n==="lines"?a=R(e$1):a=W(e$1),G(e$1,I);let q=a.length;function z(l,T){s?.opacity!==void 0&&(l.style.opacity=String(s.opacity+(1-s.opacity)*T));let x=K(T,s);x&&(l.style.transform=x);}function c$1(l){e$1.style.setProperty("--scroll-draw-progress",String(l)),a.forEach((T,x)=>{let U=f(J(l,x,q,i));z(T,U);});}if(t)return c$1(1),m?.(),{...v,destroy:()=>{e$1.innerHTML=b;},getProgress:()=>1};c$1(0);let w=0,E=0,g=-1,u=0,h=false;function P(){({tStart:w,tEnd:E}=c(e$1.getBoundingClientRect(),window.scrollY,window.innerHeight,_,j));}let C=()=>b$2(window.scrollY,w,E,1);function F(){let l=d$1?g=Math.max(g,C()):C();u=l,c$1(l),l>=1&&!h?(h=true,m?.()):l<1&&!d$1&&(h=false);}P();let y=e(window,[e$1],C,F,()=>{n==="lines"&&(e$1.innerHTML=b,a=R(e$1),G(e$1,I),c$1(u)),P();});a$2(e$1,{type:"text",getProgress:()=>u,getTrigger:()=>({tStart:w,tEnd:E})});let k=()=>y.hold(false);return {destroy(){y.off(),e$1.innerHTML=b,b$1(e$1);},replay(){g=-1,h=false,u=0,c$1(0),k();},pause:()=>y.hold(true),resume:k,seek(l){y.hold(true),c$1(u=g=a$3(l,0,1));},getProgress(){return u}}}export{se as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a,b as b$1}from'./chunk-XSVTHCLO.mjs';import {a as a$3}from'./chunk-
|
|
1
|
+
import {a,b as b$1}from'./chunk-XSVTHCLO.mjs';import {a as a$3}from'./chunk-BRV2B2YW.mjs';import {a as a$4}from'./chunk-32ZCSGFZ.mjs';import {a as a$2}from'./chunk-U5TKLHGW.mjs';import {a as a$1}from'./chunk-7USW2XFB.mjs';import {b as b$2}from'./chunk-7XOFQCQE.mjs';import {defineComponent,ref,h as h$1,onMounted,watch,onUnmounted,unref}from'vue';var u=e=>typeof e=="function"?e():unref(e);function r(e,t,o){let l=null,i=t(),s=()=>{l?.destroy(),l=e.value?o(e.value,b$1(i,()=>i)):null;};onMounted(s),watch(()=>a(i=t()),s),onUnmounted(()=>{l?.destroy(),l=null;});}function B(e={}){let t=ref(null);return r(t,()=>u(e),b$2),t}var g={preset:0,selector:0,speed:0,fade:1,easing:0,trigger:0,stagger:0,direction:0,once:1,debug:1,axis:0,scrollContainer:0,autoReverse:1,delay:0,strokeColor:0,strokeWidth:0,fillOpacity:0,clip:2,waypoints:0,velocityScale:3,threshold:0,rootMargin:0,repeat:0,repeatDelay:0,morphTo:0,onProgress:0,onStart:0,onComplete:0,onEnter:0,onLeave:0,onEnterBack:0,onLeaveBack:0,autoplay:1,duration:0,native:1},b=[null,Boolean,[Boolean,String],[Boolean,Number]],T=e=>({type:e,default:void 0}),H=defineComponent({name:"ScrollDraw",props:Object.fromEntries(Object.entries(g).map(([e,t])=>[e,t?T(b[t]):null])),setup(e,{slots:t}){let o=ref(null);return r(o,()=>{let l={};for(let i in g){let s=e[i];s!=null&&(l[i]=s);}return l},b$2),()=>h$1("div",{ref:o},t.default?.())}});function V(e){let t=ref(null);return r(t,()=>u(e),a$1),t}var j=defineComponent({name:"ScrollAnimate",props:{options:{type:Object,required:true}},setup(e,{slots:t}){let o=ref(null);return r(o,()=>e.options,a$1),()=>h$1("div",{ref:o},t.default?.())}});function G(e){let t=ref(null);return r(t,()=>u(e),a$2),t}var h=defineComponent({name:"ScrollCounter",props:{to:{type:Number,required:true},from:{type:Number},format:{type:Function},easing:{type:[String,Function]},trigger:{type:Object},once:T(Boolean),decimals:{type:Number},onComplete:{type:Function}},setup(e){let t=ref(null);return r(t,()=>{let o={to:e.to};return e.from!=null&&(o.from=e.from),e.format!=null&&(o.format=e.format),e.easing!=null&&(o.easing=e.easing),e.trigger!=null&&(o.trigger=e.trigger),e.once!=null&&(o.once=e.once),e.decimals!=null&&(o.decimals=e.decimals),e.onComplete!=null&&(o.onComplete=e.onComplete),o},a$2),()=>h$1("span",{ref:t})}});function N(e={}){let t=ref(null);return r(t,()=>u(e),a$3),t}var F=defineComponent({name:"ScrollVideo",props:{src:{type:String,required:true},options:{type:Object},muted:{type:Boolean,default:true},playsInline:{type:Boolean,default:true},class:{type:String}},setup(e){let t=ref(null);return r(t,()=>e.options??{},a$3),()=>h$1("video",{ref:t,src:e.src,muted:e.muted,playsinline:e.playsInline,preload:"auto",class:e.class})}});function q(e={}){let t=ref(null);return r(t,()=>u(e),a$4),t}var I=defineComponent({name:"ScrollText",props:{options:{type:Object},tag:{type:String,default:"p"}},setup(e,{slots:t}){let o=ref(null);return r(o,()=>e.options??{},a$4),()=>h$1(e.tag,{ref:o},t.default?.())}});export{B as a,H as b,V as c,j as d,G as e,h as f,N as g,F as h,q as i,I as j};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b,a as a$4}from'./chunk-V3Z6G5JE.mjs';import {a as a$3}from'./chunk-UPWWULKI.mjs';import {a}from'./chunk-2PYLM3E7.mjs';import {a as a$1,e,b as b$1,c}from'./chunk-NV6YTPHI.mjs';import {d}from'./chunk-THPTANES.mjs';import {a as a$2,b as b$3}from'./chunk-
|
|
1
|
+
import {b,a as a$4}from'./chunk-V3Z6G5JE.mjs';import {a as a$3}from'./chunk-UPWWULKI.mjs';import {a}from'./chunk-2PYLM3E7.mjs';import {a as a$1,e,b as b$1,c}from'./chunk-NV6YTPHI.mjs';import {d}from'./chunk-THPTANES.mjs';import {a as a$2,b as b$3}from'./chunk-EBU6E26L.mjs';import {b as b$2}from'./chunk-LFSU6LR3.mjs';function wt(t){return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")}function ut(t){let i=[],l=/([\w]+)\(([^)]*)\)/g,s;for(;(s=l.exec(t))!==null;){let m=[],r=[],c=s[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let o=u.match(/^([-+]?[\d.eE]+)(.*)$/);m.push(o?parseFloat(o[1]):0),r.push(o?o[2]:"");}i.push({fn:s[1],nums:m,units:r});}return i}function Mt(t,i,l){let s=ut(t),m=ut(i);return s.length===0||s.length!==m.length?l<1?t:i:s.map((r,c)=>{let u=m[c];return r.fn!==u.fn||r.nums.length!==u.nums.length?l<1?`${r.fn}(${r.nums.map((o,p)=>`${o}${r.units[p]}`).join(", ")})`:`${u.fn}(${u.nums.map((o,p)=>`${o}${u.units[p]}`).join(", ")})`:`${r.fn}(${r.nums.map((o,p)=>`${o+(u.nums[p]-o)*l}${r.units[p]}`).join(", ")})`}).join(" ")}function ft(t,i,l){if(typeof t=="number"&&typeof i=="number")return String(t+(i-t)*l);let s=String(t),m=String(i);if(wt(s))return a$4(s,m,l);if(s.includes("("))return Mt(s,m,l);let r=s.match(/^([-+]?[\d.]+)(.*)$/),c=m.match(/^([-+]?[\d.]+)(.*)$/);if(r&&c){let u=parseFloat(r[1]),o=parseFloat(c[1]);return `${u+(o-u)*l}${r[2]||c[2]}`}return l<1?s:m}function Lt(t){return t.replace(/([A-Z])/g,i=>`-${i.toLowerCase()}`)}var $t=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),At=0,pt="--scroll-draw-progress";function Ct(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var dt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Wt(t,i){return typeof window>"u"?dt:i.respectReducedMotion===false?gt(t,i,false):a(i,(l,s)=>gt(t,l,s))}function gt(t,i,l){let{props:s,trigger:m={},easing:r="ease-out",speed:c$1=1,once:u=false,axis:o="y",scrollContainer:p,native:yt=true,velocityScale:H=false,triggerElement:ht,onProgress:q,onComplete:F,onEnter:U,onLeave:X,onEnterBack:Y,onLeaveBack:Z}=i,x=typeof r=="function"?r:d[r]??d["ease-out"],J=a$1(m.start||"top bottom"),K=a$1(m.end||"bottom top"),N=ht??t,y=typeof p=="string"?document.querySelector(p):p??null,h=Object.entries(s).map(([e,n])=>({prop:Lt(e),from:Array.isArray(n)?n[0]:"",to:Array.isArray(n)?n[1]:n}));function Et(){let e=window.getComputedStyle(t);for(let n of h)n.from===""&&(n.from=e.getPropertyValue(n.prop).trim()||"0");}function bt(){for(let e of h)t.style.setProperty(e.prop,String(e.to));}let V=new Map;for(let e of [...h.map(n=>n.prop),pt])V.set(e,t.style.getPropertyValue(e));function O(){for(let[e,n]of V)n?t.style.setProperty(e,n):t.style.removeProperty(e);}if(l)return bt(),F?.(),{...dt,destroy:O,getProgress:()=>1};Et();let M=()=>y?o==="x"?y.scrollLeft:y.scrollTop:o==="x"?window.scrollX:window.scrollY,Q=()=>y?o==="x"?y.clientWidth:y.clientHeight:o==="x"?window.innerWidth:window.innerHeight,tt=typeof r=="string"?b(r):null;function St(){if(!yt||!Ct()||!tt||o!=="y"||y||N!==t||u||c$1!==1||q||F||U||X||Y||Z||H!==false||(m.start||"top bottom").trim()!=="top bottom"||(m.end||"bottom top").trim()!=="bottom top")return false;for(let e of h)if(!$t.has(e.prop))return false;return true}function vt(){let e=`ssd-a-${++At}`,n=h.map(a=>`${a.prop}:${a.from}`).join(";"),w=h.map(a=>`${a.prop}:${a.to}`).join(";"),b=document.createElement("style");b.setAttribute("data-ssd-animate",""),b.textContent=`@keyframes ${e}{from{${n}}to{${w}}}.${e}{animation-name:${e};animation-duration:auto;animation-timing-function:${tt};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(b),t.classList.add(e);let d=()=>{let a=t.getBoundingClientRect();return c({top:a.top,height:a.height},M(),Q(),J,K)};a$2(t,{type:"animate",getProgress:()=>f.getProgress(),getTrigger:d});let f={refresh(){},destroy(){t.classList.remove(e),b.remove(),t.style.animationPlayState="",O(),b$3(t);},replay(){t.classList.remove(e),t.offsetWidth,t.classList.add(e);},pause(){t.style.animationPlayState="paused";},resume(){t.style.animationPlayState="";},seek(a){let A=Math.min(1,Math.max(0,a));t.classList.remove(e);for(let I of h)t.style.setProperty(I.prop,ft(I.from,I.to,A));},getProgress(){let{tStart:a,tEnd:A}=d();return x(b$1(M(),a,A,c$1))}};return f}if(St())return vt();let g=0,E=0,T=false,W=-1,P=0,S=0,R=false,v=NaN,B=-1,et=0,L=N===t?h:[],nt=false;function rt(){let e=t.style,n=L.map(f=>e.getPropertyValue(f.prop)),w=e.transition;L.length&&(e.transition="none"),L.forEach(f=>e.setProperty(f.prop,V.get(f.prop)??""));let b=a$3(N,y,o);L.forEach((f,a)=>e.setProperty(f.prop,n[a])),L.length&&(t.offsetWidth,e.transition=w);let d=c(b,b.scroll,Q(),J,K);nt&&Math.abs(d.tStart-g)<1&&Math.abs(d.tEnd-E)<1||(nt=true,g=d.tStart,E=d.tEnd);}function k(e){t.style.setProperty(pt,String(e));for(let n of h)t.style.setProperty(n.prop,ft(n.from,n.to,e));q?.(e);}function Tt(e){if(isNaN(v)){v=e;return}v<=0&&e>0&&U?.(),v<1&&e>=1&&X?.(),v>=1&&e<1&&Y?.(),v>0&&e<=0&&Z?.(),v=e;}function Pt(){if(T)return;let e=performance.now(),n=M(),w=c$1;if(H!==false){let a=e-et,A=a>0?Math.abs(n-(B<0?n:B))/a:0;w=c$1*Math.max(.2,1+A*(typeof H=="number"?H:1)*.04);}B=n,et=e;let b=E===g?0:(n-g)/(E-g);Tt(b);let d=b$1(n,g,E,w),f=u?Math.max(W,x(P=Math.max(P,d))):x(d);S=f,k(f),f>=1&&!R?(R=true,F?.()):f<1&&!u&&(R=false);}let $=e(y??window,[N],()=>b$1(M(),g,E,Math.min(c$1,1)),Pt,rt);rt(),E===g&&b$2("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",t),P=b$1(M(),g,E,c$1),S=x(P),k(S),a$2(t,{type:"animate",getProgress:()=>S,getTrigger:()=>({tStart:g,tEnd:E})});function ot(){T=true,$.hold(true);}return {destroy(){T=true,$.off(),O(),b$3(t);},replay(){W=-1,P=0,R=false,S=0,T=false,k(0),$.hold(false);},pause:ot,resume(){T&&(T=false,$.hold(false));},seek(e){let n=Math.min(1,Math.max(0,e));S=n,W=n,P=0,ot(),k(n);},getProgress(){return S},refresh:$.remeasure}}export{Wt as a};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {b as b$1,a as a$6}from'./chunk-V3Z6G5JE.mjs';import {a as a$2}from'./chunk-UPWWULKI.mjs';import {a as a$5}from'./chunk-XC5NR2MU.mjs';import {a}from'./chunk-2PYLM3E7.mjs';import {a as a$1,e,c,b as b$3}from'./chunk-NV6YTPHI.mjs';import {d}from'./chunk-THPTANES.mjs';import {a as a$4,b as b$2}from'./chunk-
|
|
1
|
+
import {b as b$1,a as a$6}from'./chunk-V3Z6G5JE.mjs';import {a as a$2}from'./chunk-UPWWULKI.mjs';import {a as a$5}from'./chunk-XC5NR2MU.mjs';import {a}from'./chunk-2PYLM3E7.mjs';import {a as a$1,e,c,b as b$3}from'./chunk-NV6YTPHI.mjs';import {d}from'./chunk-THPTANES.mjs';import {a as a$4,b as b$2}from'./chunk-EBU6E26L.mjs';import {b,a as a$3}from'./chunk-LFSU6LR3.mjs';var gt={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 Ct=0;function Ot(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function ht(r,p){let f="";try{f=getComputedStyle(r).getPropertyValue(p).trim();}catch{}return f||(r.getAttribute(p)??"").trim()}var vt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function Nt(r){if(!a$3)return;let p=ht(r,"stroke");if(!p||p==="none"){b("Element has no stroke \u2014 path will not be visible.",r);return}let f=(r.getAttribute("fill")??"").trim();f&&!vt.has(f)&&!vt.has(ht(r,"fill"))&&b("Element has a fill \u2014 it may obscure the stroke animation.",r);}function Ft(r,p,f){let d=document.createElement("div");d.setAttribute("data-svg-scroll-draw-debug",""),d.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 k(){let F=f==="x"?window.scrollX:window.scrollY,x=r-F,M=p-F,H=f==="x";d.innerHTML=`
|
|
2
2
|
<div style="position:absolute;${H?`left:${x}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${x}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
3
|
<div style="position:absolute;${H?`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(d),window.addEventListener("scroll",k,{passive:true}),k(),{el:d,destroy(){window.removeEventListener("scroll",k),d.remove();}}}var wt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,bt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Ht(r,p,f){if(!a$3)return;let d=(r.match(bt)??[]).join("").toUpperCase(),k=(p.match(bt)??[]).join("").toUpperCase(),F=(r.match(wt)??[]).length,x=(p.match(wt)??[]).length;if(d!==k){b(`morphTo: command sequence differs (${d||"\u2205"} \u2192 ${k||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,f);return}F!==x&&b(`morphTo: coordinate count differs (${F} \u2192 ${x}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,f);}function It(r,p,f){let d=(p.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),k=0;return r.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,F=>{let x=parseFloat(F),M=d[k++]??x;return String(+(x+(M-x)*f).toFixed(4))})}function Zt(r,p={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:a(p,(f,d)=>Rt(r,f,d))}function Rt(r,p,f){let{preset:d$1,...k}=p,F=d$1?{...gt[d$1],...k}:k,{selector:x="path, polyline, line, polygon, rect, circle",speed:M=1,fade:H=false,easing:le="linear",trigger:he={},stagger:q=0,direction:u="forward",once:K=false,debug:Ve=false,axis:W="y",scrollContainer:ke,autoReverse:xe=false,delay:fe=0,strokeColor:B,strokeWidth:_,fillOpacity:j,waypoints:U,velocityScale:ce=false,threshold:Et=0,rootMargin:St="0px",repeat:ue=0,repeatDelay:We=0,morphTo:L,clip:Me,autoplay:ze=false,duration:Tt=1e3,native:$t=true,onProgress:me,onStart:ve,onComplete:we,onEnter:Ge,onLeave:qe,onEnterBack:Be,onLeaveBack:_e}=F,D=Me===true?"left":typeof Me=="string"?Me:false,z=typeof le=="function"?le:d[le]??d.linear,je=a$1(he.start||"top bottom"),Ue=a$1(he.end||"bottom top"),P=typeof ke=="string"?document.querySelector(ke):ke??null,ee=Array.isArray(B)?B[0]:null,te=Array.isArray(B)?B[1]:typeof B=="string"?B:null,X=Array.isArray(_)?_[0]:null,re=Array.isArray(_)?_[1]:typeof _=="number"?_:null,Y=Array.isArray(j)?j[0]:null,se=Array.isArray(j)?j[1]:typeof j=="number"?j:null;function ne(e){let t=e*100;switch(D){case "right":return `inset(0 0 0 ${100-t}%)`;case "top":return `inset(0 0 ${100-t}% 0)`;case "bottom":return `inset(${100-t}% 0 0 0)`;case "center":return `circle(${e*150}% at 50% 50%)`;default:return `inset(0 ${100-t}% 0 0)`}}let c$1=D?[]:Array.from(r.querySelectorAll(x)),S=[],C=[],w=0,O=0,be=q,Xe=0,Ye=0,A=false,I=false,R=0,Pe=-1,Ee=[],Se=-1,T=false,N=0,Q=0,Z,Le=false,De=null;function Qe(){De?.destroy(),De=null;}let J=new Set,Ze=NaN,oe=true,Te=-1,Je=performance.now(),ie=NaN;function $e(){return P?W==="x"?P.scrollLeft:P.scrollTop:W==="x"?window.scrollX:window.scrollY}function Ke(){return P?W==="x"?P.clientWidth:P.clientHeight:W==="x"?window.innerWidth:window.innerHeight}function et(){let e=a$2(r,P,W);return c(e,e.scroll,Ke(),je,Ue)}function At(){let e=O-w,t=c$1.length-1,s=P??document.documentElement,o=W==="x"?"Width":"Height";if(be=q,q>0&&t>0&&e>0){let y=s[`scroll${o}`]-s[`client${o}`]-1-w-e/M;y>=0&&(be=Math.min(q,y/(t*e)));}let m=Math.max(0,t)*be*e,b=e/Math.min(M,1);Xe=w+Math.min(0,m,b,m+b),Ye=w+Math.max(0,m,b,m+b);}function tt(){(({tStart:w,tEnd:O}=et())),At(),Ve&&a$3&&(Qe(),De=Ft(w,O,W));}function Ce(e,t=et){a$4(r,{type:"draw",getProgress:()=>e.getProgress(),getTrigger:t});let s=e.destroy;return e.destroy=()=>{s.call(e),b$2(r);},e}function rt(e,t){return K&&!xe?Math.max(Pe,z(Ee[e]=Math.max(Ee[e]??0,t))):z(t)}function kt(e,t){if(r.style.setProperty("--scroll-draw-progress",String(e)),D){let s=t==="reverse"?1-e:e;r.style.clipPath=ne(s);return}c$1.forEach((s,o)=>Oe(s,o,e,t));}function Oe(e,t,s,o){e.style.strokeDashoffset=o==="reverse"?`${S[t]*s}`:`${S[t]*(1-s)}`,H&&(e.style.opacity=o==="reverse"?`${1-s}`:`${s}`),ee&&te?e.style.stroke=a$6(ee,te,s):te&&(e.style.stroke=te),X!==null&&re!==null?e.style.strokeWidth=`${X+(re-X)*s}`:re!==null&&(e.style.strokeWidth=`${re}`),Y!==null&&se!==null?e.style.fillOpacity=`${Y+(se-Y)*s}`:se!==null&&(e.style.fillOpacity=`${se}`),L&&e.tagName.toLowerCase()==="path"&&C[t]&&e.setAttribute("d",It(C[t],L,s));}function Ne(){if(r.style.setProperty("--scroll-draw-progress","0"),D){r.style.clipPath=ne(u==="reverse"?1:0);return}c$1.forEach((e,t)=>{e.style.strokeDasharray=`${S[t]}`,e.style.strokeDashoffset=u==="reverse"?"0":`${S[t]}`,H?e.style.opacity=u==="reverse"?"1":"0":e.style.opacity="",ee&&(e.style.stroke=ee),X!==null&&(e.style.strokeWidth=`${X}`),Y!==null&&(e.style.fillOpacity=`${Y}`),L&&e.tagName.toLowerCase()==="path"&&C[t]&&e.setAttribute("d",C[t]);});}function pe(e,t){let s=e.getAttribute("d"),o=a$5(e);if(L&&C[t]){e.setAttribute("d",L);let m=a$5(e);e.setAttribute("d",C[t]),o=Math.max(a$5(e),m),e.setAttribute("d",s);}S[t]=o,e.style.strokeDasharray=`${o}`;}if(c$1.forEach((e,t)=>{Nt(e);let s=e.tagName.toLowerCase()==="path";s?C.push(e.getAttribute("d")??""):C.push(""),pe(e,t);let o=S[t];L&&(s?Ht(C[C.length-1],L,e):b(`morphTo only applies to <path> elements \u2014 ignored on <${e.tagName}>.`,e)),f?(e.style.strokeDashoffset=u==="reverse"?`${o}`:"0",H&&(e.style.opacity="1"),te&&(e.style.stroke=te),re!==null&&(e.style.strokeWidth=`${re}`),se!==null&&(e.style.fillOpacity=`${se}`),L&&e.tagName.toLowerCase()==="path"&&e.setAttribute("d",L)):(e.style.strokeDashoffset=u==="reverse"?"0":`${o}`,H?e.style.opacity=u==="reverse"?"1":"0":e.style.opacity="",ee&&(e.style.stroke=ee),X!==null&&(e.style.strokeWidth=`${X}`),Y!==null&&(e.style.fillOpacity=`${Y}`));}),f)return D&&(r.style.clipPath=ne(1)),we?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};D&&(r.style.clipPath=ne(u==="reverse"?1:0));let st=typeof le=="string"?b$1(le):null;function xt(){return !($t===false||ze||Ve&&a$3||!Ot()||!c$1.length||!st||D||W!=="y"||P||M!==1||q!==0||K||xe||ce!==false||L||U||ue||fe>0||me||ve||we||Ge||qe||Be||_e||B!=null||_!=null||j!=null||(he.start||"top bottom").trim()!=="top bottom"||(he.end||"bottom top").trim()!=="bottom top")}function Mt(){let e=++Ct,t=`svg-scroll-draw-${e}`,s=`svg-scroll-draw-host-${e}`,o=`--svg-scroll-draw-${e}`,m=u==="reverse"?"0":"var(--ssd-len)",b=u==="reverse"?"var(--ssd-len)":"0",y=`stroke-dashoffset:${m};`,a=`stroke-dashoffset:${b};`;H&&(y+=`opacity:${u==="reverse"?1:0};`,a+=`opacity:${u==="reverse"?0:1};`);let l=document.createElement("style");l.setAttribute("data-svg-scroll-draw",""),l.textContent=`@keyframes ${t}{from{${y}}to{${a}}}.${s}{view-timeline-name:${o};view-timeline-axis:block;}.${t}{animation-name:${t};animation-duration:auto;animation-timing-function:${st};animation-fill-mode:both;animation-timeline:${o};animation-range:cover 0% cover 100%;}`,document.head.appendChild(l),r.classList.add(s);function v(n,i){n.style.setProperty("--ssd-len",String(S[i])),n.style.strokeDasharray=`${S[i]}`,n.style.strokeDashoffset="",n.style.opacity="",n.style.animationPlayState="",n.classList.add(t);}c$1.forEach(v);let g=false,E=-1;function $(){if(E>=0)return E;let n=r.getBoundingClientRect(),{tStart:i,tEnd:h}=c({top:n.top,height:n.height},$e(),Ke(),je,Ue);return z(b$3($e(),i,h,M))}return {destroy(){r.classList.remove(s),c$1.forEach(n=>{n.classList.remove(t),n.style.removeProperty("--ssd-len"),n.style.animationPlayState="";}),l.remove();},replay(){g=false,E=-1,c$1.forEach(v);},pause(){g=true,c$1.forEach(n=>{n.style.animationPlayState="paused";});},resume(){g&&(g=false,c$1.forEach(n=>{n.style.animationPlayState="running";}));},seek(n){let i=Math.min(1,Math.max(0,n));E=i,g=true,c$1.forEach((h,V)=>{h.classList.remove(t),h.style.strokeDashoffset=u==="reverse"?`${S[V]*i}`:`${S[V]*(1-i)}`,H&&(h.style.opacity=u==="reverse"?`${1-i}`:`${i}`);});},getProgress(){return $()},refresh(){c$1.forEach((n,i)=>{pe(n,i),n.style.setProperty("--ssd-len",String(S[i]));});}}}if(xt())return Ce(Mt());function Pt(){let e=Math.max(1,Tt),t=D?e:e*(1+Math.max(0,c$1.length-1)*q),s=0,o=0,m=false;function b(E){let $=true,n=Math.min(1,Math.max(0,E/t));if(D){let i=Math.min(1,Math.max(0,E/e)),h=z(i);N=h,r.style.setProperty("--scroll-draw-progress",String(h)),r.style.clipPath=ne(u==="reverse"?1-h:h),me?.(h),i<1&&($=false);}else {c$1.forEach((h,V)=>{let Dt=V*q*e,lt=Math.min(1,Math.max(0,(E-Dt)/e));Oe(h,V,z(lt),u),lt<1&&($=false);});let i=z(n);N=i,me?.(i),r.style.setProperty("--scroll-draw-progress",String(i));}if(U){let i=z(n);for(let h in U){let V=parseFloat(h);i>=V&&!J.has(V)&&(J.add(V),U[h]?.());}}return $}function y(E){if(T)return;let $=E-s;I||(I=true,ve?.());let n=b($);if(n&&!A){A=true,b(t),we?.(),Q<(ue==="infinite"?1/0:ue??0)&&(Q++,Z=setTimeout(()=>{s=performance.now(),I=false,A=false,J.clear(),Ne(),R=requestAnimationFrame(y);},We));return}n||(R=requestAnimationFrame(y));}function a(){cancelAnimationFrame(R),clearTimeout(Z),s=performance.now(),o=0,T=false,I=false,A=false,Q=0,m=true,N=0,J.clear(),Ne(),R=requestAnimationFrame(y);}let l=new IntersectionObserver(E=>{E.forEach($=>{$.isIntersecting&&!(K&&A)?a():!$.isIntersecting&&!K&&!A&&(cancelAnimationFrame(R),clearTimeout(Z),m=false);});},{root:P??null,threshold:Et,rootMargin:St}),v;function g(){clearTimeout(v),v=setTimeout(()=>c$1.forEach(pe),150);}return window.addEventListener("resize",g),window.addEventListener("orientationchange",g),fe>0?setTimeout(()=>l.observe(r),fe):l.observe(r),{destroy(){cancelAnimationFrame(R),clearTimeout(Z),l.disconnect(),window.removeEventListener("resize",g),window.removeEventListener("orientationchange",g),clearTimeout(v);},replay(){Q=0,a();},pause(){T||!m||(T=true,o=performance.now()-s,cancelAnimationFrame(R));},resume(){T&&(T=false,m=true,s=performance.now()-o,R=requestAnimationFrame(y));},seek(E){let $=Math.min(1,Math.max(0,E));N=$,T=true,o=$*t,s=performance.now()-o,cancelAnimationFrame(R),b(o);},getProgress(){return N},refresh(){clearTimeout(v),c$1.forEach(pe);}}}if(ze)return Ce(Pt());tt();let nt=()=>b$3($e(),Xe,Ye,1);function ot(){A=true,we?.(),Q<(ue==="infinite"?1/0:ue)&&(Q++,Z=setTimeout(()=>{Le=true;},We));}function it(){Pe=-1,Ee=[],I=false,A=false,Le=false,J.clear(),Ne(),oe=true;}function Lt(){let e=performance.now(),t=$e();if(Le&&nt()%1&&it(),!oe&&ce===false&&t===Ze)return;oe=false,Ze=t;let s=M;if(ce!==false){let a=e-Je,l=a>0?Math.abs(t-(Te<0?t:Te))/a:0;s=M*Math.max(.2,1+l*(typeof ce=="number"?ce:1)*.04);}Te=t,Je=e;let o=xe?Se===-1||t>=Se?"forward":"reverse":u;Se=t;let m=O-w,b=true,y=m===0?0:(t-w)/m;if(isNaN(ie)||(ie<=0&&y>0&&Ge?.(),ie<1&&y>=1&&qe?.(),ie>=1&&y<1&&Be?.(),ie>0&&y<=0&&_e?.()),ie=y,D){let a=rt(0,b$3(t,w,O,s));N=a,r.style.setProperty("--scroll-draw-progress",String(a));let l=o==="reverse"?1-a:a;r.style.clipPath=ne(l),me?.(a),!I&&b$3(t,w,O,s)>0&&(I=true,ve?.()),a>=1&&!A?ot():a<1&&!K&&(A=false);return}if(c$1.forEach((a,l)=>{let v=l*be*m,g=rt(l,b$3(t,w+v,O+v,s));Oe(a,l,g,o),l===0&&(N=g,me?.(g),r.style.setProperty("--scroll-draw-progress",String(g))),g<1&&(b=false);}),U){let a=z(b$3(t,w,O,s));for(let l in U){let v=parseFloat(l);a>=v&&!J.has(v)&&(J.add(v),U[l]?.());}}!I&&b$3(t,w,O,s)>0&&(I=true,ve?.()),b&&!A?ot():!b&&!K&&(A=false);}let de=e(P??window,[r],nt,Lt,()=>{let e=S.join();c$1.forEach(pe),tt(),oe=true,S.join()!==e&&ye();}),Fe=fe>0;function ye(){de.hold(T||Fe);}let at;return Fe&&(at=setTimeout(()=>{Fe=false,ye();},fe)),ye(),Ce({destroy(){clearTimeout(Z),clearTimeout(at),de.off(),Qe();},replay(){it(),Se=-1,Te=-1,Q=0,T=false,N=0,clearTimeout(Z),ye();},pause(){T=true,de.hold(true);},resume(){T&&(T=false,oe=true,ye());},seek(e){let t=Math.min(1,Math.max(0,e));N=t,Pe=t,Ee=[],T=true,de.hold(true),kt(t,u),oe=true;},getProgress(){return N},refresh:de.remeasure},()=>({tStart:w,tEnd:O}))}export{gt as a,Zt as b};
|