Skip to main content
Version: 3.x

Scroll Effects

More than just translate effects are possible. Here's some examples of the various effects possible.

Rotation​

You can spin an element around it's axis using the rotate props.

Around the default axis (z-axis)​

Use the rotate prop to rotate an element around the z-axis. You can pass the start and end values as deg or turns. Numbers default to deg.

const Component = () => {
const parallax = useParallax<HTMLDivElement>({
rotate: [0, 360],
});
return (
<div ref={parallax.ref} className="spinner">
đŸ˜ĩ‍đŸ’Ģ
<div className="diamond">💎</div>
<div className="clown">🤡</div>
<div className="money">💰</div>
<div className="hand">👌đŸģ</div>
</div>
);
};
đŸ˜ĩ‍đŸ’Ģ
💎
🤡
💰
👌đŸģ

Around the y-axis​

Rotations can be applied to any axis, x, y, or z. Here's an example of a rotation around the y-axis for perspective:

const Component = () => {
const parallax = useParallax<HTMLDivElement>({
rotateY: [0, 360],
});
return (
<div ref={parallax.ref} className="spinner">
<div className="thumbsup">👍đŸģ</div>
<div className="clap">👏đŸģ</div>
<div className="handsup">🙌đŸģ</div>
<div className="thumbsdown">👎đŸģ</div>
</div>
);
};
👍đŸģ
👏đŸģ
🙌đŸģ
👎đŸģ

Scale​

You can scale an element up or down and along any axis.

const Component = () => {
const mage = useParallax<HTMLDivElement>({
scale: [0.5, 1, 'easeInQuad'],
});

const frog = useParallax<HTMLDivElement>({
scaleX: [1, 0, 'easeInQuad'],
});

const moon = useParallax<HTMLDivElement>({
scale: [1.5, 1, 'easeInQuad'],
});
return (
<div className="spinner">
<div className="mage" ref={mage.ref}>
🧙đŸģâ€â™‚ī¸
</div>
<div className="frog" ref={frog.ref}>
🐸
</div>
<div className="moon" ref={moon.ref}>
🌚
</div>
</div>
);
};
🧙đŸģâ€â™‚ī¸
🐸
🌚