use-scroll-animate 6.1.0 → 6.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/README.md +157 -411
- package/README_ja.md +170 -175
- package/README_zh.md +169 -198
- package/dist/chunks/{base-B5i8qQPR.cjs → base-BaQV-2ha.cjs} +3 -3
- package/dist/chunks/base-BaQV-2ha.cjs.map +1 -0
- package/dist/chunks/{base-C3Sw9sAO.js → base-Yno7N2eC.js} +3 -3
- package/dist/chunks/base-Yno7N2eC.js.map +1 -0
- package/dist/chunks/{core-BYLtO0Po.cjs → core-B5T0dhFH.cjs} +3 -3
- package/dist/chunks/core-B5T0dhFH.cjs.map +1 -0
- package/dist/chunks/{core-BDcszY4L.cjs → core-BGAyaY6L.cjs} +2 -2
- package/dist/chunks/{core-BDcszY4L.cjs.map → core-BGAyaY6L.cjs.map} +1 -1
- package/dist/chunks/{core-BTf__I-8.js → core-BIOaYdgN.js} +2 -2
- package/dist/chunks/{core-BTf__I-8.js.map → core-BIOaYdgN.js.map} +1 -1
- package/dist/chunks/{core-DN3hHbHh.js → core-CUGCsMsJ.js} +2 -2
- package/dist/chunks/{core-DN3hHbHh.js.map → core-CUGCsMsJ.js.map} +1 -1
- package/dist/chunks/{core-BVQW34aX.js → core-D7cVumUu.js} +3 -3
- package/dist/chunks/core-D7cVumUu.js.map +1 -0
- package/dist/chunks/{core-BjOYKSrV.cjs → core-zq17EeCI.cjs} +2 -2
- package/dist/chunks/{core-BjOYKSrV.cjs.map → core-zq17EeCI.cjs.map} +1 -1
- package/dist/chunks/{fx-ChjxrMBo.js → fx-BqDeFywO.js} +2 -2
- package/dist/chunks/{fx-ChjxrMBo.js.map → fx-BqDeFywO.js.map} +1 -1
- package/dist/chunks/{fx-B8hk1Fby.cjs → fx-lBGVtQO1.cjs} +2 -2
- package/dist/chunks/{fx-B8hk1Fby.cjs.map → fx-lBGVtQO1.cjs.map} +1 -1
- package/dist/chunks/{presets-BJ09NeTo.js → presets-BYBVJVeP.js} +3 -3
- package/dist/chunks/presets-BYBVJVeP.js.map +1 -0
- package/dist/chunks/{presets-D2ksQNzJ.cjs → presets-CUHys3sK.cjs} +3 -3
- package/dist/chunks/presets-CUHys3sK.cjs.map +1 -0
- package/dist/chunks/{spring-CckMe3x0.js → spring-DfQO5USi.js} +2 -2
- package/dist/chunks/{spring-CckMe3x0.js.map → spring-DfQO5USi.js.map} +1 -1
- package/dist/chunks/{spring--oZh55tB.cjs → spring-Dgx187Vh.cjs} +2 -2
- package/dist/chunks/{spring--oZh55tB.cjs.map → spring-Dgx187Vh.cjs.map} +1 -1
- package/dist/chunks/{stagger-CvhYlKrF.cjs → stagger-CCFyhzSw.cjs} +3 -3
- package/dist/chunks/stagger-CCFyhzSw.cjs.map +1 -0
- package/dist/chunks/{stagger-Dh4V-OL0.js → stagger-DtMKo2SK.js} +3 -3
- package/dist/chunks/stagger-DtMKo2SK.js.map +1 -0
- package/dist/chunks/{variants-DxPmgrNX.cjs → variants-BhjyddG8.cjs} +2 -2
- package/dist/chunks/{variants-DxPmgrNX.cjs.map → variants-BhjyddG8.cjs.map} +1 -1
- package/dist/chunks/{variants-Bsevy6Xm.js → variants-VNscPeTD.js} +2 -2
- package/dist/chunks/{variants-Bsevy6Xm.js.map → variants-VNscPeTD.js.map} +1 -1
- package/dist/components/a11y.cjs +4 -4
- package/dist/components/a11y.cjs.map +1 -1
- package/dist/components/a11y.d.cts +2 -2
- package/dist/components/a11y.d.ts +2 -2
- package/dist/components/a11y.js +5 -5
- package/dist/components/a11y.js.map +1 -1
- package/dist/components/angular.cjs +8 -8
- package/dist/components/angular.cjs.map +1 -1
- package/dist/components/angular.d.cts +22 -22
- package/dist/components/angular.d.ts +22 -22
- package/dist/components/angular.js +8 -8
- package/dist/components/angular.js.map +1 -1
- package/dist/components/background.cjs +3 -3
- package/dist/components/background.cjs.map +1 -1
- package/dist/components/background.css +1 -1
- package/dist/components/background.d.cts +1 -1
- package/dist/components/background.d.ts +1 -1
- package/dist/components/background.js +3 -3
- package/dist/components/background.js.map +1 -1
- package/dist/components/bridge.cjs +2 -2
- package/dist/components/bridge.cjs.map +1 -1
- package/dist/components/bridge.d.cts +1 -1
- package/dist/components/bridge.d.ts +1 -1
- package/dist/components/bridge.js +2 -2
- package/dist/components/bridge.js.map +1 -1
- package/dist/components/cards.cjs +3 -3
- package/dist/components/cards.cjs.map +1 -1
- package/dist/components/cards.css +1 -1
- package/dist/components/cards.d.cts +1 -1
- package/dist/components/cards.d.ts +1 -1
- package/dist/components/cards.js +3 -3
- package/dist/components/cards.js.map +1 -1
- package/dist/components/click.cjs +4 -4
- package/dist/components/click.cjs.map +1 -1
- package/dist/components/click.css +1 -1
- package/dist/components/click.d.cts +1 -1
- package/dist/components/click.d.ts +1 -1
- package/dist/components/click.js +4 -4
- package/dist/components/click.js.map +1 -1
- package/dist/components/depth.cjs +4 -4
- package/dist/components/depth.cjs.map +1 -1
- package/dist/components/depth.css +1 -1
- package/dist/components/depth.d.cts +1 -1
- package/dist/components/depth.d.ts +1 -1
- package/dist/components/depth.js +4 -4
- package/dist/components/depth.js.map +1 -1
- package/dist/components/effects.cjs +13 -13
- package/dist/components/effects.cjs.map +1 -1
- package/dist/components/effects.d.cts +2 -2
- package/dist/components/effects.d.ts +2 -2
- package/dist/components/effects.js +13 -13
- package/dist/components/effects.js.map +1 -1
- package/dist/components/feedback.cjs +2 -2
- package/dist/components/feedback.cjs.map +1 -1
- package/dist/components/feedback.css +1 -1
- package/dist/components/feedback.d.cts +1 -1
- package/dist/components/feedback.d.ts +1 -1
- package/dist/components/feedback.js +2 -2
- package/dist/components/feedback.js.map +1 -1
- package/dist/components/fx.cjs +10 -10
- package/dist/components/fx.cjs.map +1 -1
- package/dist/components/fx.css +1 -1
- package/dist/components/fx.d.cts +2 -2
- package/dist/components/fx.d.ts +2 -2
- package/dist/components/fx.js +10 -10
- package/dist/components/fx.js.map +1 -1
- package/dist/components/gesture.cjs +4 -4
- package/dist/components/gesture.cjs.map +1 -1
- package/dist/components/gesture.css +1 -1
- package/dist/components/gesture.d.cts +1 -1
- package/dist/components/gesture.d.ts +1 -1
- package/dist/components/gesture.js +5 -5
- package/dist/components/gesture.js.map +1 -1
- package/dist/components/interaction.cjs +2 -2
- package/dist/components/interaction.cjs.map +1 -1
- package/dist/components/interaction.css +1 -1
- package/dist/components/interaction.d.cts +1 -1
- package/dist/components/interaction.d.ts +1 -1
- package/dist/components/interaction.js +2 -2
- package/dist/components/interaction.js.map +1 -1
- package/dist/components/jsx.d.cts +2 -2
- package/dist/components/jsx.d.ts +2 -2
- package/dist/components/layout.cjs +2 -2
- package/dist/components/layout.cjs.map +1 -1
- package/dist/components/layout.css +1 -1
- package/dist/components/layout.d.cts +1 -1
- package/dist/components/layout.d.ts +1 -1
- package/dist/components/layout.js +2 -2
- package/dist/components/layout.js.map +1 -1
- package/dist/components/lazy.cjs +2 -2
- package/dist/components/lazy.cjs.map +1 -1
- package/dist/components/lazy.d.cts +2 -2
- package/dist/components/lazy.d.ts +2 -2
- package/dist/components/lazy.js +2 -2
- package/dist/components/lazy.js.map +1 -1
- package/dist/components/lite.cjs +41 -41
- package/dist/components/lite.cjs.map +1 -1
- package/dist/components/lite.js +41 -41
- package/dist/components/lite.js.map +1 -1
- package/dist/components/packs.cjs +2 -2
- package/dist/components/packs.cjs.map +1 -1
- package/dist/components/packs.css +1 -1
- package/dist/components/packs.d.cts +1 -1
- package/dist/components/packs.d.ts +1 -1
- package/dist/components/packs.js +2 -2
- package/dist/components/packs.js.map +1 -1
- package/dist/components/page.cjs +3 -3
- package/dist/components/page.cjs.map +1 -1
- package/dist/components/page.css +1 -1
- package/dist/components/page.d.cts +1 -1
- package/dist/components/page.d.ts +1 -1
- package/dist/components/page.js +4 -4
- package/dist/components/page.js.map +1 -1
- package/dist/components/perf.cjs +3 -3
- package/dist/components/perf.cjs.map +1 -1
- package/dist/components/perf.d.cts +2 -2
- package/dist/components/perf.d.ts +2 -2
- package/dist/components/perf.js +4 -4
- package/dist/components/perf.js.map +1 -1
- package/dist/components/physics.cjs +3 -3
- package/dist/components/physics.cjs.map +1 -1
- package/dist/components/physics.css +1 -1
- package/dist/components/physics.d.cts +1 -1
- package/dist/components/physics.d.ts +1 -1
- package/dist/components/physics.js +4 -4
- package/dist/components/physics.js.map +1 -1
- package/dist/components/react.cjs +4 -4
- package/dist/components/react.cjs.map +1 -1
- package/dist/components/react.js +4 -4
- package/dist/components/react.js.map +1 -1
- package/dist/components/reveal.cjs +2 -2
- package/dist/components/reveal.cjs.map +1 -1
- package/dist/components/reveal.css +1 -1
- package/dist/components/reveal.d.cts +1 -1
- package/dist/components/reveal.d.ts +1 -1
- package/dist/components/reveal.js +2 -2
- package/dist/components/reveal.js.map +1 -1
- package/dist/components/solid.cjs +9 -9
- package/dist/components/solid.cjs.map +1 -1
- package/dist/components/solid.d.cts +22 -22
- package/dist/components/solid.d.ts +22 -22
- package/dist/components/solid.js +9 -9
- package/dist/components/solid.js.map +1 -1
- package/dist/components/svelte.cjs +8 -8
- package/dist/components/svelte.cjs.map +1 -1
- package/dist/components/svelte.d.cts +22 -22
- package/dist/components/svelte.d.ts +22 -22
- package/dist/components/svelte.js +8 -8
- package/dist/components/svelte.js.map +1 -1
- package/dist/components/svg.cjs +2 -2
- package/dist/components/svg.cjs.map +1 -1
- package/dist/components/svg.css +1 -1
- package/dist/components/svg.d.cts +1 -1
- package/dist/components/svg.d.ts +1 -1
- package/dist/components/svg.js +2 -2
- package/dist/components/svg.js.map +1 -1
- package/dist/components/text.cjs +3 -3
- package/dist/components/text.cjs.map +1 -1
- package/dist/components/text.css +1 -1
- package/dist/components/text.d.cts +1 -1
- package/dist/components/text.d.ts +1 -1
- package/dist/components/text.js +3 -3
- package/dist/components/text.js.map +1 -1
- package/dist/components/timeline.cjs +3 -3
- package/dist/components/timeline.cjs.map +1 -1
- package/dist/components/timeline.css +1 -1
- package/dist/components/timeline.d.cts +1 -1
- package/dist/components/timeline.d.ts +1 -1
- package/dist/components/timeline.js +4 -4
- package/dist/components/timeline.js.map +1 -1
- package/dist/components/tokens.cjs +2 -2
- package/dist/components/tokens.cjs.map +1 -1
- package/dist/components/tokens.d.cts +2 -2
- package/dist/components/tokens.d.ts +2 -2
- package/dist/components/tokens.js +2 -2
- package/dist/components/tokens.js.map +1 -1
- package/dist/components/transitions.cjs +2 -2
- package/dist/components/transitions.cjs.map +1 -1
- package/dist/components/transitions.css +1 -1
- package/dist/components/transitions.d.cts +1 -1
- package/dist/components/transitions.d.ts +1 -1
- package/dist/components/transitions.js +2 -2
- package/dist/components/transitions.js.map +1 -1
- package/dist/components/ui.cjs +4 -4
- package/dist/components/ui.cjs.map +1 -1
- package/dist/components/ui.css +1 -1
- package/dist/components/ui.d.cts +1 -1
- package/dist/components/ui.d.ts +1 -1
- package/dist/components/ui.js +5 -5
- package/dist/components/ui.js.map +1 -1
- package/dist/components/vue.cjs +9 -9
- package/dist/components/vue.cjs.map +1 -1
- package/dist/components/vue.d.cts +23 -23
- package/dist/components/vue.d.ts +23 -23
- package/dist/components/vue.js +9 -9
- package/dist/components/vue.js.map +1 -1
- package/dist/components/webgl.cjs +2 -2
- package/dist/components/webgl.cjs.map +1 -1
- package/dist/components/webgl.css +1 -1
- package/dist/components/webgl.d.cts +1 -1
- package/dist/components/webgl.d.ts +1 -1
- package/dist/components/webgl.js +2 -2
- package/dist/components/webgl.js.map +1 -1
- package/dist/components.cjs +9 -9
- package/dist/components.cjs.map +1 -1
- package/dist/components.css +1 -1
- package/dist/components.d.cts +30 -30
- package/dist/components.d.ts +30 -30
- package/dist/components.js +11 -11
- package/dist/components.js.map +1 -1
- package/dist/components.umd.js +5 -5
- package/dist/components.umd.js.map +1 -1
- package/dist/element.cjs +4 -4
- package/dist/element.cjs.map +1 -1
- package/dist/element.d.cts +5 -5
- package/dist/element.d.ts +5 -5
- package/dist/element.js +4 -4
- package/dist/element.js.map +1 -1
- package/dist/element.umd.js.map +1 -1
- package/dist/index.cjs +10 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/presets/extended.cjs +3 -3
- package/dist/presets/extended.cjs.map +1 -1
- package/dist/presets/extended.d.cts +3 -3
- package/dist/presets/extended.d.ts +3 -3
- package/dist/presets/extended.js +3 -3
- package/dist/presets/extended.js.map +1 -1
- package/dist/presets-extended.umd.js.map +1 -1
- package/dist/react.cjs +4 -4
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +5 -5
- package/dist/react.d.ts +5 -5
- package/dist/react.js +4 -4
- package/dist/react.js.map +1 -1
- package/dist/solid.cjs +5 -5
- package/dist/solid.cjs.map +1 -1
- package/dist/solid.d.cts +6 -6
- package/dist/solid.d.ts +6 -6
- package/dist/solid.js +5 -5
- package/dist/solid.js.map +1 -1
- package/dist/svelte.cjs +5 -5
- package/dist/svelte.cjs.map +1 -1
- package/dist/svelte.d.cts +6 -6
- package/dist/svelte.d.ts +6 -6
- package/dist/svelte.js +5 -5
- package/dist/svelte.js.map +1 -1
- package/dist/vue.cjs +4 -4
- package/dist/vue.cjs.map +1 -1
- package/dist/vue.d.cts +5 -5
- package/dist/vue.d.ts +5 -5
- package/dist/vue.js +4 -4
- package/dist/vue.js.map +1 -1
- package/docs/API.md +13 -13
- package/docs/ROADMAP.md +2 -2
- package/docs/accessibility.md +2 -2
- package/docs/components.md +33 -33
- package/docs/frameworks-ssr.md +12 -12
- package/docs/hybrid-apps.md +10 -10
- package/docs/migration-from-aos.md +5 -5
- package/docs/migration-from-gsap-scrolltrigger.md +3 -3
- package/docs/motion-tokens.css +1 -1
- package/docs/motion-tokens.md +2 -2
- package/docs/performance.md +6 -6
- package/docs/presets.md +5 -5
- package/docs/windows-apps.md +8 -8
- package/package.json +26 -25
- package/dist/chunks/base-B5i8qQPR.cjs.map +0 -1
- package/dist/chunks/base-C3Sw9sAO.js.map +0 -1
- package/dist/chunks/core-BVQW34aX.js.map +0 -1
- package/dist/chunks/core-BYLtO0Po.cjs.map +0 -1
- package/dist/chunks/presets-BJ09NeTo.js.map +0 -1
- package/dist/chunks/presets-D2ksQNzJ.cjs.map +0 -1
- package/dist/chunks/stagger-CvhYlKrF.cjs.map +0 -1
- package/dist/chunks/stagger-Dh4V-OL0.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,475 +1,221 @@
|
|
|
1
|
+
> **`use-scroll-animate` is now [Motionary](https://www.npmjs.com/package/motionary).** This package is a compatibility alias that ships the same build at the same version — switch with `npm i motionary` and replace `use-scroll-animate` with `motionary` in imports and CDN URLs.
|
|
2
|
+
|
|
1
3
|
<div align="center">
|
|
2
4
|
|
|
3
|
-
#
|
|
5
|
+
# Motionary
|
|
6
|
+
|
|
7
|
+
**Scroll animations and animated Web Components for the modern web — 214 scroll presets, 90 effects, zero dependencies.**
|
|
4
8
|
|
|
5
|
-
**
|
|
9
|
+
_Formerly **use-scroll-animate** — same API, same `<usa-*>` tags; the old npm package keeps working as an alias._
|
|
6
10
|
|
|
7
|
-
[](https://github.com/HarrisonCN/use-scroll-animate)
|
|
9
|
-
[](https://opensource.org/licenses/MIT)
|
|
11
|
+
[](https://www.npmjs.com/package/motionary) [](https://github.com/HarrisonCN/motionary/actions/workflows/ci.yml) [](./LICENSE)
|
|
10
12
|
|
|
11
13
|
[English](./README.md) | [简体中文](./README_zh.md) | [日本語](./README_ja.md)
|
|
12
14
|
|
|
13
|
-
**[
|
|
15
|
+
**[🛍 Animation Store](https://harrisoncn.github.io/motionary/showcase/)** · **[🧩 Components](https://harrisoncn.github.io/motionary/showcase/components.html)** · **[🎛 Playground](https://harrisoncn.github.io/motionary/showcase/playground.html)** · **[📜 Story](https://harrisoncn.github.io/motionary/showcase/story.html)**
|
|
14
16
|
|
|
15
|
-
>
|
|
17
|
+
<sub>The Store lets you preview, tweak and copy all <b>227</b> animations — 214 scroll presets plus card, click, physics and page effects — at desktop and phone sizes.</sub>
|
|
16
18
|
|
|
17
19
|
</div>
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
In 2025, performance is everything. Traditional scroll animation libraries often bundle heavy dependencies, rely on outdated scroll event listeners, or force you into a specific framework.
|
|
22
|
-
|
|
23
|
-
`use-scroll-animate` is built differently:
|
|
24
|
-
- ⚡ **Zero Dependencies**: Pure Vanilla JS/TypeScript.
|
|
25
|
-
- 🚀 **High Performance**: Powered by `IntersectionObserver` and the native `Web Animations API`. No scroll event listeners by default (the opt-in scroll-progress mode uses a single passive, rAF-throttled listener, only while tracked elements are on screen).
|
|
26
|
-
- 🪶 **Ultra Lightweight**: ~5.4–5.7KB gzipped for the core (tree-shaken, minified ESM); everything from the main entry is ~6.8KB (UMD ~7.0KB); `parallax()` alone < 1KB. Every entry has a gzip budget enforced in CI (`size-budget.json`, `npm run size:check`).
|
|
27
|
-
- 🧩 **Framework Agnostic**: Vanilla JS, React hooks, Vue composables, Svelte actions, Solid directives and a `<scroll-animate>` Web Component, each as its own entry point (`use-scroll-animate/react`, `/vue`, `/svelte`, `/solid`, `/element`).
|
|
28
|
-
- ♿ **Accessible**: Respects `prefers-reduced-motion` out of the box (content is shown immediately, no entrance or parallax motion).
|
|
29
|
-
- 🖥️ **SSR-safe**: Importing (and even calling) the API on the server is a no-op.
|
|
30
|
-
|
|
31
|
-
## Scroll presets 2.0 (v6.1) 🎞️
|
|
32
|
-
|
|
33
|
-
**214 scroll-reveal presets**: the 33 core presets plus **181 extended presets** in a separate, tree-shakeable entry (≈ 4.7 kB gzip; the core bundle is unchanged within its budget). Browse them all with a live demo and copy-paste code in the [Animation Store](https://harrisoncn.github.io/use-scroll-animate/showcase/) — every preset, with its keyframes, is listed in [docs/presets.md](./docs/presets.md).
|
|
34
|
-
|
|
35
|
-
```js
|
|
36
|
-
import ScrollAnimate from 'use-scroll-animate';
|
|
37
|
-
import 'use-scroll-animate/presets/extended'; // registers the extended set on import
|
|
38
|
-
|
|
39
|
-
ScrollAnimate.observe('.card', { animation: 'bounce-in-up', duration: 900 });
|
|
40
|
-
ScrollAnimate.observe('.hero img', { animation: 'scrub-shrink', engine: 'css', viewRange: ['cover 0%', 'cover 100%'] });
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
```html
|
|
44
|
-
<script src="https://unpkg.com/use-scroll-animate@6/dist/index.umd.js"></script>
|
|
45
|
-
<script src="https://unpkg.com/use-scroll-animate@6/dist/presets-extended.umd.js"></script>
|
|
46
|
-
<div data-sa data-sa-animation="clip-diamond">…</div>
|
|
47
|
-
<script>ScrollAnimate.default.init();</script>
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
The names work everywhere a preset does: `animation` / `exit`, `data-sa-animation`, `useScrollAnimate` and the other framework adapters, `<scroll-animate animation>`, and `<usa-reveal effect>` / `<usa-stagger effect>`. Only `transform`, `opacity`, `filter` and `clip-path` are animated, and nothing moves under `prefers-reduced-motion`. Presets can now carry intermediate `frames` (overshoot, bounce, glitch) — so can your own: `registerPresets({ 'my-pop': { from, to, frames } })`.
|
|
21
|
+
Motionary reveals content as it scrolls into view (IntersectionObserver + Web Animations, or the browser's native scroll timeline) and ships 94 animated custom elements — cards, buttons, physics, page transitions, backgrounds, WebGL and more — that work in any framework, in plain HTML and in desktop web-view apps (Electron, Tauri, WebView2). Everything respects `prefers-reduced-motion`.
|
|
51
22
|
|
|
52
|
-
|
|
53
|
-
|---|---:|---|
|
|
54
|
-
| Fade | 19 | `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` |
|
|
55
|
-
| Zoom & scale | 23 | `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` |
|
|
56
|
-
| Flip 3D | 22 | `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` |
|
|
57
|
-
| Slide | 20 | `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` |
|
|
58
|
-
| Rotate & skew | 20 | `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` |
|
|
59
|
-
| Blur & mask | 14 | `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` |
|
|
60
|
-
| Clip reveal | 22 | `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` |
|
|
61
|
-
| Bounce & elastic | 17 | `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` |
|
|
62
|
-
| Color & light | 14 | `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` |
|
|
63
|
-
| Depth & perspective | 10 | `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` |
|
|
64
|
-
| Glitch & special | 9 | `glitch-in` · `glitch-in-color` · `typewriter` · `typewriter-lines` · `hinge-in` · `flicker-in` · `scan-in` · `materialize` · `teleport-in` |
|
|
65
|
-
| Stagger-ready | 8 | `stagger-fade-up` · `stagger-pop` · `stagger-rise` · `stagger-slide` · `stagger-flip` · `stagger-blur` · `stagger-zoom` · `stagger-drop` |
|
|
66
|
-
| Scroll-linked | 12 | `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` |
|
|
67
|
-
|
|
68
|
-
## Animated components (v2.2+) 🧩
|
|
69
|
-
|
|
70
|
-
**30 dependency-free animated Web Components** (`<usa-*>`) in six categories — for **web pages and Windows desktop apps** (Electron, Tauri, WebView2 in WinUI/WPF/WinForms, PWAs). Custom Elements + CSS + Web Animations only: tree-shakable, SSR-safe, `prefers-reduced-motion` everywhere. **[Live gallery](https://harrisoncn.github.io/use-scroll-animate/showcase/components.html)** · [Component docs](./docs/components.md) · [Windows apps guide](./docs/windows-apps.md) · [Next / Astro / React / Vue](./docs/frameworks-ssr.md) · [Accessibility](./docs/accessibility.md)
|
|
71
|
-
|
|
72
|
-
```js
|
|
73
|
-
import { defineComponents } from 'use-scroll-animate/components';
|
|
74
|
-
defineComponents(); // or per category: import { defineTextComponents } from 'use-scroll-animate/components/text'
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
```html
|
|
78
|
-
<!-- or with no build step -->
|
|
79
|
-
<script src="https://unpkg.com/use-scroll-animate@6/dist/components.umd.js"></script>
|
|
80
|
-
<usa-typewriter words="Hello, Windows.|Hello, web."></usa-typewriter>
|
|
81
|
-
<usa-spinner kind="fluent"></usa-spinner>
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
| Category (import) | Components |
|
|
85
|
-
|---|---|
|
|
86
|
-
| **Entrance & scroll** (`/components/reveal`) | `<usa-reveal>` (12 effects) · `<usa-stagger>` · `<usa-scroll-progress>` · `<usa-scrolly>` (sticky scrollytelling) |
|
|
87
|
-
| **Text** (`/components/text`) | `<usa-typewriter>` · `<usa-split-text>` · `<usa-scramble>` · `<usa-counter>` · `<usa-shimmer-text>` · `<usa-text-rotate>` · `<usa-wave-text>` · `<usa-glitch>` · `<usa-gradient-text>` · `<usa-handwriting>` · `<usa-scroll-highlight>` |
|
|
88
|
-
| **Interaction** (`/components/interaction`) | `<usa-ripple>` · `<usa-magnetic>` · `<usa-tilt>` · `<usa-spotlight>` (Fluent reveal highlight) · `<usa-press>` · `<usa-toggle>` |
|
|
89
|
-
| **Loading & feedback** (`/components/feedback`) | `<usa-spinner>` (WinUI ring, Windows dots, ring, dots, pulse, bars) · `<usa-skeleton>` · `<usa-progress>` · `<usa-toaster>` + `toast()` · `<usa-check>` |
|
|
90
|
-
| **Background & decoration** (`/components/background`) | `<usa-aurora>` · `<usa-particles>` · `<usa-grain>` · `<usa-marquee>` · `<usa-acrylic>` (Acrylic / Mica) · `<usa-grid-glow>` · `<usa-blobs>` · `<usa-water-ripple>` · `<usa-dot-network>` · `fluentPreset()` (Mica · Acrylic · Reveal) |
|
|
91
|
-
| **Transitions** (`/components/transitions`) | `<usa-dialog>` (modal / drawer / sheet) · `<usa-accordion>` · `<usa-view-switch>` · `viewTransition()` · `flip()` |
|
|
92
|
-
| **Spring & physics** (`/components/physics`) | `<usa-spring>` (bounce-in · pop · drop · jelly · rubber-band) · `<usa-draggable>` (spring-back · inertia · snap) · `<usa-overscroll>` · `spring()` · `createSpring()` · `SPRING_PRESETS` |
|
|
93
|
-
| **Card effects** (`/components/cards`) | `<usa-card>` (flip · holo · glass · border-glow · conic-border · lift · spotlight · sheen · parallax-layers · expand — combinable) · `<usa-card-stack>` (swipe) · `<usa-sticky-stack>` · `<usa-carousel-3d>` |
|
|
94
|
-
| **Click & tap** (`/components/click`) | `<usa-button>` **button click deformation** (squash · wobble · gooey · dent · shape morph · submit→loading→success) · `<usa-icon-morph>` · `<usa-click>` (ripple · burst · confetti · squish · press-spring · shake) · `<usa-like>` · `<usa-hold>` · `<usa-double-tap>` · `<usa-checkbox>` · `haptic()` (click effects from code: `playEffect(el, 'confetti')`) |
|
|
95
|
-
| **UI components & variants** (`/components/ui`) | `<usa-tabs>` · `<usa-drawer>` · `<usa-bottom-sheet>` · `<usa-pull-refresh>` · `<usa-fab>` · `<usa-navbar>` · `<usa-slider>` · `<usa-rating>` · `<usa-tooltip>` · `<usa-popover>` · `<usa-badge>` · `<usa-avatar-stack>` · `variant="minimal \| neon \| glass \| brutalist \| fluent \| material"` on every component |
|
|
96
|
-
| **Page & app-wide** (`/components/page`) | `pageTransition()` (fade · slide · circle · blinds · pixel · zoom; SPA + MPA) · `themeTransition()` · `<usa-cursor>` · `smoothScroll()` · `<usa-fullpage>` · `<usa-loading-bar>` · `<usa-back-to-top>` · `<usa-ambient>` (particles · snow · stars · noise · gradient) · `<usa-splash>` · `<usa-auto-skeleton>` · `<usa-motion-switch>` / `setMotionIntensity()` |
|
|
97
|
-
| **Timeline & choreography** (`/components/timeline`) | `timeline()` (chain · overlap · labels · seek · reverse · scrub) · `<usa-timeline>` (`data-tl` steps) |
|
|
98
|
-
| **Gestures** (`/components/gesture`) | `gesture()` (pan · swipe · pinch · long-press · tap · double-tap → springs) · `<usa-swipeable>` · `<usa-pinch-zoom>` |
|
|
99
|
-
| **SVG** (`/components/svg`) | `<usa-draw>` (line drawing) · `<usa-morph>` (path morph) · `<usa-mask-reveal>` · `<usa-anim-icon>` · `morphTo()` · `interpolatePath()` |
|
|
100
|
-
| **Canvas & WebGL** (`/components/webgl`) | `<usa-shader>` (gradient · plasma · waves · aurora · snow · fireflies · stars · bokeh · rain · custom GLSL) · `<usa-post-fx>` (vignette · grain · chromatic · CRT · bloom · pixelate · duotone · glitch) · `<usa-distort>` · `<usa-liquid>` · `glQuad()` — adaptive quality, graceful fallback |
|
|
101
|
-
| **3D & depth** (`/components/depth`) | `<usa-cube>` · `<usa-depth>` (pointer · gyroscope · scroll depth parallax) · `deviceTilt()` · (+ `<usa-carousel-3d>` in cards) |
|
|
102
|
-
| **Layout animation** (`/components/layout`) | `<usa-auto-animate>` / `autoAnimate()` (list & grid reflow) · `<usa-masonry>` · `sharedTransition()` (shared elements) |
|
|
103
|
-
| **Effect packs** (`/components/packs`) | `<usa-pack>` (`name="ecommerce \| portfolio \| dashboard \| game \| landing"`) · `applyPack()` · `flyToCart()` · `countUp()` |
|
|
104
|
-
| **Effects — plugin API** (`/components/fx`) | `<usa-fx>` (`effect` · `trigger` click / hover / enter / load / loop) · `registerEffect()` · `playEffect()` · `bindEffect()` · built-ins: every timeline entrance, pulse · pop · jelly · wiggle · heartbeat · bounce · flash · tada · shake, burst · confetti · ripple |
|
|
105
|
-
| **Effect packs** (`/components/effects`) | `registerAllEffects()` · card & click 2.0 · physics · page-wide · `<usa-story>` scroll stories · generative backgrounds · sound-reactive (`<usa-audio>`) · cursor trails & gestures (`<usa-gesture-fx>`) · theme packs (`<usa-theme>`) · 23 micro-interactions · `<usa-player>` JSON animations |
|
|
106
|
-
|
|
107
|
-
Whole bundle ≈ 22 kB gzip (JS + CSS); one category 3.5–6.4 kB; a single component ≈ 2 kB. The scroll-animation core below is unaffected.
|
|
108
|
-
|
|
109
|
-
## v2.0.0 🎉
|
|
110
|
-
|
|
111
|
-
- **Native scroll-driven animations by default** (`engine: 'auto'`) where the browser supports `animation-timeline: view()`, JS everywhere else.
|
|
112
|
-
- **ESM-first package** with types for every entry: `use-scroll-animate`, `/react`, `/vue`, `/svelte`, `/solid`, `/element`.
|
|
113
|
-
- **Breaking:** React/Vue factories moved to `/react` and `/vue`; `dist/index.mjs`, `dist/index.esm.js`, `dist/types/*` and `dist/*` deep imports are gone; ES2020 output. The CDN URLs `dist/index.umd.js` and `dist/element.umd.js` are unchanged. Upgrade steps: [MIGRATION](./CHANGELOG.md#migration-from-1x).
|
|
114
|
-
|
|
115
|
-
## Documentation
|
|
116
|
-
|
|
117
|
-
- 📖 [API reference](./docs/API.md) — every export, option, attribute and config key
|
|
118
|
-
- 🧩 [Animated components](./docs/components.md) — every `<usa-*>` element, by category · [Windows apps guide](./docs/windows-apps.md) (Electron, Tauri, WebView2, PWA)
|
|
119
|
-
- 🎛️ [Demo / preset playground](./demo/index.html) — every preset clickable, no build step (open `demo/index.html` from a clone)
|
|
120
|
-
- 🎞️ [Preset reference](./docs/presets.md) — all 214 presets by category (33 core + 181 extended)
|
|
121
|
-
- 🔁 Migration guides: [from AOS](./docs/migration-from-aos.md) · [from GSAP ScrollTrigger](./docs/migration-from-gsap-scrolltrigger.md)
|
|
122
|
-
- ⚠️ [Upgrading to 2.0](./docs/deprecations.md) — what 2.0 removed and what replaces it (also the MIGRATION section of the [CHANGELOG](./CHANGELOG.md))
|
|
123
|
-
|
|
124
|
-
## Installation
|
|
23
|
+
## Install
|
|
125
24
|
|
|
126
25
|
```bash
|
|
127
|
-
npm
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
## Native scroll-driven engine (`engine`) 🏎️
|
|
131
|
-
|
|
132
|
-
In browsers that support CSS scroll-driven animations (`CSS.supports('animation-timeline: view()')`), presets can run on the browser's native **view timeline** instead of the JavaScript engine. The animation is then linked to the scroll position (it plays as the element scrolls in, off the main thread) rather than started by IntersectionObserver and played over a fixed `duration`.
|
|
133
|
-
|
|
134
|
-
```js
|
|
135
|
-
ScrollAnimate.observe('.card', { animation: 'fade-in-up' }); // native where supported (default 'auto')
|
|
136
|
-
ScrollAnimate.observe('.card', { animation: 'fade-in-up', engine: 'js' }); // always time-based
|
|
137
|
-
const sa = createScrollAnimate({ defaultEngine: 'js' }); // 1.x behaviour for an instance
|
|
26
|
+
npm i motionary
|
|
138
27
|
```
|
|
139
28
|
|
|
140
29
|
```html
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|---|---|
|
|
146
|
-
| `'auto'` | **Default since 2.0.** Native view timeline when supported, otherwise JS. Also JS when the element sets `duration`, `delay`, `offset` or `stagger` itself (those only mean something for a time-based animation). |
|
|
147
|
-
| `'css'` | Native view timeline whenever supported (ignores time-based options), otherwise JS. |
|
|
148
|
-
| `'js'` | IntersectionObserver + time-based Web Animation (the 1.x default). `createScrollAnimate({ defaultEngine: 'js' })` restores 1.x behaviour everywhere. |
|
|
149
|
-
|
|
150
|
-
Notes:
|
|
151
|
-
- With the native engine, `duration`, `delay`, `threshold`, `offset` and `stagger` don't apply; the animation spans `viewRange` (default `['entry 0%', 'entry 100%']`, i.e. from the moment the element starts entering until it is fully in view). `easing` still applies.
|
|
152
|
-
- `once` (default) freezes the end state when the animation completes, so scrolling back up does not reverse it; with `repeat: true` it keeps following the scroll in both directions.
|
|
153
|
-
- Callbacks (`onEnter`, `onLeave`, `onStart`, `onComplete`), `onProgress`, `progressVar` and `parallax` keep working.
|
|
154
|
-
- Class-name mode (`useClassNames`), `prefers-reduced-motion`, `animate()`, `timeline()` and `staggerChildren()` always use the JS engine.
|
|
155
|
-
- `supportsScrollTimeline()` is exported if you want to branch on support yourself.
|
|
156
|
-
|
|
157
|
-
## v1.4.0 New Features ✨
|
|
158
|
-
|
|
159
|
-
### True scroll progress (`progressMode: 'scroll'`)
|
|
160
|
-
By default `onProgress` reports the element's *visible ratio*, which never reaches 1 for elements taller than the screen. Opt in to real scroll progress: `0` when the element's top reaches the bottom of the viewport, `1` when its bottom leaves the top.
|
|
161
|
-
|
|
162
|
-
```js
|
|
163
|
-
ScrollAnimate.observe('.chapter', {
|
|
164
|
-
progressMode: 'scroll',
|
|
165
|
-
onProgress: (el, p) => el.style.setProperty('--progress', p),
|
|
166
|
-
});
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
Parallax uses the same progress, so `progressMode: 'scroll'` also gives smooth parallax on tall sections. HTML: `data-sa-progress="scroll"`. Also exported as a helper: `getScrollProgress(el, root?)`.
|
|
170
|
-
|
|
171
|
-
### Stagger dynamically added children
|
|
172
|
-
`staggerChildren()` (vanilla), `useScrollStagger()` (React **and now Vue**) accept `observeChildren: true`. A `MutationObserver` picks up children added later (infinite lists, "load more"): those added before the reveal join the stagger; those added after it animate when they scroll into view, staggered per batch.
|
|
173
|
-
|
|
174
|
-
```js
|
|
175
|
-
import { staggerChildren } from 'use-scroll-animate';
|
|
176
|
-
const stop = staggerChildren(document.querySelector('#feed'), {
|
|
177
|
-
animation: 'fade-in-up', stagger: 60, observeChildren: true,
|
|
178
|
-
});
|
|
179
|
-
// later: stop();
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
### Timelines with `timeline()`
|
|
183
|
-
Chain animations across elements on one playhead. Each step starts when the previous one ends; `at` overlaps (`'-=300'`), waits (`'+=200'`), aligns with the previous step (`'<'`), jumps to a label or an absolute time. Play it, reverse it, seek it, or scrub it with scroll. (Replaces `sequence()`, removed in 4.0 — see [upgrading-4.md](./docs/upgrading-4.md).)
|
|
184
|
-
|
|
185
|
-
```js
|
|
186
|
-
import { timeline } from 'use-scroll-animate';
|
|
187
|
-
|
|
188
|
-
const tl = timeline({ defaults: { duration: 700 } })
|
|
189
|
-
.to('.hero h1', 'fade-up')
|
|
190
|
-
.to('.hero p', 'blur', { at: '-=300' })
|
|
191
|
-
.to('.hero .btn', 'scale', { stagger: 80 });
|
|
192
|
-
|
|
193
|
-
await tl.play(); // resolves at the end
|
|
194
|
-
tl.scrub(document.querySelector('.hero')); // or tie progress to scroll
|
|
30
|
+
<!-- CDN (no build) -->
|
|
31
|
+
<script src="https://unpkg.com/motionary@6/dist/index.umd.js"></script> <!-- window.ScrollAnimate -->
|
|
32
|
+
<script src="https://unpkg.com/motionary@6/dist/presets-extended.umd.js"></script> <!-- +181 presets -->
|
|
33
|
+
<script src="https://unpkg.com/motionary@6/dist/components.umd.js"></script> <!-- every <usa-*>, window.UsaComponents -->
|
|
195
34
|
```
|
|
196
|
-
Declaratively: `<usa-timeline>` with `data-tl="fade-up"` children (`use-scroll-animate/components/timeline`).
|
|
197
35
|
|
|
198
|
-
|
|
199
|
-
`scale-up`, `blur-in-up`, `flip-up`, `flip-down`, `rotate-left`, `rotate-right`, and clip-path reveals `clip-up`, `clip-down`, `clip-left`, `clip-right`, `clip-circle`.
|
|
36
|
+
jsDelivr works too: `https://cdn.jsdelivr.net/npm/motionary@6/dist/…`. Existing `use-scroll-animate` installs and `unpkg.com/use-scroll-animate@6` URLs keep working.
|
|
200
37
|
|
|
201
|
-
|
|
202
|
-
Finished `once` elements are dropped from the registry right after they animate (unless they still need parallax/`onProgress`), so long pages and SPAs don't keep thousands of records alive. They're remembered in a `WeakSet`, so `init()`/`observe()` never replay them. Set `createScrollAnimate({ autoUnregister: false })` to keep them listed in `getObservedElements()` as before.
|
|
38
|
+
## 30-second quickstart
|
|
203
39
|
|
|
204
|
-
|
|
205
|
-
ESM-first since 2.0: `import` resolves to `dist/*.js` + `dist/*.d.ts`, `require` to `dist/*.cjs` + `dist/*.d.cts`, for the main entry and every subpath. See [2.0](#v200-) below.
|
|
206
|
-
|
|
207
|
-
## v1.3.0: Custom Easing 🎨
|
|
208
|
-
|
|
209
|
-
You can now use custom cubic-bezier curves or even JavaScript functions to create complex physical effects.
|
|
210
|
-
|
|
211
|
-
### 1. Cubic-Bezier Array
|
|
212
|
-
Pass an array of 4 numbers to define a custom cubic-bezier curve.
|
|
213
|
-
|
|
214
|
-
```javascript
|
|
215
|
-
ScrollAnimate.observe('.box', {
|
|
216
|
-
animation: 'fade-in-up',
|
|
217
|
-
easing: [0.68, -0.55, 0.265, 1.55] // Custom bounce effect
|
|
218
|
-
});
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
### 2. Custom Easing Function
|
|
222
|
-
Pass a function `(t: number) => number` for complete control over the animation timing.
|
|
223
|
-
|
|
224
|
-
```javascript
|
|
225
|
-
ScrollAnimate.observe('.box', {
|
|
226
|
-
easing: (t) => t * t * (3 - 2 * t) // Custom smooth-step
|
|
227
|
-
});
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
### 3. New Physics Presets
|
|
231
|
-
We've added high-quality physics-based easing presets:
|
|
232
|
-
- `spring`: Standard spring effect.
|
|
233
|
-
- `soft-spring`: Gentle, bouncy entrance.
|
|
234
|
-
- `heavy-bounce`: Dramatic bounce effect.
|
|
235
|
-
|
|
236
|
-
## Quick Start (Vanilla JS / HTML)
|
|
40
|
+
Mark elements with `data-sa` and pick a preset with `data-sa-animation` (every option has a `data-sa-*` attribute), or use the JS API:
|
|
237
41
|
|
|
238
42
|
```html
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
</div>
|
|
242
|
-
|
|
243
|
-
<div data-sa data-sa-animation="zoom-in" data-sa-easing="[0.34, 1.56, 0.64, 1]">
|
|
244
|
-
I use a custom cubic-bezier array!
|
|
245
|
-
</div>
|
|
246
|
-
|
|
43
|
+
<!-- 1. HTML only: data attributes + one init() call -->
|
|
44
|
+
<h2 data-sa data-sa-animation="fade-in-up">Hello</h2>
|
|
45
|
+
<div data-sa data-sa-animation="bounce-in-up" data-sa-delay="150">Card</div>
|
|
247
46
|
<script type="module">
|
|
248
|
-
import ScrollAnimate from '
|
|
249
|
-
|
|
47
|
+
import ScrollAnimate from 'motionary';
|
|
48
|
+
import 'motionary/presets/extended'; // optional: +181 presets (bounce-in-up, clip-diamond, …)
|
|
49
|
+
ScrollAnimate.init(); // picks up every [data-sa]
|
|
250
50
|
</script>
|
|
251
51
|
```
|
|
252
52
|
|
|
253
|
-
## Options
|
|
254
|
-
|
|
255
|
-
| Option | Type | Default | Description |
|
|
256
|
-
|--------|------|---------|-------------|
|
|
257
|
-
| `animation` | `string` \| `string[]` \| `{ from, to }` | `'fade-in-up'` | Preset name, array of presets to combine, or custom keyframes |
|
|
258
|
-
| `duration` | `number` | `600` | Duration in ms |
|
|
259
|
-
| `delay` | `number` | `0` | Delay in ms |
|
|
260
|
-
| `easing` | `string` \| `number[]` \| `function` | `'ease'` | CSS easing, preset (`spring`, `soft-spring`, `heavy-bounce`), cubic-bezier array, or `(t) => number` |
|
|
261
|
-
| `threshold` | `number` \| `number[]` | `0.1` | IntersectionObserver threshold(s) |
|
|
262
|
-
| `rootMargin` | `string` | `'0px'` | IntersectionObserver root margin |
|
|
263
|
-
| `once` | `boolean` | `true` | Animate only the first time the element enters |
|
|
264
|
-
| `repeat` | `boolean` | `false` | Re-hide on leave and replay on every entry |
|
|
265
|
-
| `offset` | `number` | `0` | Trigger the animation this many px after the element enters the viewport |
|
|
266
|
-
| `stagger` | `number` | `0` | Extra delay (ms) per sibling revealed in the same batch |
|
|
267
|
-
| `parallax` | `{ x, y, rotate, scale, speed }` | `{}` | Scroll-driven parallax (keeps running after the entrance animation) |
|
|
268
|
-
| `onStart` / `onComplete` / `onEnter` / `onLeave` | `(el) => void` | – | Lifecycle callbacks |
|
|
269
|
-
| `onProgress` | `(el, progress) => void` | – | Progress (0–1) as the element scrolls — visible ratio, or true scroll progress with `progressMode: 'scroll'` |
|
|
270
|
-
| `progressMode` | `'ratio'` \| `'scroll'` | `'ratio'` | How `onProgress`/parallax progress is measured (`'scroll'`: 0 = top enters at the bottom, 1 = bottom leaves at the top) |
|
|
271
|
-
| `engine` | `'auto'` \| `'js'` \| `'css'` | `'auto'` | Run presets on the browser's native scroll-driven timeline when supported (`'auto'`/`'css'`), falling back to JS. See [Native scroll-driven engine](#native-scroll-driven-engine-engine-) |
|
|
272
|
-
| `exit` | `boolean` \| preset \| `{ from, to }` | `false` | Animate out (reverse) when leaving the viewport, back in on re-entry. Implies `repeat`. See [Exit animations](#exit-animations-exit) |
|
|
273
|
-
| `viewRange` | `[string, string]` | `['entry 0%', 'entry 100%']` | Native engine only: view-timeline range of the entrance |
|
|
274
|
-
| `progressVar` | `string` | – | Write progress (0–1, same value as `onProgress`) to this CSS custom property, e.g. `'--sa-progress'`, for scroll-driven effects in plain CSS |
|
|
275
|
-
|
|
276
|
-
Every option is also available as a data attribute: `data-sa-animation`, `data-sa-duration`, `data-sa-delay`, `data-sa-easing`, `data-sa-threshold`, `data-sa-root-margin`, `data-sa-once`, `data-sa-repeat`, `data-sa-offset`, `data-sa-stagger`, `data-sa-progress`, `data-sa-progress-var` (bare attribute = `--sa-progress`), `data-sa-engine`, `data-sa-exit` (bare = `true`, or a preset), `data-sa-view-range` (`"entry 0%, cover 40%"`).
|
|
277
|
-
|
|
278
|
-
**Presets (33 core):** `fade-in`, `fade-in-up|down|left|right`, `zoom-in`, `zoom-out`, `scale-up`, `flip-x`, `flip-y`, `flip-up`, `flip-down`, `slide-up|down|left|right`, `bounce`, `rotate-in`, `rotate-left`, `rotate-right`, `blur-in`, `blur-in-up`, `skew-in`, `scale-x`, `scale-y`, `clip-up|down|left|right`, `clip-circle`, `shimmer`, `pulse`, `swing`. Combine them with an array, e.g. `['fade-in', 'clip-up']`. **+ 181 extended presets** with `import 'use-scroll-animate/presets/extended'` — see *Scroll presets 2.0* above and [docs/presets.md](./docs/presets.md).
|
|
279
|
-
|
|
280
|
-
**Global config** (`createScrollAnimate(config)` / `configure()`): `defaultAnimation`, `defaultDuration`, `defaultDelay`, `defaultEasing`, `defaultThreshold`, `defaultRootMargin`, `defaultRepeat`, `defaultOnce`, `defaultOffset`, `hiddenClass`, `visibleClass`, `useClassNames`, `disabled`, `root`, `autoUnregister` (default `true`), `defaultEngine` (default `'auto'`).
|
|
281
|
-
|
|
282
|
-
### Progress as a CSS variable (`progressVar`)
|
|
283
|
-
|
|
284
|
-
Drive any CSS property from scroll position without writing JavaScript callbacks. The element's progress is written to a custom property on the element itself:
|
|
285
|
-
|
|
286
|
-
```html
|
|
287
|
-
<div data-sa data-sa-progress="scroll" data-sa-progress-var class="hero">…</div>
|
|
288
|
-
|
|
289
|
-
<style>
|
|
290
|
-
@media (prefers-reduced-motion: no-preference) {
|
|
291
|
-
.hero { transform: translateY(calc((1 - var(--sa-progress, 0)) * 60px)); opacity: calc(0.4 + var(--sa-progress, 0)); }
|
|
292
|
-
}
|
|
293
|
-
</style>
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
```js
|
|
297
|
-
ScrollAnimate.observe('.bar', { progressVar: '--fill', progressMode: 'scroll' });
|
|
298
|
-
// .bar::after { transform: scaleX(var(--fill, 0)); }
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
It uses the same rAF-throttled / IntersectionObserver pipeline as `onProgress`, keeps updating after the entrance animation, and is still written under reduced motion (it is data) — guard motion in your CSS with `prefers-reduced-motion` as above.
|
|
302
|
-
|
|
303
|
-
### Exit animations (`exit`)
|
|
304
|
-
|
|
305
|
-
Animate elements out when they leave the viewport, and back in when they return:
|
|
306
|
-
|
|
307
|
-
```js
|
|
308
|
-
ScrollAnimate.observe('.card', { animation: 'fade-in-up', exit: true }); // reverse of the entrance
|
|
309
|
-
ScrollAnimate.observe('.toast', { animation: 'zoom-in', exit: 'fade-in-down' }); // leave with another preset (played in reverse)
|
|
310
|
-
```
|
|
311
|
-
|
|
312
|
-
```html
|
|
313
|
-
<div data-sa data-sa-animation="fade-in-left" data-sa-exit>…</div>
|
|
314
|
-
<div data-sa data-sa-exit="zoom-out">…</div>
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
`exit` accepts `true`, a preset name, an array of presets or `{ from, to }`; the exit plays that animation **in reverse** over `duration` (no delay) and the element stays in its hidden state until it re-enters. It implies `repeat: true` (set `repeat` explicitly to override). With the native engine the exit is scroll-linked too (the view timeline's `exit` range). In class-name mode the hidden/visible classes are swapped back. Under `prefers-reduced-motion` nothing moves and the element stays visible.
|
|
318
|
-
|
|
319
|
-
### Parallax helper (`parallax()`)
|
|
320
|
-
|
|
321
|
-
```js
|
|
322
|
-
import { parallax } from 'use-scroll-animate';
|
|
323
|
-
|
|
324
|
-
const stop = parallax('.hero-bg', { speed: 0.3 }); // lags behind the scroll (background)
|
|
325
|
-
parallax('.badge', { speed: -0.15, axis: 'x' }); // drifts sideways, ahead of the scroll
|
|
326
|
-
stop(); // remove listeners and the inline styles it set
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
| Option | Default | Description |
|
|
330
|
-
|---|---|---|
|
|
331
|
-
| `speed` | `0.2` | Total shift while the element crosses the viewport, as a fraction of the viewport (`0.2` = 20vh / 20vw). Positive = slower than the page, negative = faster |
|
|
332
|
-
| `axis` | `'y'` | `'y'` or `'x'` |
|
|
333
|
-
| `progressVar` | `'--sa-parallax'` | CSS custom property receiving the scroll progress (0–1, same scale as `progressVar` with `progressMode: 'scroll'`) |
|
|
334
|
-
| `root` | viewport | Scroll container |
|
|
335
|
-
| `respectReducedMotion` | `true` | Under `prefers-reduced-motion: reduce` only the variable is written, no offset |
|
|
336
|
-
|
|
337
|
-
It writes the offset to the individual CSS **`translate`** property, so it composes with entrance animations and any `transform` you set. One IntersectionObserver plus a passive, rAF-throttled scroll listener that is attached only while a target is on screen. Tree-shaken it adds under 1 kB gzipped. (The old `parallax: { x, y, rotate, scale }` option was removed in 3.0 — see [Upgrading to 3.0](./docs/upgrading-3.md).)
|
|
338
|
-
|
|
339
|
-
## Instance API
|
|
340
|
-
|
|
341
|
-
```js
|
|
342
|
-
import ScrollAnimate, { createScrollAnimate } from 'use-scroll-animate';
|
|
343
|
-
|
|
344
|
-
ScrollAnimate.init(root?); // observe every [data-sa] element (safe to call again after DOM changes)
|
|
345
|
-
const stop = ScrollAnimate.watch(root?); // init() + auto-observe [data-sa] elements added later; stop() to end
|
|
346
|
-
ScrollAnimate.observe(target, opts); // selector, Element, NodeList or Element[]
|
|
347
|
-
ScrollAnimate.unobserve(target); // stop observing (elements that never animated are made visible)
|
|
348
|
-
ScrollAnimate.animate(target, opts); // play an animation right now
|
|
349
|
-
ScrollAnimate.refresh(); // rebuild observers, e.g. after configure({ root })
|
|
350
|
-
ScrollAnimate.configure({ ... }); // update global defaults
|
|
351
|
-
ScrollAnimate.destroy(); // disconnect everything
|
|
352
|
-
|
|
353
|
-
const sa = createScrollAnimate({ root: document.querySelector('#scroller') }); // isolated instance
|
|
354
|
-
|
|
355
|
-
// Helpers (tree-shakeable)
|
|
356
|
-
import { timeline, staggerChildren, getScrollProgress } from 'use-scroll-animate';
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
### Watching the DOM (`watch()`)
|
|
360
|
-
|
|
361
|
-
For SPAs, CMS content, infinite lists or anything rendered after page load, `watch()` replaces "call `init()` again after every DOM change":
|
|
362
|
-
|
|
363
53
|
```js
|
|
364
|
-
|
|
54
|
+
// 2. JS API
|
|
55
|
+
import ScrollAnimate, { staggerChildren, parallax, timeline } from 'motionary';
|
|
365
56
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
stop(); // stop watching (destroy() also stops every watcher)
|
|
57
|
+
ScrollAnimate.observe('.card', { animation: 'zoom-in-up', duration: 800, easing: 'spring' });
|
|
58
|
+
staggerChildren(document.querySelector('.grid'), { animation: 'stagger-pop', stagger: 60 });
|
|
59
|
+
parallax('.hero-bg', { speed: 0.3 });
|
|
60
|
+
ScrollAnimate.observe('.logo', { animation: 'scrub-spin', engine: 'css', viewRange: ['cover 0%', 'cover 100%'] });
|
|
371
61
|
```
|
|
372
62
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
Via a `<script>` tag (UMD build), the default instance lives at `ScrollAnimate.default`:
|
|
376
|
-
|
|
377
|
-
```html
|
|
378
|
-
<script src="https://unpkg.com/use-scroll-animate"></script>
|
|
379
|
-
<script>ScrollAnimate.default.init();</script>
|
|
380
|
-
```
|
|
381
|
-
|
|
382
|
-
## Frameworks
|
|
383
|
-
|
|
384
|
-
### React & Vue
|
|
63
|
+
Frameworks — each adapter is its own entry point and cleans up on unmount:
|
|
385
64
|
|
|
386
65
|
```jsx
|
|
66
|
+
// React
|
|
387
67
|
import React from 'react';
|
|
388
|
-
import { createReactHooks } from '
|
|
389
|
-
const { useScrollAnimate
|
|
68
|
+
import { createReactHooks } from 'motionary/react';
|
|
69
|
+
const { useScrollAnimate } = createReactHooks(React);
|
|
390
70
|
|
|
391
|
-
function Card() {
|
|
392
|
-
const ref = useScrollAnimate({ animation: '
|
|
71
|
+
export function Card() {
|
|
72
|
+
const ref = useScrollAnimate({ animation: 'fade-in-up' });
|
|
393
73
|
return <div ref={ref}>Hello</div>;
|
|
394
74
|
}
|
|
395
75
|
```
|
|
396
76
|
|
|
397
|
-
```
|
|
77
|
+
```vue
|
|
78
|
+
<!-- Vue 3 -->
|
|
79
|
+
<script setup>
|
|
398
80
|
import { ref, onMounted, onUnmounted } from 'vue';
|
|
399
|
-
import { createVueComposables } from '
|
|
400
|
-
const { useScrollAnimate
|
|
401
|
-
const { animateRef } = useScrollAnimate({ animation: '
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
```jsx
|
|
406
|
-
// React: also animate items appended later
|
|
407
|
-
function Feed({ items }) {
|
|
408
|
-
const ref = useScrollStagger({ animation: 'fade-in-up', stagger: 60, observeChildren: true });
|
|
409
|
-
return <ul ref={ref}>{items.map((i) => <li key={i.id}>{i.title}</li>)}</ul>;
|
|
410
|
-
}
|
|
81
|
+
import { createVueComposables } from 'motionary/vue';
|
|
82
|
+
const { useScrollAnimate } = createVueComposables({ ref, onMounted, onUnmounted });
|
|
83
|
+
const { animateRef } = useScrollAnimate({ animation: 'zoom-in' });
|
|
84
|
+
</script>
|
|
85
|
+
<template><div ref="animateRef">Hello</div></template>
|
|
411
86
|
```
|
|
412
87
|
|
|
413
|
-
> Since 2.0 `createReactHooks` / `createVueComposables` are only available from `use-scroll-animate/react` / `use-scroll-animate/vue`.
|
|
414
|
-
|
|
415
|
-
### Svelte (`use-scroll-animate/svelte`)
|
|
416
|
-
|
|
417
|
-
Actions, no `svelte` import needed (Svelte 3, 4 and 5):
|
|
418
|
-
|
|
419
88
|
```svelte
|
|
89
|
+
<!-- Svelte 3–5 -->
|
|
420
90
|
<script>
|
|
421
|
-
import { scrollAnimate
|
|
422
|
-
let items = [];
|
|
91
|
+
import { scrollAnimate } from 'motionary/svelte';
|
|
423
92
|
</script>
|
|
93
|
+
<div use:scrollAnimate={{ animation: 'flip-up' }}>Hello</div>
|
|
94
|
+
```
|
|
424
95
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
96
|
+
```jsx
|
|
97
|
+
// Solid
|
|
98
|
+
import { scrollAnimate } from 'motionary/solid';
|
|
99
|
+
scrollAnimate; // keep the directive import (TypeScript)
|
|
100
|
+
export const Card = () => <div use:scrollAnimate={{ animation: 'blur-in-up' }}>Hello</div>;
|
|
429
101
|
```
|
|
430
102
|
|
|
431
|
-
|
|
103
|
+
```ts
|
|
104
|
+
// Angular (standalone) — the animated Web Components
|
|
105
|
+
import { APP_INITIALIZER, CUSTOM_ELEMENTS_SCHEMA, Component } from '@angular/core';
|
|
106
|
+
import { usaInitializer } from 'motionary/components/angular';
|
|
107
|
+
import 'motionary/presets/extended'; // lets <usa-reveal effect> use every preset name
|
|
108
|
+
// app.config.ts: providers: [{ provide: APP_INITIALIZER, multi: true, useFactory: usaInitializer() }]
|
|
109
|
+
@Component({ standalone: true, schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
110
|
+
template: `<usa-reveal effect="bounce-in-up"><h2>Hello</h2></usa-reveal>` })
|
|
111
|
+
export class Hero {}
|
|
112
|
+
```
|
|
432
113
|
|
|
433
|
-
|
|
114
|
+
Animated components need no framework at all:
|
|
434
115
|
|
|
435
|
-
|
|
116
|
+
```html
|
|
117
|
+
<script type="module">
|
|
118
|
+
import { defineComponents } from 'motionary/components';
|
|
119
|
+
defineComponents(); // or lazyDefine() from 'motionary/components/lazy'
|
|
120
|
+
</script>
|
|
121
|
+
<usa-card effect="holo">…</usa-card>
|
|
122
|
+
<usa-button deform="gooey">Buy</usa-button>
|
|
123
|
+
<usa-fx effect="confetti" trigger="click"><button>Celebrate</button></usa-fx>
|
|
124
|
+
```
|
|
436
125
|
|
|
437
|
-
|
|
438
|
-
import { scrollAnimate, scrollStagger, useScrollAnimate } from 'use-scroll-animate/solid';
|
|
439
|
-
scrollAnimate; scrollStagger; // keep the directive imports (TypeScript)
|
|
126
|
+
## What's inside
|
|
440
127
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
128
|
+
| Area | What you get |
|
|
129
|
+
|---|---|
|
|
130
|
+
| **Scroll presets** | **214** reveal presets (33 core + 181 in `motionary/presets/extended`) in 14 families — fades, zooms, 3D flips & doors, overshoot slides, clip-path shapes, blur & mask, bounce & elastic, colour & light, depth, glitch / typewriter, stagger-ready and scroll-linked `scrub-*`; plus `timeline()` with 10 timeline presets |
|
|
131
|
+
| **Cards, clicks & button morphs** | `<usa-card>` with 10 effects (flip, holo, glass, border glow, …), stacks & 3D carousel; 7 click components with 4 button deforms (squash · wobble · gooey · dent) and icon morphs; 12 registered card / click effects (holo, book-open, shockwave, ink-splash, emoji-rain, …) |
|
|
132
|
+
| **Physics & bounce** | `<usa-spring>`, `<usa-draggable>` (spring-back · inertia · snap), `<usa-overscroll>`; `spring()` / `solveSpring()` with 7 spring presets; 7 physics effects (bounce-in, rubber-band, gravity-text, bell-swing, …) |
|
|
133
|
+
| **Page transitions** | `pageTransition()`, `viewTransition()`, `sharedTransition()`, `flip()`, MPA transitions; 7 page effects (curtain, iris, pixel-dissolve, blinds, velocity-skew, …); `<usa-dialog>`, `<usa-view-switch>` |
|
|
134
|
+
| **Generative backgrounds** | 6 canvas backgrounds (flow-field, voronoi, mesh-gradient, starfield, metaballs, contours) + 9 background elements (aurora, particles, grain, blobs, water ripple, Acrylic / Mica, …) |
|
|
135
|
+
| **Sound-reactive** | `<usa-audio>` + Web Audio beat detection (`createBeatDetector()`, `onBeat()`); 3 audio visualisers (spectrum-bars, pulse-ring, wave-ring); any effect can fire on the beat |
|
|
136
|
+
| **Cursor & gestures** | 5 cursor effects (comet / ribbon / sparkle trails, magnetic dots, spotlight) + `<usa-cursor>`; fling · twist · long-press → effects with `<usa-gesture-fx>`; `<usa-swipeable>`, `<usa-pinch-zoom>` |
|
|
137
|
+
| **Themes** | 5 theme packs (neon · paper · glass · retro · brutalist) via `<usa-theme>` / `applyTheme()`, each with a signature effect; motion tokens (`/components/tokens`) |
|
|
138
|
+
| **Micro-interactions** | 23 ready-made UI moments: copy-success, like-heart, add-to-cart, send-plane, upvote, trash-shake, input-shake, success-check, notify-badge, … |
|
|
139
|
+
| **`<usa-player>` & stories** | `<usa-player>` plays JSON animations (keyframe tracks, presets, effects; load / view / scroll / click triggers) exported from the Playground; `<usa-story>` with 6 scroll-story templates |
|
|
140
|
+
| **WebGL** | `<usa-shader>`, `<usa-distort>`, `<usa-liquid>`, `<usa-post-fx>` — 5 particle presets, 9 post effects (bloom, CRT, chromatic, glitch, …) with CSS fallbacks and a power-saving governor |
|
|
445
141
|
|
|
446
|
-
`
|
|
142
|
+
90 effects share one registry (`registerEffect()` / `playEffect()` / `bindEffect()` / `<usa-fx>`, `motionary/components/fx`); the 5.x packs live in `motionary/components/effects`.
|
|
447
143
|
|
|
448
|
-
###
|
|
144
|
+
### All 94 animated components
|
|
449
145
|
|
|
450
|
-
|
|
451
|
-
<script type="module">
|
|
452
|
-
import { defineScrollAnimate } from 'use-scroll-animate/element';
|
|
453
|
-
defineScrollAnimate(); // registers <scroll-animate>; defineScrollAnimate('my-reveal') for another tag
|
|
454
|
-
</script>
|
|
146
|
+
Import one category (`motionary/components/cards`), everything (`motionary/components`), the CSS-on-demand build (`/components/lite`), or let `lazyDefine()` load only the tags on the page. Wrappers: `/components/react`, `/vue`, `/svelte`, `/solid`, `/angular`.
|
|
455
147
|
|
|
456
|
-
|
|
457
|
-
|
|
148
|
+
| Entry | Elements |
|
|
149
|
+
|---|---|
|
|
150
|
+
| **Scroll reveal** (`/components/reveal`) | `<usa-reveal>` · `<usa-stagger>` · `<usa-scroll-progress>` · `<usa-scrolly>` |
|
|
151
|
+
| **Text** (`/components/text`) | `<usa-typewriter>` · `<usa-split-text>` · `<usa-scramble>` · `<usa-counter>` · `<usa-shimmer-text>` · `<usa-text-rotate>` · `<usa-wave-text>` · `<usa-glitch>` · `<usa-gradient-text>` · `<usa-handwriting>` · `<usa-scroll-highlight>` |
|
|
152
|
+
| **Interaction** (`/components/interaction`) | `<usa-ripple>` · `<usa-magnetic>` · `<usa-tilt>` · `<usa-spotlight>` · `<usa-press>` · `<usa-toggle>` |
|
|
153
|
+
| **Feedback** (`/components/feedback`) | `<usa-spinner>` · `<usa-skeleton>` · `<usa-progress>` · `<usa-toaster>` · `<usa-check>` |
|
|
154
|
+
| **Backgrounds** (`/components/background`) | `<usa-aurora>` · `<usa-particles>` · `<usa-grain>` · `<usa-marquee>` · `<usa-acrylic>` · `<usa-grid-glow>` · `<usa-blobs>` · `<usa-water-ripple>` · `<usa-dot-network>` |
|
|
155
|
+
| **Transitions** (`/components/transitions`) | `<usa-dialog>` · `<usa-accordion>` · `<usa-view-switch>` |
|
|
156
|
+
| **Spring & physics** (`/components/physics`) | `<usa-spring>` · `<usa-draggable>` · `<usa-overscroll>` |
|
|
157
|
+
| **Cards** (`/components/cards`) | `<usa-card>` · `<usa-card-stack>` · `<usa-sticky-stack>` · `<usa-carousel-3d>` |
|
|
158
|
+
| **Click & buttons** (`/components/click`) | `<usa-click>` · `<usa-button>` · `<usa-icon-morph>` · `<usa-like>` · `<usa-hold>` · `<usa-double-tap>` · `<usa-checkbox>` |
|
|
159
|
+
| **UI kit** (`/components/ui`) | `<usa-tabs>` · `<usa-drawer>` · `<usa-bottom-sheet>` · `<usa-pull-refresh>` · `<usa-fab>` · `<usa-navbar>` · `<usa-slider>` · `<usa-rating>` · `<usa-tooltip>` · `<usa-popover>` · `<usa-badge>` · `<usa-avatar-stack>` |
|
|
160
|
+
| **Page-wide** (`/components/page`) | `<usa-cursor>` · `<usa-fullpage>` · `<usa-loading-bar>` · `<usa-back-to-top>` · `<usa-ambient>` · `<usa-splash>` · `<usa-auto-skeleton>` · `<usa-motion-switch>` |
|
|
161
|
+
| **Timeline** (`/components/timeline`) | `<usa-timeline>` |
|
|
162
|
+
| **Gestures** (`/components/gesture`) | `<usa-swipeable>` · `<usa-pinch-zoom>` |
|
|
163
|
+
| **SVG** (`/components/svg`) | `<usa-draw>` · `<usa-morph>` · `<usa-mask-reveal>` · `<usa-anim-icon>` |
|
|
164
|
+
| **WebGL** (`/components/webgl`) | `<usa-shader>` · `<usa-distort>` · `<usa-liquid>` · `<usa-post-fx>` |
|
|
165
|
+
| **3D depth** (`/components/depth`) | `<usa-cube>` · `<usa-depth>` |
|
|
166
|
+
| **Layout** (`/components/layout`) | `<usa-auto-animate>` · `<usa-masonry>` |
|
|
167
|
+
| **Packs** (`/components/packs`) | `<usa-pack>` |
|
|
168
|
+
| **Effect registry** (`/components/fx`) | `<usa-fx>` |
|
|
169
|
+
| **Effect packs** (`/components/effects`) | `<usa-player>` · `<usa-story>` · `<usa-audio>` · `<usa-theme>` · `<usa-gesture-fx>` |
|
|
170
|
+
|
|
171
|
+
## Accessibility & reduced motion
|
|
172
|
+
|
|
173
|
+
- With `prefers-reduced-motion: reduce`, scroll reveals show content immediately (no entrance, parallax or scrub motion), and components fall back to calm states (`staticAlternative()` / `adaptKeyframes()`).
|
|
174
|
+
- `motionary/components/a11y`: `setMotionSensitivity()` levels let users drop flashes, loops or parallax; `announce()` live regions; `auditMotionA11y()`; `baselineReport()`. `<usa-motion-switch>` is a ready-made user-facing motion toggle.
|
|
175
|
+
- Details: [docs/accessibility.md](./docs/accessibility.md).
|
|
176
|
+
|
|
177
|
+
## Performance & size
|
|
178
|
+
|
|
179
|
+
No scroll listeners by default (IntersectionObserver), animations on the compositor (`transform`, `opacity`, `filter`, `clip-path`), optional off-main-thread native scroll timelines (`engine: 'css'`). Every entry is tree-shakeable and has a gzip budget enforced in CI (`size-budget.json`). Measured for 6.1 (minified + gzip):
|
|
180
|
+
|
|
181
|
+
| What you import | gzip |
|
|
182
|
+
|---|---:|
|
|
183
|
+
| `import ScrollAnimate from 'motionary'` (default instance) | 5.72 kB |
|
|
184
|
+
| Everything from the main entry | 8.69 kB |
|
|
185
|
+
| `dist/index.umd.js` (CDN) | 8.81 kB |
|
|
186
|
+
| `parallax()` alone | 1.22 kB |
|
|
187
|
+
| `motionary/presets/extended` (181 presets) | 4.69 kB |
|
|
188
|
+
| `motionary/components/reveal` | 4.10 kB |
|
|
189
|
+
| `motionary/components/effects` (8 effect packs) | 26.40 kB |
|
|
190
|
+
| `motionary/components/lite` (every component, CSS on demand) | 68.48 kB |
|
|
191
|
+
| `motionary/components` (every component + CSS) | 85.15 kB |
|
|
192
|
+
| `dist/components.umd.js` (CDN, everything) | 106.75 kB |
|
|
193
|
+
|
|
194
|
+
More: [docs/performance.md](./docs/performance.md).
|
|
195
|
+
|
|
196
|
+
## Browser support
|
|
197
|
+
|
|
198
|
+
Evergreen browsers since 2023: Chrome / Edge ≥ 111, Safari ≥ 16.4, Firefox ≥ 115, WebView2, Electron ≥ 24 (Custom Elements, Web Animations, IntersectionObserver, ResizeObserver, constructable stylesheets). View Transitions and scroll-driven animations are progressive — used when present, JS fallback otherwise. Importing on the server (SSR) is a no-op. Check a browser with `baselineReport()`.
|
|
458
199
|
|
|
459
|
-
|
|
200
|
+
## Documentation
|
|
460
201
|
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
202
|
+
- [API reference](./docs/API.md) — every export, option and `data-sa-*` attribute
|
|
203
|
+
- [Presets](./docs/presets.md) — all 214 by category
|
|
204
|
+
- [Components](./docs/components.md) — every `<usa-*>` element, attribute and event
|
|
205
|
+
- [Frameworks & SSR](./docs/frameworks-ssr.md) · [Windows apps](./docs/windows-apps.md) · [Hybrid apps (MAUI, Flutter, Electron, Tauri)](./docs/hybrid-apps.md)
|
|
206
|
+
- [Motion tokens](./docs/motion-tokens.md) · [Migrating from AOS](./docs/migration-from-aos.md) · [from GSAP ScrollTrigger](./docs/migration-from-gsap-scrolltrigger.md)
|
|
207
|
+
- [Demo page](./demo/index.html) — every preset clickable, no build step
|
|
464
208
|
|
|
465
|
-
|
|
209
|
+
## Upgrading
|
|
466
210
|
|
|
467
|
-
|
|
211
|
+
- From `use-scroll-animate`: `npm i motionary` and replace `use-scroll-animate` with `motionary` in imports and CDN URLs — nothing else changes (the old package name keeps receiving the same releases).
|
|
212
|
+
- [Upgrading to 6.0](./docs/upgrading-6.md) (`npx usa-codemod-6`) · [Upgrading to 5.0](./docs/upgrading-5.md) (`npx usa-codemod-5`) · [4.0](./docs/upgrading-4.md) · [3.0](./docs/upgrading-3.md) · [2.0](./docs/deprecations.md)
|
|
213
|
+
- [Changelog](./CHANGELOG.md)
|
|
468
214
|
|
|
469
|
-
##
|
|
215
|
+
## Roadmap
|
|
470
216
|
|
|
471
|
-
|
|
217
|
+
One version per PR towards 7.0 — particles & fluids, text effects, light & materials, 3D scenes, morphing, transitions, weather, interactive physics: [docs/ROADMAP.md](./docs/ROADMAP.md).
|
|
472
218
|
|
|
473
|
-
##
|
|
219
|
+
## Contributing & license
|
|
474
220
|
|
|
475
|
-
|
|
221
|
+
Issues and PRs welcome — see [CONTRIBUTING.md](./CONTRIBUTING.md). MIT © HarrisonCN — see [LICENSE](./LICENSE).
|