Follow along with my webinar to understand how to use the input/output ranges of useTransform to make different effects
Start with a very simple project first to test out useSticky, useSpeed and useTrigger, such as this sandbox. Make sure to understand the parameters of each function.
Functions usePositiveOffset, useSticky, useSpeed and useTrigger are custom hook that I wrote to make it easier to create common parallax effect such as sticky headers.
usePositiveOffset
Description
Convert a negative offset MotionValue, that comes with contentOffsetX and contentOffsetY props of Scroll, to a positive one.
Webinar video
Links
Assignments
useParallax.js References
usePositiveOffset
// ==> 1. import it
import { usePositiveOffset } from "./useParallax"
...
function App() {
// ==> 2. call usePositiveOffset in a function component
const positiveOffset = usePositiveOffset(offset)
...
}
useSticky
// ==> 1. import it
import { useSticky } from "./useParallax"
...
function App() {