Implement CSS scroll effects with start and end values
CSS effects are defined using an array containing a start value, an end value, and an optional third value for easing.
- Start: The effect begins when the top of the element enters the bottom of the view.
- End: The effect ends when the bottom of the element exits the top of the view.
Supported effects include translateX, translateY, rotate, rotateX, rotateY, rotateZ, scale, scaleX, scaleY, scaleZ, and opacity.
useParallax({
// Translate Y from -100% to 100% with ease-in
translateY: [-100, 100, 'ease-in'],
// Scale from 0 to 1 with a custom cubic-bezier
scale: [0, 1, 'cubic-bezier(0.2, -0.67, 1, -0.62)'],
});