svg-scroll-draw 2.2.0 → 2.7.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 +7 -7
- package/dist/angular/index.cjs +3 -3
- package/dist/angular/index.d.mts +194 -9
- package/dist/angular/index.d.ts +194 -9
- package/dist/angular/index.mjs +3 -3
- package/dist/astro/index.cjs +3 -3
- package/dist/astro/index.d.mts +78 -1
- package/dist/astro/index.d.ts +78 -1
- package/dist/astro/index.mjs +3 -3
- package/dist/cdn/svg-scroll-draw.global.js +3 -3
- package/dist/devtools/index.cjs +1 -1
- package/dist/devtools/index.d.mts +12 -0
- package/dist/devtools/index.d.ts +12 -0
- package/dist/devtools/index.mjs +1 -1
- package/dist/group/index.cjs +3 -3
- package/dist/group/index.d.mts +88 -1
- package/dist/group/index.d.ts +88 -1
- package/dist/group/index.mjs +3 -3
- package/dist/index.cjs +4 -4
- package/dist/index.d.mts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.mjs +4 -4
- package/dist/lenis/index.cjs +1 -0
- package/dist/lenis/index.d.mts +51 -0
- package/dist/lenis/index.d.ts +51 -0
- package/dist/lenis/index.mjs +1 -0
- package/dist/nuxt/index.cjs +3 -3
- package/dist/nuxt/index.d.mts +286 -5
- package/dist/nuxt/index.d.ts +286 -5
- package/dist/nuxt/index.mjs +3 -3
- package/dist/pin/index.cjs +1 -0
- package/dist/pin/index.d.mts +29 -0
- package/dist/pin/index.d.ts +29 -0
- package/dist/pin/index.mjs +1 -0
- package/dist/react/index.cjs +3 -3
- package/dist/react/index.d.mts +16 -0
- package/dist/react/index.d.ts +16 -0
- package/dist/react/index.mjs +3 -3
- package/dist/snap/index.cjs +1 -0
- package/dist/snap/index.d.mts +30 -0
- package/dist/snap/index.d.ts +30 -0
- package/dist/snap/index.mjs +1 -0
- package/dist/solid/index.cjs +3 -3
- package/dist/solid/index.d.mts +171 -1
- package/dist/solid/index.d.ts +171 -1
- package/dist/solid/index.mjs +3 -3
- package/dist/svelte/index.cjs +3 -3
- package/dist/svelte/index.d.mts +183 -10
- package/dist/svelte/index.d.ts +183 -10
- package/dist/svelte/index.mjs +3 -3
- package/dist/vue/index.cjs +3 -3
- package/dist/vue/index.d.mts +278 -1
- package/dist/vue/index.d.ts +278 -1
- package/dist/vue/index.mjs +3 -3
- package/dist/web-component/index.cjs +3 -3
- package/dist/web-component/index.mjs +3 -3
- package/package.json +16 -1
package/dist/vue/index.d.mts
CHANGED
|
@@ -73,6 +73,14 @@ interface ScrollDrawOptions {
|
|
|
73
73
|
onProgress?: (alpha: number) => void;
|
|
74
74
|
onStart?: () => void;
|
|
75
75
|
onComplete?: () => void;
|
|
76
|
+
/** Fires when scroll position enters the trigger zone (scrolling forward). */
|
|
77
|
+
onEnter?: () => void;
|
|
78
|
+
/** Fires when scroll position exits the trigger zone at the end (scrolling forward). */
|
|
79
|
+
onLeave?: () => void;
|
|
80
|
+
/** Fires when scroll position re-enters the trigger zone from the end (scrolling back). */
|
|
81
|
+
onEnterBack?: () => void;
|
|
82
|
+
/** Fires when scroll position exits the trigger zone at the start (scrolling back). */
|
|
83
|
+
onLeaveBack?: () => void;
|
|
76
84
|
/**
|
|
77
85
|
* Trigger the animation when the element enters the viewport instead of
|
|
78
86
|
* tying it to scroll position. The draw runs over `duration` milliseconds,
|
|
@@ -108,6 +116,67 @@ interface ScrollDrawOptions {
|
|
|
108
116
|
native?: boolean;
|
|
109
117
|
}
|
|
110
118
|
|
|
119
|
+
interface ScrollAnimateOptions {
|
|
120
|
+
props: Record<string, string | number | [string | number, string | number]>;
|
|
121
|
+
trigger?: TriggerConfig;
|
|
122
|
+
easing?: EasingName | ((t: number) => number);
|
|
123
|
+
speed?: number;
|
|
124
|
+
once?: boolean;
|
|
125
|
+
axis?: 'x' | 'y';
|
|
126
|
+
scrollContainer?: string | Element;
|
|
127
|
+
native?: boolean;
|
|
128
|
+
onProgress?: (alpha: number) => void;
|
|
129
|
+
onComplete?: () => void;
|
|
130
|
+
/** Fires when scroll enters the trigger zone (scrolling forward). */
|
|
131
|
+
onEnter?: () => void;
|
|
132
|
+
/** Fires when scroll exits the trigger zone at the end (scrolling forward). */
|
|
133
|
+
onLeave?: () => void;
|
|
134
|
+
/** Fires when scroll re-enters the trigger zone from the end (scrolling back). */
|
|
135
|
+
onEnterBack?: () => void;
|
|
136
|
+
/** Fires when scroll exits the trigger zone at the start (scrolling back). */
|
|
137
|
+
onLeaveBack?: () => void;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
interface ScrollCounterOptions {
|
|
141
|
+
from?: number;
|
|
142
|
+
to: number;
|
|
143
|
+
format?: (value: number) => string;
|
|
144
|
+
easing?: EasingName | ((t: number) => number);
|
|
145
|
+
trigger?: TriggerConfig;
|
|
146
|
+
once?: boolean;
|
|
147
|
+
decimals?: number;
|
|
148
|
+
onComplete?: () => void;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
interface ScrollVideoOptions {
|
|
152
|
+
trigger?: TriggerConfig;
|
|
153
|
+
from?: number;
|
|
154
|
+
to?: number;
|
|
155
|
+
easing?: EasingName | ((t: number) => number);
|
|
156
|
+
once?: boolean;
|
|
157
|
+
axis?: 'x' | 'y';
|
|
158
|
+
preload?: 'auto' | 'metadata';
|
|
159
|
+
onReady?: () => void;
|
|
160
|
+
onComplete?: () => void;
|
|
161
|
+
onProgress?: (alpha: number) => void;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
interface ScrollTextOptions {
|
|
165
|
+
split?: 'chars' | 'words' | 'lines';
|
|
166
|
+
stagger?: number;
|
|
167
|
+
easing?: EasingName | ((t: number) => number);
|
|
168
|
+
from?: {
|
|
169
|
+
opacity?: number;
|
|
170
|
+
y?: number;
|
|
171
|
+
x?: number;
|
|
172
|
+
rotate?: number;
|
|
173
|
+
scale?: number;
|
|
174
|
+
};
|
|
175
|
+
trigger?: TriggerConfig;
|
|
176
|
+
once?: boolean;
|
|
177
|
+
onComplete?: () => void;
|
|
178
|
+
}
|
|
179
|
+
|
|
111
180
|
/** Composable — attach to any container ref. */
|
|
112
181
|
declare function useScrollDraw(options?: ScrollDrawOptions): vue.Ref<HTMLElement | null, HTMLElement | null>;
|
|
113
182
|
/** Component — wraps children in a <div> and initialises the engine. */
|
|
@@ -192,5 +261,213 @@ declare const ScrollDraw: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
192
261
|
once: boolean;
|
|
193
262
|
debug: boolean;
|
|
194
263
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
264
|
+
/**
|
|
265
|
+
* Composable — call with a full options object and bind the returned ref to
|
|
266
|
+
* whichever element you want to animate.
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* <script setup>
|
|
270
|
+
* import { useScrollAnimate } from 'svg-scroll-draw/vue';
|
|
271
|
+
* const el = useScrollAnimate({ props: { opacity: [0, 1] }, easing: 'ease-out', once: true });
|
|
272
|
+
* </script>
|
|
273
|
+
* <div :ref="el">...</div>
|
|
274
|
+
*/
|
|
275
|
+
declare function useScrollAnimate(options: ScrollAnimateOptions): vue.Ref<HTMLElement | null, HTMLElement | null>;
|
|
276
|
+
/**
|
|
277
|
+
* Component — accepts a single `:options` prop and wraps children in a <div>.
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* <ScrollAnimate :options="{ props: { opacity: [0, 1] }, easing: 'ease-out' }">
|
|
281
|
+
* <div>...</div>
|
|
282
|
+
* </ScrollAnimate>
|
|
283
|
+
*/
|
|
284
|
+
declare const ScrollAnimate: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
285
|
+
options: {
|
|
286
|
+
type: () => ScrollAnimateOptions;
|
|
287
|
+
required: true;
|
|
288
|
+
};
|
|
289
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
290
|
+
[key: string]: any;
|
|
291
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
292
|
+
options: {
|
|
293
|
+
type: () => ScrollAnimateOptions;
|
|
294
|
+
required: true;
|
|
295
|
+
};
|
|
296
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
297
|
+
/**
|
|
298
|
+
* Composable — returns a ref to bind to a span/element that will count up on scroll.
|
|
299
|
+
*
|
|
300
|
+
* @example
|
|
301
|
+
* <script setup>
|
|
302
|
+
* import { useScrollCounter } from 'svg-scroll-draw/vue';
|
|
303
|
+
* const el = useScrollCounter({ to: 1000, easing: 'ease-out', once: true });
|
|
304
|
+
* </script>
|
|
305
|
+
* <span :ref="el" />
|
|
306
|
+
*/
|
|
307
|
+
declare function useScrollCounter(options: ScrollCounterOptions): vue.Ref<HTMLElement | null, HTMLElement | null>;
|
|
308
|
+
/**
|
|
309
|
+
* Component — renders a <span> that counts from `from` to `to` on scroll.
|
|
310
|
+
*
|
|
311
|
+
* @example
|
|
312
|
+
* <ScrollCounter :to="1250000" :format="n => '$' + Math.round(n).toLocaleString()" />
|
|
313
|
+
*/
|
|
314
|
+
declare const ScrollCounter: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
315
|
+
to: {
|
|
316
|
+
type: NumberConstructor;
|
|
317
|
+
required: true;
|
|
318
|
+
};
|
|
319
|
+
from: {
|
|
320
|
+
type: NumberConstructor;
|
|
321
|
+
};
|
|
322
|
+
format: {
|
|
323
|
+
type: () => ScrollCounterOptions["format"];
|
|
324
|
+
};
|
|
325
|
+
easing: {
|
|
326
|
+
type: (StringConstructor | FunctionConstructor)[];
|
|
327
|
+
};
|
|
328
|
+
trigger: {
|
|
329
|
+
type: ObjectConstructor;
|
|
330
|
+
};
|
|
331
|
+
once: {
|
|
332
|
+
type: BooleanConstructor;
|
|
333
|
+
};
|
|
334
|
+
decimals: {
|
|
335
|
+
type: NumberConstructor;
|
|
336
|
+
};
|
|
337
|
+
onComplete: {
|
|
338
|
+
type: FunctionConstructor;
|
|
339
|
+
};
|
|
340
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
341
|
+
[key: string]: any;
|
|
342
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
343
|
+
to: {
|
|
344
|
+
type: NumberConstructor;
|
|
345
|
+
required: true;
|
|
346
|
+
};
|
|
347
|
+
from: {
|
|
348
|
+
type: NumberConstructor;
|
|
349
|
+
};
|
|
350
|
+
format: {
|
|
351
|
+
type: () => ScrollCounterOptions["format"];
|
|
352
|
+
};
|
|
353
|
+
easing: {
|
|
354
|
+
type: (StringConstructor | FunctionConstructor)[];
|
|
355
|
+
};
|
|
356
|
+
trigger: {
|
|
357
|
+
type: ObjectConstructor;
|
|
358
|
+
};
|
|
359
|
+
once: {
|
|
360
|
+
type: BooleanConstructor;
|
|
361
|
+
};
|
|
362
|
+
decimals: {
|
|
363
|
+
type: NumberConstructor;
|
|
364
|
+
};
|
|
365
|
+
onComplete: {
|
|
366
|
+
type: FunctionConstructor;
|
|
367
|
+
};
|
|
368
|
+
}>> & Readonly<{}>, {
|
|
369
|
+
once: boolean;
|
|
370
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
371
|
+
/**
|
|
372
|
+
* Composable — returns a ref to bind to a <video> element.
|
|
373
|
+
*
|
|
374
|
+
* @example
|
|
375
|
+
* <script setup>
|
|
376
|
+
* import { useScrollVideo } from 'svg-scroll-draw/vue';
|
|
377
|
+
* const vid = useScrollVideo({ trigger: { start: 'top top', end: 'bottom top' } });
|
|
378
|
+
* </script>
|
|
379
|
+
* <video :ref="vid" src="..." muted playsinline preload="auto" />
|
|
380
|
+
*/
|
|
381
|
+
declare function useScrollVideo(options?: ScrollVideoOptions): vue.Ref<HTMLVideoElement | null, HTMLVideoElement | null>;
|
|
382
|
+
/**
|
|
383
|
+
* Component — renders a <video> scrubbed by scroll position.
|
|
384
|
+
*
|
|
385
|
+
* @example
|
|
386
|
+
* <ScrollVideo src="/hero.mp4" :options="{ trigger: { start: 'top top', end: 'bottom top' } }" />
|
|
387
|
+
*/
|
|
388
|
+
declare const ScrollVideo: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
389
|
+
src: {
|
|
390
|
+
type: StringConstructor;
|
|
391
|
+
required: true;
|
|
392
|
+
};
|
|
393
|
+
options: {
|
|
394
|
+
type: () => ScrollVideoOptions;
|
|
395
|
+
};
|
|
396
|
+
muted: {
|
|
397
|
+
type: BooleanConstructor;
|
|
398
|
+
default: boolean;
|
|
399
|
+
};
|
|
400
|
+
playsInline: {
|
|
401
|
+
type: BooleanConstructor;
|
|
402
|
+
default: boolean;
|
|
403
|
+
};
|
|
404
|
+
class: {
|
|
405
|
+
type: StringConstructor;
|
|
406
|
+
};
|
|
407
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
408
|
+
[key: string]: any;
|
|
409
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
410
|
+
src: {
|
|
411
|
+
type: StringConstructor;
|
|
412
|
+
required: true;
|
|
413
|
+
};
|
|
414
|
+
options: {
|
|
415
|
+
type: () => ScrollVideoOptions;
|
|
416
|
+
};
|
|
417
|
+
muted: {
|
|
418
|
+
type: BooleanConstructor;
|
|
419
|
+
default: boolean;
|
|
420
|
+
};
|
|
421
|
+
playsInline: {
|
|
422
|
+
type: BooleanConstructor;
|
|
423
|
+
default: boolean;
|
|
424
|
+
};
|
|
425
|
+
class: {
|
|
426
|
+
type: StringConstructor;
|
|
427
|
+
};
|
|
428
|
+
}>> & Readonly<{}>, {
|
|
429
|
+
muted: boolean;
|
|
430
|
+
playsInline: boolean;
|
|
431
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
432
|
+
/**
|
|
433
|
+
* Composable — returns a ref to bind to any text element; splits and animates on scroll.
|
|
434
|
+
*
|
|
435
|
+
* @example
|
|
436
|
+
* <script setup>
|
|
437
|
+
* import { useScrollText } from 'svg-scroll-draw/vue';
|
|
438
|
+
* const el = useScrollText({ split: 'words', stagger: 0.05, once: true });
|
|
439
|
+
* </script>
|
|
440
|
+
* <h2 :ref="el">Animate on scroll.</h2>
|
|
441
|
+
*/
|
|
442
|
+
declare function useScrollText(options?: ScrollTextOptions): vue.Ref<HTMLElement | null, HTMLElement | null>;
|
|
443
|
+
/**
|
|
444
|
+
* Component — wraps text content in a <p> (or any tag) and animates it on scroll.
|
|
445
|
+
*
|
|
446
|
+
* @example
|
|
447
|
+
* <ScrollText :options="{ split: 'words', stagger: 0.05 }" tag="h2">
|
|
448
|
+
* Animate on scroll.
|
|
449
|
+
* </ScrollText>
|
|
450
|
+
*/
|
|
451
|
+
declare const ScrollText: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
452
|
+
options: {
|
|
453
|
+
type: () => ScrollTextOptions;
|
|
454
|
+
};
|
|
455
|
+
tag: {
|
|
456
|
+
type: StringConstructor;
|
|
457
|
+
default: string;
|
|
458
|
+
};
|
|
459
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
460
|
+
[key: string]: any;
|
|
461
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
462
|
+
options: {
|
|
463
|
+
type: () => ScrollTextOptions;
|
|
464
|
+
};
|
|
465
|
+
tag: {
|
|
466
|
+
type: StringConstructor;
|
|
467
|
+
default: string;
|
|
468
|
+
};
|
|
469
|
+
}>> & Readonly<{}>, {
|
|
470
|
+
tag: string;
|
|
471
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
195
472
|
|
|
196
|
-
export { ScrollDraw, type ScrollDrawOptions, useScrollDraw };
|
|
473
|
+
export { ScrollAnimate, type ScrollAnimateOptions, ScrollCounter, type ScrollCounterOptions, ScrollDraw, type ScrollDrawOptions, ScrollText, type ScrollTextOptions, ScrollVideo, type ScrollVideoOptions, useScrollAnimate, useScrollCounter, useScrollDraw, useScrollText, useScrollVideo };
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -73,6 +73,14 @@ interface ScrollDrawOptions {
|
|
|
73
73
|
onProgress?: (alpha: number) => void;
|
|
74
74
|
onStart?: () => void;
|
|
75
75
|
onComplete?: () => void;
|
|
76
|
+
/** Fires when scroll position enters the trigger zone (scrolling forward). */
|
|
77
|
+
onEnter?: () => void;
|
|
78
|
+
/** Fires when scroll position exits the trigger zone at the end (scrolling forward). */
|
|
79
|
+
onLeave?: () => void;
|
|
80
|
+
/** Fires when scroll position re-enters the trigger zone from the end (scrolling back). */
|
|
81
|
+
onEnterBack?: () => void;
|
|
82
|
+
/** Fires when scroll position exits the trigger zone at the start (scrolling back). */
|
|
83
|
+
onLeaveBack?: () => void;
|
|
76
84
|
/**
|
|
77
85
|
* Trigger the animation when the element enters the viewport instead of
|
|
78
86
|
* tying it to scroll position. The draw runs over `duration` milliseconds,
|
|
@@ -108,6 +116,67 @@ interface ScrollDrawOptions {
|
|
|
108
116
|
native?: boolean;
|
|
109
117
|
}
|
|
110
118
|
|
|
119
|
+
interface ScrollAnimateOptions {
|
|
120
|
+
props: Record<string, string | number | [string | number, string | number]>;
|
|
121
|
+
trigger?: TriggerConfig;
|
|
122
|
+
easing?: EasingName | ((t: number) => number);
|
|
123
|
+
speed?: number;
|
|
124
|
+
once?: boolean;
|
|
125
|
+
axis?: 'x' | 'y';
|
|
126
|
+
scrollContainer?: string | Element;
|
|
127
|
+
native?: boolean;
|
|
128
|
+
onProgress?: (alpha: number) => void;
|
|
129
|
+
onComplete?: () => void;
|
|
130
|
+
/** Fires when scroll enters the trigger zone (scrolling forward). */
|
|
131
|
+
onEnter?: () => void;
|
|
132
|
+
/** Fires when scroll exits the trigger zone at the end (scrolling forward). */
|
|
133
|
+
onLeave?: () => void;
|
|
134
|
+
/** Fires when scroll re-enters the trigger zone from the end (scrolling back). */
|
|
135
|
+
onEnterBack?: () => void;
|
|
136
|
+
/** Fires when scroll exits the trigger zone at the start (scrolling back). */
|
|
137
|
+
onLeaveBack?: () => void;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
interface ScrollCounterOptions {
|
|
141
|
+
from?: number;
|
|
142
|
+
to: number;
|
|
143
|
+
format?: (value: number) => string;
|
|
144
|
+
easing?: EasingName | ((t: number) => number);
|
|
145
|
+
trigger?: TriggerConfig;
|
|
146
|
+
once?: boolean;
|
|
147
|
+
decimals?: number;
|
|
148
|
+
onComplete?: () => void;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
interface ScrollVideoOptions {
|
|
152
|
+
trigger?: TriggerConfig;
|
|
153
|
+
from?: number;
|
|
154
|
+
to?: number;
|
|
155
|
+
easing?: EasingName | ((t: number) => number);
|
|
156
|
+
once?: boolean;
|
|
157
|
+
axis?: 'x' | 'y';
|
|
158
|
+
preload?: 'auto' | 'metadata';
|
|
159
|
+
onReady?: () => void;
|
|
160
|
+
onComplete?: () => void;
|
|
161
|
+
onProgress?: (alpha: number) => void;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
interface ScrollTextOptions {
|
|
165
|
+
split?: 'chars' | 'words' | 'lines';
|
|
166
|
+
stagger?: number;
|
|
167
|
+
easing?: EasingName | ((t: number) => number);
|
|
168
|
+
from?: {
|
|
169
|
+
opacity?: number;
|
|
170
|
+
y?: number;
|
|
171
|
+
x?: number;
|
|
172
|
+
rotate?: number;
|
|
173
|
+
scale?: number;
|
|
174
|
+
};
|
|
175
|
+
trigger?: TriggerConfig;
|
|
176
|
+
once?: boolean;
|
|
177
|
+
onComplete?: () => void;
|
|
178
|
+
}
|
|
179
|
+
|
|
111
180
|
/** Composable — attach to any container ref. */
|
|
112
181
|
declare function useScrollDraw(options?: ScrollDrawOptions): vue.Ref<HTMLElement | null, HTMLElement | null>;
|
|
113
182
|
/** Component — wraps children in a <div> and initialises the engine. */
|
|
@@ -192,5 +261,213 @@ declare const ScrollDraw: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
192
261
|
once: boolean;
|
|
193
262
|
debug: boolean;
|
|
194
263
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
264
|
+
/**
|
|
265
|
+
* Composable — call with a full options object and bind the returned ref to
|
|
266
|
+
* whichever element you want to animate.
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* <script setup>
|
|
270
|
+
* import { useScrollAnimate } from 'svg-scroll-draw/vue';
|
|
271
|
+
* const el = useScrollAnimate({ props: { opacity: [0, 1] }, easing: 'ease-out', once: true });
|
|
272
|
+
* </script>
|
|
273
|
+
* <div :ref="el">...</div>
|
|
274
|
+
*/
|
|
275
|
+
declare function useScrollAnimate(options: ScrollAnimateOptions): vue.Ref<HTMLElement | null, HTMLElement | null>;
|
|
276
|
+
/**
|
|
277
|
+
* Component — accepts a single `:options` prop and wraps children in a <div>.
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* <ScrollAnimate :options="{ props: { opacity: [0, 1] }, easing: 'ease-out' }">
|
|
281
|
+
* <div>...</div>
|
|
282
|
+
* </ScrollAnimate>
|
|
283
|
+
*/
|
|
284
|
+
declare const ScrollAnimate: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
285
|
+
options: {
|
|
286
|
+
type: () => ScrollAnimateOptions;
|
|
287
|
+
required: true;
|
|
288
|
+
};
|
|
289
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
290
|
+
[key: string]: any;
|
|
291
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
292
|
+
options: {
|
|
293
|
+
type: () => ScrollAnimateOptions;
|
|
294
|
+
required: true;
|
|
295
|
+
};
|
|
296
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
297
|
+
/**
|
|
298
|
+
* Composable — returns a ref to bind to a span/element that will count up on scroll.
|
|
299
|
+
*
|
|
300
|
+
* @example
|
|
301
|
+
* <script setup>
|
|
302
|
+
* import { useScrollCounter } from 'svg-scroll-draw/vue';
|
|
303
|
+
* const el = useScrollCounter({ to: 1000, easing: 'ease-out', once: true });
|
|
304
|
+
* </script>
|
|
305
|
+
* <span :ref="el" />
|
|
306
|
+
*/
|
|
307
|
+
declare function useScrollCounter(options: ScrollCounterOptions): vue.Ref<HTMLElement | null, HTMLElement | null>;
|
|
308
|
+
/**
|
|
309
|
+
* Component — renders a <span> that counts from `from` to `to` on scroll.
|
|
310
|
+
*
|
|
311
|
+
* @example
|
|
312
|
+
* <ScrollCounter :to="1250000" :format="n => '$' + Math.round(n).toLocaleString()" />
|
|
313
|
+
*/
|
|
314
|
+
declare const ScrollCounter: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
315
|
+
to: {
|
|
316
|
+
type: NumberConstructor;
|
|
317
|
+
required: true;
|
|
318
|
+
};
|
|
319
|
+
from: {
|
|
320
|
+
type: NumberConstructor;
|
|
321
|
+
};
|
|
322
|
+
format: {
|
|
323
|
+
type: () => ScrollCounterOptions["format"];
|
|
324
|
+
};
|
|
325
|
+
easing: {
|
|
326
|
+
type: (StringConstructor | FunctionConstructor)[];
|
|
327
|
+
};
|
|
328
|
+
trigger: {
|
|
329
|
+
type: ObjectConstructor;
|
|
330
|
+
};
|
|
331
|
+
once: {
|
|
332
|
+
type: BooleanConstructor;
|
|
333
|
+
};
|
|
334
|
+
decimals: {
|
|
335
|
+
type: NumberConstructor;
|
|
336
|
+
};
|
|
337
|
+
onComplete: {
|
|
338
|
+
type: FunctionConstructor;
|
|
339
|
+
};
|
|
340
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
341
|
+
[key: string]: any;
|
|
342
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
343
|
+
to: {
|
|
344
|
+
type: NumberConstructor;
|
|
345
|
+
required: true;
|
|
346
|
+
};
|
|
347
|
+
from: {
|
|
348
|
+
type: NumberConstructor;
|
|
349
|
+
};
|
|
350
|
+
format: {
|
|
351
|
+
type: () => ScrollCounterOptions["format"];
|
|
352
|
+
};
|
|
353
|
+
easing: {
|
|
354
|
+
type: (StringConstructor | FunctionConstructor)[];
|
|
355
|
+
};
|
|
356
|
+
trigger: {
|
|
357
|
+
type: ObjectConstructor;
|
|
358
|
+
};
|
|
359
|
+
once: {
|
|
360
|
+
type: BooleanConstructor;
|
|
361
|
+
};
|
|
362
|
+
decimals: {
|
|
363
|
+
type: NumberConstructor;
|
|
364
|
+
};
|
|
365
|
+
onComplete: {
|
|
366
|
+
type: FunctionConstructor;
|
|
367
|
+
};
|
|
368
|
+
}>> & Readonly<{}>, {
|
|
369
|
+
once: boolean;
|
|
370
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
371
|
+
/**
|
|
372
|
+
* Composable — returns a ref to bind to a <video> element.
|
|
373
|
+
*
|
|
374
|
+
* @example
|
|
375
|
+
* <script setup>
|
|
376
|
+
* import { useScrollVideo } from 'svg-scroll-draw/vue';
|
|
377
|
+
* const vid = useScrollVideo({ trigger: { start: 'top top', end: 'bottom top' } });
|
|
378
|
+
* </script>
|
|
379
|
+
* <video :ref="vid" src="..." muted playsinline preload="auto" />
|
|
380
|
+
*/
|
|
381
|
+
declare function useScrollVideo(options?: ScrollVideoOptions): vue.Ref<HTMLVideoElement | null, HTMLVideoElement | null>;
|
|
382
|
+
/**
|
|
383
|
+
* Component — renders a <video> scrubbed by scroll position.
|
|
384
|
+
*
|
|
385
|
+
* @example
|
|
386
|
+
* <ScrollVideo src="/hero.mp4" :options="{ trigger: { start: 'top top', end: 'bottom top' } }" />
|
|
387
|
+
*/
|
|
388
|
+
declare const ScrollVideo: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
389
|
+
src: {
|
|
390
|
+
type: StringConstructor;
|
|
391
|
+
required: true;
|
|
392
|
+
};
|
|
393
|
+
options: {
|
|
394
|
+
type: () => ScrollVideoOptions;
|
|
395
|
+
};
|
|
396
|
+
muted: {
|
|
397
|
+
type: BooleanConstructor;
|
|
398
|
+
default: boolean;
|
|
399
|
+
};
|
|
400
|
+
playsInline: {
|
|
401
|
+
type: BooleanConstructor;
|
|
402
|
+
default: boolean;
|
|
403
|
+
};
|
|
404
|
+
class: {
|
|
405
|
+
type: StringConstructor;
|
|
406
|
+
};
|
|
407
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
408
|
+
[key: string]: any;
|
|
409
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
410
|
+
src: {
|
|
411
|
+
type: StringConstructor;
|
|
412
|
+
required: true;
|
|
413
|
+
};
|
|
414
|
+
options: {
|
|
415
|
+
type: () => ScrollVideoOptions;
|
|
416
|
+
};
|
|
417
|
+
muted: {
|
|
418
|
+
type: BooleanConstructor;
|
|
419
|
+
default: boolean;
|
|
420
|
+
};
|
|
421
|
+
playsInline: {
|
|
422
|
+
type: BooleanConstructor;
|
|
423
|
+
default: boolean;
|
|
424
|
+
};
|
|
425
|
+
class: {
|
|
426
|
+
type: StringConstructor;
|
|
427
|
+
};
|
|
428
|
+
}>> & Readonly<{}>, {
|
|
429
|
+
muted: boolean;
|
|
430
|
+
playsInline: boolean;
|
|
431
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
432
|
+
/**
|
|
433
|
+
* Composable — returns a ref to bind to any text element; splits and animates on scroll.
|
|
434
|
+
*
|
|
435
|
+
* @example
|
|
436
|
+
* <script setup>
|
|
437
|
+
* import { useScrollText } from 'svg-scroll-draw/vue';
|
|
438
|
+
* const el = useScrollText({ split: 'words', stagger: 0.05, once: true });
|
|
439
|
+
* </script>
|
|
440
|
+
* <h2 :ref="el">Animate on scroll.</h2>
|
|
441
|
+
*/
|
|
442
|
+
declare function useScrollText(options?: ScrollTextOptions): vue.Ref<HTMLElement | null, HTMLElement | null>;
|
|
443
|
+
/**
|
|
444
|
+
* Component — wraps text content in a <p> (or any tag) and animates it on scroll.
|
|
445
|
+
*
|
|
446
|
+
* @example
|
|
447
|
+
* <ScrollText :options="{ split: 'words', stagger: 0.05 }" tag="h2">
|
|
448
|
+
* Animate on scroll.
|
|
449
|
+
* </ScrollText>
|
|
450
|
+
*/
|
|
451
|
+
declare const ScrollText: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
452
|
+
options: {
|
|
453
|
+
type: () => ScrollTextOptions;
|
|
454
|
+
};
|
|
455
|
+
tag: {
|
|
456
|
+
type: StringConstructor;
|
|
457
|
+
default: string;
|
|
458
|
+
};
|
|
459
|
+
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
460
|
+
[key: string]: any;
|
|
461
|
+
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
462
|
+
options: {
|
|
463
|
+
type: () => ScrollTextOptions;
|
|
464
|
+
};
|
|
465
|
+
tag: {
|
|
466
|
+
type: StringConstructor;
|
|
467
|
+
default: string;
|
|
468
|
+
};
|
|
469
|
+
}>> & Readonly<{}>, {
|
|
470
|
+
tag: string;
|
|
471
|
+
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
195
472
|
|
|
196
|
-
export { ScrollDraw, type ScrollDrawOptions, useScrollDraw };
|
|
473
|
+
export { ScrollAnimate, type ScrollAnimateOptions, ScrollCounter, type ScrollCounterOptions, ScrollDraw, type ScrollDrawOptions, ScrollText, type ScrollTextOptions, ScrollVideo, type ScrollVideoOptions, useScrollAnimate, useScrollCounter, useScrollDraw, useScrollText, useScrollVideo };
|