Installation
Install the core library or one of the framework adapters with your preferred package manager.
Core library
The core package works with any HTML page — no framework required.
# npm
npm install viewmotion
# pnpm
pnpm add viewmotion
# yarn
yarn add viewmotion Framework adapters
Each adapter depends on the core package, which is installed automatically as a peer dependency.
# React
npm install viewmotion-react
# Vue
npm install viewmotion-vue
# Svelte
npm install viewmotion-svelte Smooth scroll (optional)
viewmotion supports optional smooth scrolling via Lenis. Install it as a peer dependency if you want buttery smooth scrolling:
npm install viewmotion lenis Lenis is an optional peer dependency
If you pass smoothScroll: true to initMotion() without installing Lenis,
viewmotion logs a console warning and falls back to native scroll behaviour —
no error is thrown. Install lenis only if you intend to use smooth
scrolling.
Requirements
- Any modern browser with
IntersectionObserversupport - ES2020+ environment (or a bundler that transpiles)
- No polyfills needed for Chrome 79+, Firefox 72+, Safari 14+, Edge 79+