Scroll Swap Text
Scroll-driven text swap animation where text slides vertically based on scroll progress
Scroll to swapThis text too
Installation
Dependencies
Props
Scroll Swap Text
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | - | Text content to animate |
as | ElementType | "span" | HTML element type to render as |
containerRef | React.RefObject<HTMLElement | null> | - | Ref to the scrollable container element |
offset | [string, string] | ["0 0", "0 1"] | Scroll offset range for the animation trigger |
className | string | - | Additional CSS classes |
springConfig | { stiffness?: number; damping?: number; mass?: number } | { stiffness: 200, damping: 30 } | Spring physics configuration for the scroll animation |