A React library for smooth scroll-triggered image sequence animations using Canvas and Framer Motion.
👉 View on npm
- Canvas-based rendering for smooth performance
- Optimized image loading with prefetch and cancellation
- Smart image caching with bitmap optimization
npm install scroll-img-motionimport React from 'react';
import { ImgScrollCanvas } from 'scroll-img-motion';
function App() {
const imageUrls = [
'/images/frame-001.webp',
'/images/frame-002.webp',
'/images/frame-003.webp',
// ... more images
];
return (
<div style={{ height: '200vh' }}>
<ImgScrollCanvas urls={imageUrls} />
</div>
);
}| Prop | Type | Required | Description |
|---|---|---|---|
urls |
string[] |
Yes | Array of image URLs for the sequence |
- Image Loading: Uses optimized ImageBitmap loading with smart prefetching
- Canvas Rendering: Renders images on canvas for smooth performance
- Scroll Detection: Uses Framer Motion's useScroll for precise scroll tracking
- Frame Smoothing: Applies spring animations for butter-smooth transitions
The library also exports utility hooks and functions for custom implementations:
import {
useCanvasResize,
useImageSequenceLoader,
useSmoothAnimationFrame,
drawImageOnCanvas
} from 'scroll-img-motion';- React 18+
- Framer Motion 10+
MIT
