motionary 0.0.0-stage → 6.2.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/CHANGELOG.md +803 -0
- package/LICENSE +21 -0
- package/README.md +218 -2
- package/README_ja.md +219 -0
- package/README_zh.md +219 -0
- package/bin/usa-codemod-5.mjs +79 -0
- package/bin/usa-codemod-6.mjs +146 -0
- package/dist/chunks/base-BaQV-2ha.cjs +436 -0
- package/dist/chunks/base-BaQV-2ha.cjs.map +1 -0
- package/dist/chunks/base-C_3cAoRz.js +404 -0
- package/dist/chunks/base-C_3cAoRz.js.map +1 -0
- package/dist/chunks/bind-B_CTL6Qn.js +22 -0
- package/dist/chunks/bind-B_CTL6Qn.js.map +1 -0
- package/dist/chunks/bind-Ui43-n2d.cjs +25 -0
- package/dist/chunks/bind-Ui43-n2d.cjs.map +1 -0
- package/dist/chunks/core-B5T0dhFH.cjs +920 -0
- package/dist/chunks/core-B5T0dhFH.cjs.map +1 -0
- package/dist/chunks/core-BGAyaY6L.cjs +265 -0
- package/dist/chunks/core-BGAyaY6L.cjs.map +1 -0
- package/dist/chunks/core-D7cVumUu.js +909 -0
- package/dist/chunks/core-D7cVumUu.js.map +1 -0
- package/dist/chunks/core-VEBw36QK.js +260 -0
- package/dist/chunks/core-VEBw36QK.js.map +1 -0
- package/dist/chunks/core-ps8uvYuN.js +181 -0
- package/dist/chunks/core-ps8uvYuN.js.map +1 -0
- package/dist/chunks/core-zq17EeCI.cjs +185 -0
- package/dist/chunks/core-zq17EeCI.cjs.map +1 -0
- package/dist/chunks/fx-Bs6IrV4Q.js +109 -0
- package/dist/chunks/fx-Bs6IrV4Q.js.map +1 -0
- package/dist/chunks/fx-lBGVtQO1.cjs +114 -0
- package/dist/chunks/fx-lBGVtQO1.cjs.map +1 -0
- package/dist/chunks/generative-D2YyhaeO.js +336 -0
- package/dist/chunks/generative-D2YyhaeO.js.map +1 -0
- package/dist/chunks/generative-DzIZq-_g.cjs +348 -0
- package/dist/chunks/generative-DzIZq-_g.cjs.map +1 -0
- package/dist/chunks/gpu-Bu7qwugO.js +380 -0
- package/dist/chunks/gpu-Bu7qwugO.js.map +1 -0
- package/dist/chunks/gpu-CenK2l6b.cjs +387 -0
- package/dist/chunks/gpu-CenK2l6b.cjs.map +1 -0
- package/dist/chunks/index-tags-DucKMQr_.js +26 -0
- package/dist/chunks/index-tags-DucKMQr_.js.map +1 -0
- package/dist/chunks/index-tags-wv0R_vkO.cjs +28 -0
- package/dist/chunks/index-tags-wv0R_vkO.cjs.map +1 -0
- package/dist/chunks/presets-BYBVJVeP.js +226 -0
- package/dist/chunks/presets-BYBVJVeP.js.map +1 -0
- package/dist/chunks/presets-CUHys3sK.cjs +233 -0
- package/dist/chunks/presets-CUHys3sK.cjs.map +1 -0
- package/dist/chunks/registry-CKNLQpwd.js +121 -0
- package/dist/chunks/registry-CKNLQpwd.js.map +1 -0
- package/dist/chunks/registry-DehBVRDV.cjs +131 -0
- package/dist/chunks/registry-DehBVRDV.cjs.map +1 -0
- package/dist/chunks/spring-CbvHfVtP.js +219 -0
- package/dist/chunks/spring-CbvHfVtP.js.map +1 -0
- package/dist/chunks/spring-Dgx187Vh.cjs +232 -0
- package/dist/chunks/spring-Dgx187Vh.cjs.map +1 -0
- package/dist/chunks/stagger-CCFyhzSw.cjs +86 -0
- package/dist/chunks/stagger-CCFyhzSw.cjs.map +1 -0
- package/dist/chunks/stagger-DtMKo2SK.js +84 -0
- package/dist/chunks/stagger-DtMKo2SK.js.map +1 -0
- package/dist/chunks/variants-BhjyddG8.cjs +39 -0
- package/dist/chunks/variants-BhjyddG8.cjs.map +1 -0
- package/dist/chunks/variants-DRlKVHvu.js +35 -0
- package/dist/chunks/variants-DRlKVHvu.js.map +1 -0
- package/dist/components/a11y.cjs +276 -0
- package/dist/components/a11y.cjs.map +1 -0
- package/dist/components/a11y.d.cts +131 -0
- package/dist/components/a11y.d.ts +131 -0
- package/dist/components/a11y.js +259 -0
- package/dist/components/a11y.js.map +1 -0
- package/dist/components/angular.cjs +76 -0
- package/dist/components/angular.cjs.map +1 -0
- package/dist/components/angular.d.cts +1734 -0
- package/dist/components/angular.d.ts +1734 -0
- package/dist/components/angular.js +70 -0
- package/dist/components/angular.js.map +1 -0
- package/dist/components/background.cjs +659 -0
- package/dist/components/background.cjs.map +1 -0
- package/dist/components/background.css +9 -0
- package/dist/components/background.d.cts +166 -0
- package/dist/components/background.d.ts +166 -0
- package/dist/components/background.js +647 -0
- package/dist/components/background.js.map +1 -0
- package/dist/components/bridge.cjs +154 -0
- package/dist/components/bridge.cjs.map +1 -0
- package/dist/components/bridge.d.cts +63 -0
- package/dist/components/bridge.d.ts +63 -0
- package/dist/components/bridge.js +147 -0
- package/dist/components/bridge.js.map +1 -0
- package/dist/components/cards.cjs +561 -0
- package/dist/components/cards.cjs.map +1 -0
- package/dist/components/cards.css +6 -0
- package/dist/components/cards.d.cts +115 -0
- package/dist/components/cards.d.ts +115 -0
- package/dist/components/cards.js +554 -0
- package/dist/components/cards.js.map +1 -0
- package/dist/components/click.cjs +877 -0
- package/dist/components/click.cjs.map +1 -0
- package/dist/components/click.css +9 -0
- package/dist/components/click.d.cts +218 -0
- package/dist/components/click.d.ts +218 -0
- package/dist/components/click.js +863 -0
- package/dist/components/click.js.map +1 -0
- package/dist/components/depth.cjs +250 -0
- package/dist/components/depth.cjs.map +1 -0
- package/dist/components/depth.css +3 -0
- package/dist/components/depth.d.cts +86 -0
- package/dist/components/depth.d.ts +86 -0
- package/dist/components/depth.js +242 -0
- package/dist/components/depth.js.map +1 -0
- package/dist/components/effects.cjs +2258 -0
- package/dist/components/effects.cjs.map +1 -0
- package/dist/components/effects.d.cts +545 -0
- package/dist/components/effects.d.ts +545 -0
- package/dist/components/effects.js +2200 -0
- package/dist/components/effects.js.map +1 -0
- package/dist/components/feedback.cjs +442 -0
- package/dist/components/feedback.cjs.map +1 -0
- package/dist/components/feedback.css +7 -0
- package/dist/components/feedback.d.cts +144 -0
- package/dist/components/feedback.d.ts +144 -0
- package/dist/components/feedback.js +433 -0
- package/dist/components/feedback.js.map +1 -0
- package/dist/components/fx-gpu.cjs +12 -0
- package/dist/components/fx-gpu.cjs.map +1 -0
- package/dist/components/fx-gpu.d.cts +63 -0
- package/dist/components/fx-gpu.d.ts +63 -0
- package/dist/components/fx-gpu.js +5 -0
- package/dist/components/fx-gpu.js.map +1 -0
- package/dist/components/fx.cjs +169 -0
- package/dist/components/fx.cjs.map +1 -0
- package/dist/components/fx.css +3 -0
- package/dist/components/fx.d.cts +114 -0
- package/dist/components/fx.d.ts +114 -0
- package/dist/components/fx.js +156 -0
- package/dist/components/fx.js.map +1 -0
- package/dist/components/fx2.cjs +25 -0
- package/dist/components/fx2.cjs.map +1 -0
- package/dist/components/fx2.d.cts +136 -0
- package/dist/components/fx2.d.ts +136 -0
- package/dist/components/fx2.js +17 -0
- package/dist/components/fx2.js.map +1 -0
- package/dist/components/gesture.cjs +209 -0
- package/dist/components/gesture.cjs.map +1 -0
- package/dist/components/gesture.css +3 -0
- package/dist/components/gesture.d.cts +134 -0
- package/dist/components/gesture.d.ts +134 -0
- package/dist/components/gesture.js +203 -0
- package/dist/components/gesture.js.map +1 -0
- package/dist/components/interaction.cjs +424 -0
- package/dist/components/interaction.cjs.map +1 -0
- package/dist/components/interaction.css +8 -0
- package/dist/components/interaction.d.cts +115 -0
- package/dist/components/interaction.d.ts +115 -0
- package/dist/components/interaction.js +416 -0
- package/dist/components/interaction.js.map +1 -0
- package/dist/components/jsx.cjs +3 -0
- package/dist/components/jsx.cjs.map +1 -0
- package/dist/components/jsx.d.cts +53 -0
- package/dist/components/jsx.d.ts +53 -0
- package/dist/components/jsx.js +2 -0
- package/dist/components/jsx.js.map +1 -0
- package/dist/components/layout.cjs +257 -0
- package/dist/components/layout.cjs.map +1 -0
- package/dist/components/layout.css +3 -0
- package/dist/components/layout.d.cts +99 -0
- package/dist/components/layout.d.ts +99 -0
- package/dist/components/layout.js +249 -0
- package/dist/components/layout.js.map +1 -0
- package/dist/components/lazy.cjs +92 -0
- package/dist/components/lazy.cjs.map +1 -0
- package/dist/components/lazy.d.cts +48 -0
- package/dist/components/lazy.d.ts +48 -0
- package/dist/components/lazy.js +87 -0
- package/dist/components/lazy.js.map +1 -0
- package/dist/components/lite.cjs +11095 -0
- package/dist/components/lite.cjs.map +1 -0
- package/dist/components/lite.d.cts +4 -0
- package/dist/components/lite.d.ts +4 -0
- package/dist/components/lite.js +10827 -0
- package/dist/components/lite.js.map +1 -0
- package/dist/components/packs.cjs +192 -0
- package/dist/components/packs.cjs.map +1 -0
- package/dist/components/packs.css +3 -0
- package/dist/components/packs.d.cts +72 -0
- package/dist/components/packs.d.ts +72 -0
- package/dist/components/packs.js +184 -0
- package/dist/components/packs.js.map +1 -0
- package/dist/components/page.cjs +824 -0
- package/dist/components/page.cjs.map +1 -0
- package/dist/components/page.css +11 -0
- package/dist/components/page.d.cts +249 -0
- package/dist/components/page.d.ts +249 -0
- package/dist/components/page.js +799 -0
- package/dist/components/page.js.map +1 -0
- package/dist/components/perf.cjs +120 -0
- package/dist/components/perf.cjs.map +1 -0
- package/dist/components/perf.d.cts +98 -0
- package/dist/components/perf.d.ts +98 -0
- package/dist/components/perf.js +110 -0
- package/dist/components/perf.js.map +1 -0
- package/dist/components/physics.cjs +448 -0
- package/dist/components/physics.cjs.map +1 -0
- package/dist/components/physics.css +5 -0
- package/dist/components/physics.d.cts +189 -0
- package/dist/components/physics.d.ts +189 -0
- package/dist/components/physics.js +430 -0
- package/dist/components/physics.js.map +1 -0
- package/dist/components/react.cjs +96 -0
- package/dist/components/react.cjs.map +1 -0
- package/dist/components/react.d.cts +18 -0
- package/dist/components/react.d.ts +18 -0
- package/dist/components/react.js +91 -0
- package/dist/components/react.js.map +1 -0
- package/dist/components/reveal.cjs +362 -0
- package/dist/components/reveal.cjs.map +1 -0
- package/dist/components/reveal.css +5 -0
- package/dist/components/reveal.d.cts +105 -0
- package/dist/components/reveal.d.ts +105 -0
- package/dist/components/reveal.js +353 -0
- package/dist/components/reveal.js.map +1 -0
- package/dist/components/solid.cjs +86 -0
- package/dist/components/solid.cjs.map +1 -0
- package/dist/components/solid.d.cts +1751 -0
- package/dist/components/solid.d.ts +1751 -0
- package/dist/components/solid.js +82 -0
- package/dist/components/solid.js.map +1 -0
- package/dist/components/svelte.cjs +68 -0
- package/dist/components/svelte.cjs.map +1 -0
- package/dist/components/svelte.d.cts +1733 -0
- package/dist/components/svelte.d.ts +1733 -0
- package/dist/components/svelte.js +64 -0
- package/dist/components/svelte.js.map +1 -0
- package/dist/components/svg.cjs +359 -0
- package/dist/components/svg.cjs.map +1 -0
- package/dist/components/svg.css +3 -0
- package/dist/components/svg.d.cts +113 -0
- package/dist/components/svg.d.ts +113 -0
- package/dist/components/svg.js +347 -0
- package/dist/components/svg.js.map +1 -0
- package/dist/components/text.cjs +968 -0
- package/dist/components/text.cjs.map +1 -0
- package/dist/components/text.css +8 -0
- package/dist/components/text.d.cts +342 -0
- package/dist/components/text.d.ts +342 -0
- package/dist/components/text.js +947 -0
- package/dist/components/text.js.map +1 -0
- package/dist/components/timeline.cjs +109 -0
- package/dist/components/timeline.cjs.map +1 -0
- package/dist/components/timeline.css +3 -0
- package/dist/components/timeline.d.cts +155 -0
- package/dist/components/timeline.d.ts +155 -0
- package/dist/components/timeline.js +103 -0
- package/dist/components/timeline.js.map +1 -0
- package/dist/components/tokens.cjs +226 -0
- package/dist/components/tokens.cjs.map +1 -0
- package/dist/components/tokens.d.cts +74 -0
- package/dist/components/tokens.d.ts +74 -0
- package/dist/components/tokens.js +211 -0
- package/dist/components/tokens.js.map +1 -0
- package/dist/components/transitions.cjs +430 -0
- package/dist/components/transitions.cjs.map +1 -0
- package/dist/components/transitions.css +5 -0
- package/dist/components/transitions.d.cts +126 -0
- package/dist/components/transitions.d.ts +126 -0
- package/dist/components/transitions.js +423 -0
- package/dist/components/transitions.js.map +1 -0
- package/dist/components/ui.cjs +1050 -0
- package/dist/components/ui.cjs.map +1 -0
- package/dist/components/ui.css +14 -0
- package/dist/components/ui.d.cts +224 -0
- package/dist/components/ui.d.ts +224 -0
- package/dist/components/ui.js +1034 -0
- package/dist/components/ui.js.map +1 -0
- package/dist/components/vue.cjs +67 -0
- package/dist/components/vue.cjs.map +1 -0
- package/dist/components/vue.d.cts +1722 -0
- package/dist/components/vue.d.ts +1722 -0
- package/dist/components/vue.js +64 -0
- package/dist/components/vue.js.map +1 -0
- package/dist/components/webgl.cjs +459 -0
- package/dist/components/webgl.cjs.map +1 -0
- package/dist/components/webgl.css +3 -0
- package/dist/components/webgl.d.cts +133 -0
- package/dist/components/webgl.d.ts +133 -0
- package/dist/components/webgl.js +442 -0
- package/dist/components/webgl.js.map +1 -0
- package/dist/components/widgets.cjs +591 -0
- package/dist/components/widgets.cjs.map +1 -0
- package/dist/components/widgets.d.cts +110 -0
- package/dist/components/widgets.d.ts +110 -0
- package/dist/components/widgets.js +581 -0
- package/dist/components/widgets.js.map +1 -0
- package/dist/components.cjs +351 -0
- package/dist/components.cjs.map +1 -0
- package/dist/components.css +75 -0
- package/dist/components.d.cts +2997 -0
- package/dist/components.d.ts +2997 -0
- package/dist/components.js +106 -0
- package/dist/components.js.map +1 -0
- package/dist/components.umd.js +23 -0
- package/dist/components.umd.js.map +1 -0
- package/dist/element.cjs +97 -0
- package/dist/element.cjs.map +1 -0
- package/dist/element.d.cts +215 -0
- package/dist/element.d.ts +215 -0
- package/dist/element.js +95 -0
- package/dist/element.js.map +1 -0
- package/dist/element.umd.js +2 -0
- package/dist/element.umd.js.map +1 -0
- package/dist/index.cjs +149 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +425 -0
- package/dist/index.d.ts +425 -0
- package/dist/index.js +131 -0
- package/dist/index.js.map +1 -0
- package/dist/index.umd.js +15 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/presets/extended.cjs +243 -0
- package/dist/presets/extended.cjs.map +1 -0
- package/dist/presets/extended.d.cts +37 -0
- package/dist/presets/extended.d.ts +37 -0
- package/dist/presets/extended.js +239 -0
- package/dist/presets/extended.js.map +1 -0
- package/dist/presets-extended.umd.js +2 -0
- package/dist/presets-extended.umd.js.map +1 -0
- package/dist/react.cjs +68 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +158 -0
- package/dist/react.d.ts +158 -0
- package/dist/react.js +65 -0
- package/dist/react.js.map +1 -0
- package/dist/solid.cjs +93 -0
- package/dist/solid.cjs.map +1 -0
- package/dist/solid.d.cts +249 -0
- package/dist/solid.d.ts +249 -0
- package/dist/solid.js +89 -0
- package/dist/solid.js.map +1 -0
- package/dist/svelte.cjs +66 -0
- package/dist/svelte.cjs.map +1 -0
- package/dist/svelte.d.cts +243 -0
- package/dist/svelte.d.ts +243 -0
- package/dist/svelte.js +63 -0
- package/dist/svelte.js.map +1 -0
- package/dist/vue.cjs +62 -0
- package/dist/vue.cjs.map +1 -0
- package/dist/vue.d.cts +158 -0
- package/dist/vue.d.ts +158 -0
- package/dist/vue.js +60 -0
- package/dist/vue.js.map +1 -0
- package/dist/widgets.umd.js +2 -0
- package/dist/widgets.umd.js.map +1 -0
- package/docs/API.md +147 -0
- package/docs/ROADMAP.md +14 -0
- package/docs/accessibility.md +60 -0
- package/docs/components.md +564 -0
- package/docs/deprecations.md +30 -0
- package/docs/frameworks-ssr.md +100 -0
- package/docs/hybrid-apps.md +145 -0
- package/docs/images/showcase-detail.png +0 -0
- package/docs/images/showcase-grid.png +0 -0
- package/docs/images/showcase-mobile.png +0 -0
- package/docs/migration-from-aos.md +67 -0
- package/docs/migration-from-gsap-scrolltrigger.md +80 -0
- package/docs/motion-tokens.css +31 -0
- package/docs/motion-tokens.md +46 -0
- package/docs/motion.tokens.json +132 -0
- package/docs/performance.md +24 -0
- package/docs/presets.md +310 -0
- package/docs/upgrading-3.md +21 -0
- package/docs/upgrading-4.md +65 -0
- package/docs/upgrading-5.md +31 -0
- package/docs/upgrading-6.md +32 -0
- package/docs/windows-apps.md +119 -0
- package/package.json +562 -4
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* motionary - Core Type Definitions
|
|
3
|
+
* A lightweight, high-performance scroll animation library
|
|
4
|
+
*/
|
|
5
|
+
/** The 33 core presets (always available in `PRESETS`). */
|
|
6
|
+
type CorePreset = 'fade-in' | 'fade-in-up' | 'fade-in-down' | 'fade-in-left' | 'fade-in-right' | 'zoom-in' | 'zoom-out' | 'flip-x' | 'flip-y' | 'slide-up' | 'slide-down' | 'slide-left' | 'slide-right' | 'bounce' | 'rotate-in' | 'blur-in' | 'skew-in' | 'scale-x' | 'scale-y' | 'shimmer' | 'pulse' | 'swing' | 'scale-up' | 'blur-in-up' | 'flip-up' | 'flip-down' | 'rotate-left' | 'rotate-right' | 'clip-up' | 'clip-down' | 'clip-left' | 'clip-right' | 'clip-circle';
|
|
7
|
+
/**
|
|
8
|
+
* Every built-in preset name: the core set plus the 6.1 extended set, which is
|
|
9
|
+
* available once `motionary/presets/extended` is loaded (or after
|
|
10
|
+
* `registerPresets(EXTENDED_PRESETS)`).
|
|
11
|
+
*/
|
|
12
|
+
type AnimationPreset = CorePreset | ExtendedPreset;
|
|
13
|
+
/**
|
|
14
|
+
* How `onProgress` / `progressVar` progress is measured.
|
|
15
|
+
* - `'ratio'` (default): the element's visible ratio (IntersectionObserver `intersectionRatio`).
|
|
16
|
+
* - `'scroll'`: true scroll progress, 0 when the element's top touches the bottom of the
|
|
17
|
+
* viewport and 1 when its bottom leaves the top. Works for elements taller than the screen.
|
|
18
|
+
*/
|
|
19
|
+
type ProgressMode = 'ratio' | 'scroll';
|
|
20
|
+
/**
|
|
21
|
+
* Which engine runs the entrance animation.
|
|
22
|
+
* - `'js'`: IntersectionObserver triggers a time-based Web Animation.
|
|
23
|
+
* - `'css'`: the preset runs on the browser's native scroll-driven timeline
|
|
24
|
+
* (`animation-timeline: view()`), so its progress follows the scroll position
|
|
25
|
+
* off the main thread. Falls back to `'js'` where unsupported.
|
|
26
|
+
* - `'auto'` (default since 2.0): native when supported, JS otherwise — and JS
|
|
27
|
+
* whenever the element sets `duration`, `delay`, `offset` or `stagger` itself,
|
|
28
|
+
* since those only mean something for a time-based animation.
|
|
29
|
+
*/
|
|
30
|
+
type ScrollEngine = 'auto' | 'js' | 'css';
|
|
31
|
+
/** The 6.1 extended presets (`motionary/presets/extended`). */
|
|
32
|
+
type ExtendedPreset = 'fade-in-up-sm' | 'fade-in-down-sm' | 'fade-in-left-sm' | 'fade-in-right-sm' | 'fade-in-up-lg' | 'fade-in-down-lg' | 'fade-in-left-lg' | 'fade-in-right-lg' | 'fade-in-up-left' | 'fade-in-up-right' | 'fade-in-down-left' | 'fade-in-down-right' | 'fade-in-scale' | 'fade-in-half' | 'zoom-in-up' | 'zoom-in-down' | 'zoom-in-left' | 'zoom-in-right' | 'zoom-out-up' | 'zoom-out-down' | 'zoom-out-left' | 'zoom-out-right' | 'zoom-in-big' | 'zoom-out-big' | 'zoom-bounce' | 'zoom-in-rotate' | 'scale-x-left' | 'scale-x-right' | 'scale-y-top' | 'scale-y-bottom' | 'stretch-x' | 'stretch-y' | 'flip-x-reverse' | 'flip-y-reverse' | 'flip-y-full' | 'flip-diagonal' | 'flip-diagonal-reverse' | 'flip-left' | 'flip-right' | 'unfold-down' | 'unfold-up' | 'door-open-left' | 'door-open-right' | 'fold-in' | 'flip-x-bounce' | 'flip-y-bounce' | 'swing-in-top' | 'swing-in-bottom' | 'swing-in-left' | 'swing-in-right' | 'slide-up-spring' | 'slide-down-spring' | 'slide-left-spring' | 'slide-right-spring' | 'slide-up-sm' | 'slide-down-sm' | 'back-in-up' | 'back-in-down' | 'back-in-left' | 'back-in-right' | 'light-speed-in-left' | 'light-speed-in-right' | 'rise-in' | 'sink-in' | 'float-in-up' | 'float-in-down' | 'roll-in-left' | 'roll-in-right' | 'spiral-in' | 'spiral-in-reverse' | 'spin-in' | 'rotate-in-up-left' | 'rotate-in-up-right' | 'rotate-in-down-left' | 'rotate-in-down-right' | 'skew-in-left' | 'skew-in-y' | 'shear-in' | 'shear-in-reverse' | 'twist-in' | 'tilt-in-left' | 'tilt-in-right' | 'blur-in-down' | 'blur-in-left' | 'blur-in-right' | 'blur-in-strong' | 'blur-in-zoom' | 'blur-in-scale' | 'blur-in-x' | 'mask-up' | 'mask-down' | 'mask-left' | 'mask-right' | 'blur-mask-up' | 'clip-circle-top' | 'clip-circle-bottom' | 'clip-circle-left' | 'clip-circle-right' | 'clip-circle-corner' | 'clip-ellipse' | 'clip-diamond' | 'clip-split-x' | 'clip-split-y' | 'clip-box' | 'clip-pill' | 'clip-blinds' | 'clip-blinds-x' | 'clip-diagonal' | 'clip-diagonal-reverse' | 'clip-slant-right' | 'clip-slant-left' | 'bounce-in' | 'bounce-in-up' | 'bounce-in-down' | 'bounce-in-left' | 'bounce-in-right' | 'elastic-in' | 'elastic-in-x' | 'rubber-in' | 'jello-in' | 'wobble-in' | 'tada-in' | 'heartbeat-in' | 'drop-in' | 'pop-in' | 'squash-in' | 'shake-in' | 'swing-in' | 'brightness-in' | 'darken-in' | 'color-in' | 'saturate-in' | 'hue-in' | 'sepia-in' | 'invert-in' | 'contrast-in' | 'exposure-in' | 'vintage-in' | 'blur-bright-in' | 'shadow-lift' | 'neon-glow-in' | 'glow-in' | 'perspective-in-up' | 'perspective-in-down' | 'perspective-in-left' | 'perspective-in-right' | 'depth-push' | 'depth-pull' | 'depth-in-up' | 'swoop-in-left' | 'swoop-in-right' | 'card-tilt-in' | 'glitch-in' | 'glitch-in-color' | 'typewriter' | 'typewriter-lines' | 'hinge-in' | 'flicker-in' | 'scan-in' | 'materialize' | 'teleport-in' | 'stagger-fade-up' | 'stagger-pop' | 'stagger-rise' | 'stagger-slide' | 'stagger-flip' | 'stagger-blur' | 'stagger-zoom' | 'stagger-drop' | 'scrub-parallax-up' | 'scrub-parallax-down' | 'scrub-rotate' | 'scrub-spin' | 'scrub-scale' | 'scrub-shrink' | 'scrub-pan-left' | 'scrub-pan-right' | 'scrub-tilt' | 'scrub-fade-through' | 'scrub-blur-through' | 'scrub-reveal-x';
|
|
33
|
+
/** Easing function types */
|
|
34
|
+
type EasingType = 'linear' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'spring' | 'soft-spring' | 'heavy-bounce' | [number, number, number, number] | ((t: number) => number) | string;
|
|
35
|
+
/** Keyframe definition for custom animations */
|
|
36
|
+
interface AnimationKeyframe {
|
|
37
|
+
[property: string]: string | number;
|
|
38
|
+
}
|
|
39
|
+
/** One intermediate keyframe of a preset: `offset` is 0 < offset < 1. */
|
|
40
|
+
interface AnimationFrame extends AnimationKeyframe {
|
|
41
|
+
offset: number;
|
|
42
|
+
}
|
|
43
|
+
/** Custom animation definition */
|
|
44
|
+
interface CustomAnimation {
|
|
45
|
+
from: AnimationKeyframe;
|
|
46
|
+
to: AnimationKeyframe;
|
|
47
|
+
/** Optional intermediate keyframes (overshoot, bounce, …), played between `from` and `to`. */
|
|
48
|
+
frames?: AnimationFrame[];
|
|
49
|
+
}
|
|
50
|
+
/** The keyframes of a preset (`PRESETS[name]`). */
|
|
51
|
+
type PresetKeyframes = CustomAnimation;
|
|
52
|
+
/** Per-element animation options */
|
|
53
|
+
interface AnimateOptions {
|
|
54
|
+
/** Animation preset name, array of presets, or custom animation object */
|
|
55
|
+
animation?: AnimationPreset | AnimationPreset[] | CustomAnimation;
|
|
56
|
+
/** Duration in milliseconds (default: 600) */
|
|
57
|
+
duration?: number;
|
|
58
|
+
/** Delay in milliseconds (default: 0) */
|
|
59
|
+
delay?: number;
|
|
60
|
+
/** Easing function (default: 'ease') */
|
|
61
|
+
easing?: EasingType;
|
|
62
|
+
/** Intersection threshold 0-1 (default: 0.1) */
|
|
63
|
+
threshold?: number | number[];
|
|
64
|
+
/** Root margin for IntersectionObserver (default: '0px') */
|
|
65
|
+
rootMargin?: string;
|
|
66
|
+
/** Whether to replay animation each time element enters viewport (default: false) */
|
|
67
|
+
repeat?: boolean;
|
|
68
|
+
/** Whether to trigger animation only once (default: true if repeat is false) */
|
|
69
|
+
once?: boolean;
|
|
70
|
+
/** Offset in pixels from the viewport edge to trigger animation (default: 0) */
|
|
71
|
+
offset?: number;
|
|
72
|
+
/** Stagger delay for child elements in ms (default: 0) */
|
|
73
|
+
stagger?: number;
|
|
74
|
+
/** Callback fired when animation starts */
|
|
75
|
+
onStart?: (element: Element) => void;
|
|
76
|
+
/** Callback fired when animation completes */
|
|
77
|
+
onComplete?: (element: Element) => void;
|
|
78
|
+
/** Callback fired when element enters viewport */
|
|
79
|
+
onEnter?: (element: Element) => void;
|
|
80
|
+
/** Callback fired when element leaves viewport */
|
|
81
|
+
onLeave?: (element: Element) => void;
|
|
82
|
+
/** Callback fired with scroll progress (0 to 1) */
|
|
83
|
+
onProgress?: (element: Element, progress: number) => void;
|
|
84
|
+
/** How progress for `onProgress`/`progressVar` is measured (default: 'ratio') */
|
|
85
|
+
progressMode?: ProgressMode;
|
|
86
|
+
/**
|
|
87
|
+
* Name of a CSS custom property (e.g. `'--sa-progress'`) that receives the
|
|
88
|
+
* element's progress (0 to 1, same value as `onProgress`) as an inline
|
|
89
|
+
* style, for scroll-driven effects written in plain CSS. Off by default.
|
|
90
|
+
*/
|
|
91
|
+
progressVar?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Animation engine (default: `'auto'`, see `ScrollEngine`). With the native
|
|
94
|
+
* engine the animation is linked to scroll position: `duration`, `delay`,
|
|
95
|
+
* `threshold`, `offset` and `stagger` do not apply; `viewRange` does.
|
|
96
|
+
*/
|
|
97
|
+
engine?: ScrollEngine;
|
|
98
|
+
/**
|
|
99
|
+
* Native engine only: the view-timeline range the entrance animation spans,
|
|
100
|
+
* as `[rangeStart, rangeEnd]` (default: `['entry 0%', 'entry 100%']`).
|
|
101
|
+
*/
|
|
102
|
+
viewRange?: [string, string];
|
|
103
|
+
/**
|
|
104
|
+
* Animate out when the element leaves the viewport, and back in when it
|
|
105
|
+
* re-enters (implies `repeat: true` unless `repeat` is set).
|
|
106
|
+
* - `true`: play the entrance animation in reverse.
|
|
107
|
+
* - a preset / presets / `{ from, to }`: play that animation in reverse
|
|
108
|
+
* (e.g. `exit: 'fade-in-down'` leaves upwards).
|
|
109
|
+
* Skipped under reduced motion. (default: `false`)
|
|
110
|
+
*/
|
|
111
|
+
exit?: boolean | AnimationPreset | AnimationPreset[] | CustomAnimation;
|
|
112
|
+
}
|
|
113
|
+
/** Global configuration for ScrollAnimate instance */
|
|
114
|
+
interface ScrollAnimateConfig {
|
|
115
|
+
/** Default animation preset (default: 'fade-in-up') */
|
|
116
|
+
defaultAnimation?: AnimationPreset | AnimationPreset[] | CustomAnimation;
|
|
117
|
+
/** Default duration in ms (default: 600) */
|
|
118
|
+
defaultDuration?: number;
|
|
119
|
+
/** Default delay in ms (default: 0) */
|
|
120
|
+
defaultDelay?: number;
|
|
121
|
+
/** Default easing (default: 'ease') */
|
|
122
|
+
defaultEasing?: EasingType;
|
|
123
|
+
/** Default threshold (default: 0.1) */
|
|
124
|
+
defaultThreshold?: number | number[];
|
|
125
|
+
/** Default root margin (default: '0px') */
|
|
126
|
+
defaultRootMargin?: string;
|
|
127
|
+
/** Whether animations replay by default (default: false) */
|
|
128
|
+
defaultRepeat?: boolean;
|
|
129
|
+
/** Default once setting (default: true) */
|
|
130
|
+
defaultOnce?: boolean;
|
|
131
|
+
/** Default offset in pixels (default: 0) */
|
|
132
|
+
defaultOffset?: number;
|
|
133
|
+
/** CSS class added before animation (default: 'sa-hidden') */
|
|
134
|
+
hiddenClass?: string;
|
|
135
|
+
/** CSS class added when element is visible (default: 'sa-visible') */
|
|
136
|
+
visibleClass?: string;
|
|
137
|
+
/** Whether to use CSS class-based animation instead of Web Animations API */
|
|
138
|
+
useClassNames?: boolean;
|
|
139
|
+
/** Disable all animations (useful for reduced-motion preference) */
|
|
140
|
+
disabled?: boolean;
|
|
141
|
+
/** Custom IntersectionObserver root element */
|
|
142
|
+
root?: Element | null;
|
|
143
|
+
/**
|
|
144
|
+
* Drop `once` elements from the registry as soon as their entrance animation
|
|
145
|
+
* has been triggered (unless they still need onProgress/progressVar), so they can
|
|
146
|
+
* be garbage-collected. They are remembered in a WeakSet, so `init()`/`observe()`
|
|
147
|
+
* never re-hide or replay them. (default: true)
|
|
148
|
+
*/
|
|
149
|
+
autoUnregister?: boolean;
|
|
150
|
+
/** Default animation engine (default: `'auto'`; `'js'` restores the 1.x behaviour) */
|
|
151
|
+
defaultEngine?: ScrollEngine;
|
|
152
|
+
}
|
|
153
|
+
/** Registered element entry */
|
|
154
|
+
interface AnimatedElement {
|
|
155
|
+
element: Element;
|
|
156
|
+
options: Required<AnimateOptions>;
|
|
157
|
+
observer: IntersectionObserver;
|
|
158
|
+
animated: boolean;
|
|
159
|
+
progressObserver?: IntersectionObserver;
|
|
160
|
+
/** Engine actually used for this element (`'css'` = native scroll-driven timeline) */
|
|
161
|
+
engine?: 'js' | 'css';
|
|
162
|
+
}
|
|
163
|
+
/** ScrollAnimate public API */
|
|
164
|
+
interface ScrollAnimateInstance {
|
|
165
|
+
/** Observe a single element or CSS selector */
|
|
166
|
+
observe(target: string | Element | NodeList | Element[], options?: AnimateOptions): void;
|
|
167
|
+
/** Stop observing a single element or CSS selector */
|
|
168
|
+
unobserve(target: string | Element | NodeList | Element[]): void;
|
|
169
|
+
/** Observe all elements matching the data-sa attribute */
|
|
170
|
+
init(rootElement?: Element | Document): void;
|
|
171
|
+
/**
|
|
172
|
+
* Like `init()`, then keep watching `rootElement` (default: `document`) with a
|
|
173
|
+
* MutationObserver: `[data-sa]` elements added later (or that gain the
|
|
174
|
+
* attribute) are observed automatically, and removed ones are released.
|
|
175
|
+
* Returns a function that stops watching. `destroy()` stops every watcher.
|
|
176
|
+
* SSR-safe: a no-op without a DOM / MutationObserver.
|
|
177
|
+
*/
|
|
178
|
+
watch(rootElement?: Element | Document): () => void;
|
|
179
|
+
/** Destroy the instance and clean up all observers */
|
|
180
|
+
destroy(): void;
|
|
181
|
+
/** Refresh all observers (useful after DOM changes) */
|
|
182
|
+
refresh(): void;
|
|
183
|
+
/** Manually trigger animation on an element */
|
|
184
|
+
animate(target: string | Element, options?: AnimateOptions): void;
|
|
185
|
+
/** Get all currently observed elements */
|
|
186
|
+
getObservedElements(): AnimatedElement[];
|
|
187
|
+
/** Update global configuration */
|
|
188
|
+
configure(config: Partial<ScrollAnimateConfig>): void;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* motionary - Core Implementation
|
|
193
|
+
* Uses IntersectionObserver + Web Animations API for zero-dependency,
|
|
194
|
+
* high-performance scroll-triggered animations.
|
|
195
|
+
*/
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Whether the browser can run presets on a native scroll-driven timeline:
|
|
199
|
+
* `CSS.supports('animation-timeline: view()')` plus the `ViewTimeline`
|
|
200
|
+
* constructor used to attach it from JavaScript. Cached. SSR-safe.
|
|
201
|
+
*/
|
|
202
|
+
declare function supportsScrollTimeline(): boolean;
|
|
203
|
+
/**
|
|
204
|
+
* True scroll progress of `el` through the viewport (or `root`): 0 when its top
|
|
205
|
+
* edge reaches the bottom of the viewport, 1 when its bottom edge passes the top.
|
|
206
|
+
* Works for elements taller than the viewport. Returns 0 without a DOM.
|
|
207
|
+
*/
|
|
208
|
+
declare function getScrollProgress(el: Element, root?: Element | null): number;
|
|
209
|
+
declare function createScrollAnimate(userConfig?: ScrollAnimateConfig): ScrollAnimateInstance;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* motionary - Staggered children
|
|
213
|
+
* Reveal a container's children one after another when the container scrolls
|
|
214
|
+
* into view, optionally also animating children that are added later.
|
|
215
|
+
*/
|
|
216
|
+
|
|
217
|
+
interface StaggerOptions extends AnimateOptions {
|
|
218
|
+
/** Delay between consecutive children in ms (default: 80) */
|
|
219
|
+
stagger?: number;
|
|
220
|
+
/**
|
|
221
|
+
* Watch the container with a MutationObserver and animate children added
|
|
222
|
+
* later (e.g. infinite lists). Children added after the container was
|
|
223
|
+
* revealed animate when they scroll into view, staggered per batch.
|
|
224
|
+
* (default: false)
|
|
225
|
+
*/
|
|
226
|
+
observeChildren?: boolean;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Animate the children of `container` with a stagger once it enters the
|
|
230
|
+
* viewport. Returns a cleanup function. SSR-safe (no-op without a DOM).
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* const stop = staggerChildren(document.querySelector('ul'), { stagger: 60, observeChildren: true });
|
|
234
|
+
*/
|
|
235
|
+
declare function staggerChildren(container: Element | null | undefined, options?: StaggerOptions, instance?: ScrollAnimateInstance): () => void;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Where a step starts on a timeline:
|
|
239
|
+
* - a number: absolute time in ms
|
|
240
|
+
* - `'>'` (default): when the previous step ends · `'<'`: when it starts
|
|
241
|
+
* - `'+=200'` / `'-=200'`: after / overlapping the previous end
|
|
242
|
+
* - `'<+=100'`: 100ms after the previous step's start
|
|
243
|
+
* - `'intro'` / `'intro+=150'`: at (or relative to) a label
|
|
244
|
+
*/
|
|
245
|
+
type TimelinePosition = number | string;
|
|
246
|
+
interface TimelineStepOptions {
|
|
247
|
+
/** Duration in ms or a motion token name (`'fast'`, `'slow'`…; 4.2). Default: timeline default, 600. */
|
|
248
|
+
duration?: number | string;
|
|
249
|
+
/** CSS easing or a motion token name (`'emphasized'`, `'spring'`…; 4.2). Default `cubic-bezier(0.22, 1, 0.36, 1)`. */
|
|
250
|
+
easing?: string;
|
|
251
|
+
/** Start position, see `TimelinePosition`. */
|
|
252
|
+
at?: TimelinePosition;
|
|
253
|
+
/** ms between targets when the selector matches several elements. */
|
|
254
|
+
stagger?: number;
|
|
255
|
+
}
|
|
256
|
+
interface TimelineOptions {
|
|
257
|
+
/** Defaults for every step. */
|
|
258
|
+
defaults?: Pick<TimelineStepOptions, 'duration' | 'easing' | 'stagger'>;
|
|
259
|
+
/** Playback rate (1 = normal). */
|
|
260
|
+
speed?: number;
|
|
261
|
+
/** Called after `play()` reaches the end (or the start when reversed). */
|
|
262
|
+
onComplete?: () => void;
|
|
263
|
+
/** Called on every frame with progress 0–1. */
|
|
264
|
+
onUpdate?: (progress: number) => void;
|
|
265
|
+
}
|
|
266
|
+
interface ScrubOptions {
|
|
267
|
+
/** Scroll offset (px) before the source's top reaches the viewport bottom where progress starts (JS engine only). */
|
|
268
|
+
offset?: number;
|
|
269
|
+
/** Smoothing 0–1 (0 = immediate, default 0). Smoothing needs the JS engine. */
|
|
270
|
+
smooth?: number;
|
|
271
|
+
/**
|
|
272
|
+
* 4.1: which progress source drives the timeline.
|
|
273
|
+
* - `'view'` (default): `source` moving through the viewport (CSS `ViewTimeline`, range `cover`).
|
|
274
|
+
* - `'scroll'`: the scroll position of `source` itself (a scroll container; CSS `ScrollTimeline`).
|
|
275
|
+
*/
|
|
276
|
+
source?: 'view' | 'scroll';
|
|
277
|
+
/** 4.1: `'auto'` (default) uses the browser's native scroll-driven animations when available, `'js'` forces the fallback. */
|
|
278
|
+
engine?: 'auto' | 'native' | 'js';
|
|
279
|
+
/** 4.1: scroll axis, `'block'` (default) · `'inline'` · `'x'` · `'y'`. */
|
|
280
|
+
axis?: 'block' | 'inline' | 'x' | 'y';
|
|
281
|
+
}
|
|
282
|
+
/** The function `scrub()` returns: call it to stop. `native` tells which engine runs it. */
|
|
283
|
+
interface ScrubHandle {
|
|
284
|
+
(): void;
|
|
285
|
+
/** `true` when the browser's ScrollTimeline / ViewTimeline drives it (compositor, no JS per frame). */
|
|
286
|
+
readonly native: boolean;
|
|
287
|
+
}
|
|
288
|
+
/** 4.1: whether `scrub()` can use native ScrollTimeline / ViewTimeline here. */
|
|
289
|
+
declare function supportsNativeScrub(source?: 'view' | 'scroll'): boolean;
|
|
290
|
+
interface Timeline {
|
|
291
|
+
/** Total length in ms. */
|
|
292
|
+
readonly duration: number;
|
|
293
|
+
/** Label positions in ms. */
|
|
294
|
+
readonly labels: Readonly<Record<string, number>>;
|
|
295
|
+
/** Current playhead in ms. */
|
|
296
|
+
readonly time: number;
|
|
297
|
+
/** Add a step: animate `target` with keyframes or a preset name (`fade-up`, `scale`…). */
|
|
298
|
+
to(target: string | Element | Element[] | NodeList, frames: Keyframe[] | string, options?: TimelineStepOptions): Timeline;
|
|
299
|
+
/** Name a position (default: the current end). */
|
|
300
|
+
label(name: string, at?: TimelinePosition): Timeline;
|
|
301
|
+
/** Run `fn` when the playhead passes `at`. */
|
|
302
|
+
call(fn: () => void, at?: TimelinePosition): Timeline;
|
|
303
|
+
/** Play forwards from the playhead (from 0 when at the end). Resolves at the end. */
|
|
304
|
+
play(from?: TimelinePosition): Promise<void>;
|
|
305
|
+
/** Play backwards to 0. */
|
|
306
|
+
reverse(): Promise<void>;
|
|
307
|
+
pause(): Timeline;
|
|
308
|
+
/** Jump to a time (ms) or label. */
|
|
309
|
+
seek(to: TimelinePosition): Timeline;
|
|
310
|
+
/** Get or set progress 0–1. */
|
|
311
|
+
progress(p?: number): number;
|
|
312
|
+
/**
|
|
313
|
+
* Tie progress to scroll: `source` moving through the viewport (or, with
|
|
314
|
+
* `{ source: 'scroll' }`, a scroll container's own position). Runs on native
|
|
315
|
+
* ScrollTimeline / ViewTimeline when available (and no `smooth`, `offset`,
|
|
316
|
+
* `call()` cues or `onUpdate` need JS), else on a rAF-throttled listener.
|
|
317
|
+
* Returns a stop function with a `native` flag.
|
|
318
|
+
*/
|
|
319
|
+
scrub(source: Element, options?: ScrubOptions): ScrubHandle;
|
|
320
|
+
/** Stop and drop every animation (elements keep their last frame). */
|
|
321
|
+
cancel(): void;
|
|
322
|
+
}
|
|
323
|
+
/** Keyframe presets usable by name in `to()` and `data-tl`. */
|
|
324
|
+
declare const TIMELINE_PRESETS: Record<string, Keyframe[]>;
|
|
325
|
+
/** Resolve a position against the previous step and labels (pure). */
|
|
326
|
+
declare function resolvePosition(pos: TimelinePosition | undefined, end: number, prevStart: number, labels?: Record<string, number>): number;
|
|
327
|
+
/**
|
|
328
|
+
* Choreograph animations on one clock: chain, overlap, label, seek, reverse and
|
|
329
|
+
* scrub them with scroll. Built on WAAPI (paused animations driven by one
|
|
330
|
+
* playhead); without WAAPI or under reduced motion it jumps to the end state.
|
|
331
|
+
*
|
|
332
|
+
* @example
|
|
333
|
+
* const tl = timeline({ defaults: { duration: 500 } })
|
|
334
|
+
* .to('.title', 'fade-up')
|
|
335
|
+
* .label('cards')
|
|
336
|
+
* .to('.card', 'scale', { stagger: 80, at: '-=200' })
|
|
337
|
+
* .to('.cta', [{ opacity: 0 }, { opacity: 1 }], { at: 'cards+=400' });
|
|
338
|
+
* tl.play(); // or tl.scrub(document.querySelector('.hero'))
|
|
339
|
+
*/
|
|
340
|
+
declare function timeline(options?: TimelineOptions): Timeline;
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* motionary - parallax() helper
|
|
344
|
+
*
|
|
345
|
+
* Moves elements at a different speed than the page while they cross the
|
|
346
|
+
* viewport. Built on the same scroll progress as `progressVar` (0 when the
|
|
347
|
+
* element's top enters at the bottom, 1 when its bottom leaves at the top):
|
|
348
|
+
* the progress is written to a CSS custom property (default `--sa-parallax`)
|
|
349
|
+
* and the offset is applied with the individual `translate` property, so it
|
|
350
|
+
* composes with entrance animations and other `transform`s.
|
|
351
|
+
*/
|
|
352
|
+
interface ParallaxHelperOptions {
|
|
353
|
+
/**
|
|
354
|
+
* Total distance the element shifts while it crosses the viewport, as a
|
|
355
|
+
* fraction of the viewport size (`0.2` = 20vh on the y axis). Positive values
|
|
356
|
+
* lag behind the scroll (background-like), negative values move ahead of it
|
|
357
|
+
* (foreground-like). (default: `0.2`)
|
|
358
|
+
*/
|
|
359
|
+
speed?: number;
|
|
360
|
+
/** `'y'` (default) or `'x'` (horizontal drift, in `vw`) */
|
|
361
|
+
axis?: 'x' | 'y';
|
|
362
|
+
/** CSS custom property receiving the progress (default: `'--sa-parallax'`) */
|
|
363
|
+
progressVar?: string;
|
|
364
|
+
/** Scroll container (default: the viewport) */
|
|
365
|
+
root?: Element | null;
|
|
366
|
+
/**
|
|
367
|
+
* Under `prefers-reduced-motion: reduce` no offset is applied (the progress
|
|
368
|
+
* variable is still written). Set to `false` to move anyway. (default: `true`)
|
|
369
|
+
*/
|
|
370
|
+
respectReducedMotion?: boolean;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Apply a scroll parallax to `target` (selector, Element, NodeList or array).
|
|
374
|
+
* Returns a function that stops it and removes the inline styles it set.
|
|
375
|
+
* SSR-safe (no-op without a DOM / IntersectionObserver).
|
|
376
|
+
*
|
|
377
|
+
* @example
|
|
378
|
+
* const stop = parallax('.hero-bg', { speed: 0.3 });
|
|
379
|
+
* parallax('.badge', { speed: -0.15, axis: 'x' });
|
|
380
|
+
*/
|
|
381
|
+
declare function parallax(target: string | Element | NodeList | Element[], options?: ParallaxHelperOptions): () => void;
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* motionary - Animation Presets
|
|
385
|
+
* Defines keyframes for all built-in animation presets
|
|
386
|
+
*/
|
|
387
|
+
|
|
388
|
+
type KeyframeMap = PresetKeyframes;
|
|
389
|
+
/**
|
|
390
|
+
* Every registered preset: the 33 core presets, plus the 6.1 extended set once
|
|
391
|
+
* `motionary/presets/extended` is loaded, plus your own.
|
|
392
|
+
*/
|
|
393
|
+
declare const PRESETS: Record<CorePreset, KeyframeMap> & Partial<Record<ExtendedPreset, KeyframeMap>>;
|
|
394
|
+
/**
|
|
395
|
+
* Add (or replace) presets by name: `registerPresets({ 'my-pop': { from, to, frames? } })`.
|
|
396
|
+
* They work everywhere a preset name does (`animation`, `exit`, `data-sa-animation`,
|
|
397
|
+
* `<scroll-animate>`, `<usa-reveal effect>`).
|
|
398
|
+
*/
|
|
399
|
+
declare function registerPresets(presets: Record<string, PresetKeyframes>): void;
|
|
400
|
+
/** The same keyframes played backwards (exit animations). */
|
|
401
|
+
declare function reversePreset(p: KeyframeMap): KeyframeMap;
|
|
402
|
+
declare function resolvePreset(animation: AnimationPreset | AnimationPreset[] | CustomAnimation): KeyframeMap;
|
|
403
|
+
/** Easing to CSS cubic-bezier mapping */
|
|
404
|
+
declare const EASING_MAP: Record<string, string>;
|
|
405
|
+
declare function resolveEasing(easing: EasingType): string;
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Default singleton instance of ScrollAnimate.
|
|
409
|
+
* Ready to use out of the box with sensible defaults.
|
|
410
|
+
*
|
|
411
|
+
* @example
|
|
412
|
+
* ```js
|
|
413
|
+
* import ScrollAnimate from 'motionary';
|
|
414
|
+
*
|
|
415
|
+
* // Auto-initialize all elements with data-sa attribute
|
|
416
|
+
* ScrollAnimate.init();
|
|
417
|
+
*
|
|
418
|
+
* // Or manually observe elements
|
|
419
|
+
* ScrollAnimate.observe('.my-element', { animation: 'fade-in-up' });
|
|
420
|
+
* ```
|
|
421
|
+
*/
|
|
422
|
+
declare const ScrollAnimate: ScrollAnimateInstance;
|
|
423
|
+
|
|
424
|
+
export { EASING_MAP, PRESETS, TIMELINE_PRESETS, createScrollAnimate, ScrollAnimate as default, getScrollProgress, parallax, registerPresets, resolveEasing, resolvePosition, resolvePreset, reversePreset, staggerChildren, supportsNativeScrub, supportsScrollTimeline, timeline };
|
|
425
|
+
export type { AnimateOptions, AnimatedElement, AnimationFrame, AnimationKeyframe, AnimationPreset, CorePreset, CustomAnimation, EasingType, ExtendedPreset, ParallaxHelperOptions, PresetKeyframes, ProgressMode, ScrollAnimateConfig, ScrollAnimateInstance, ScrollEngine, ScrubHandle, ScrubOptions, StaggerOptions, Timeline, TimelineOptions, TimelinePosition, TimelineStepOptions };
|