Scroll Rotation Animation
Animated gallery images, with scroll triggered animations, rotates and translates on the Y axis on scroll.
Installation
Usage
<ScrollAnimationRotate>
<ScrollAnimationRotateContainer
yRange={[-100, 400]}
className="h-dvh gap-2"
>
<ScrollAnimationRotateCol className="gap-2 mt-[-10%]">
{IMAGES_1.map((imageUrl, index) => (
<img
key={index}
className="aspect-video block h-auto max-h-full w-full rounded-md object-cover shadow"
src={imageUrl}
alt="gallery item"
/>
))}
</ScrollAnimationRotateCol>
</ScrollAnimationRotate>For a smooth scroll transition, use Lenis library.
Examples
Props
ScrollAnimationRotate
| Prop | Type | Default |
|---|---|---|
offset? | ScrollOffset | ["0% 50%", "50% 50%"] |
spacerClass? | string | h-96 |
ScrollAnimationRotateContainer
| Prop | Type | Default |
|---|---|---|
scaleRange? | number | [1.1, 1] |
rotateXRange? | number | [80, 0] |
yRange? | number | [0, 300] |
ScrollAnimationRotateCol
| Prop | Type | Default |
|---|---|---|
yRange? | number | [-5%, 1%] |