Using Framer motions useViewportScroll and scrollY with react-intersection-observer

Viewed 330

I am having some trouble using Framer motions useViewportScroll and scrollY with react-intersection-observer. I have some type that is connected to the scroll position on the y axis, so as you scroll up it moves up into place and then if you were to scroll back down the process is reversed. I have a few of these sections so would like to use intersection-observer so that they only happen when the element is in view. But I just can't figure it out.

It's no problem setting up intersection-observer and giving the element an initial of say y:100 and then an animate of y:0 but what I want to use is something like this const y1 = useTransform(scrollY, [0, 500], [150, 0]); Anyone got any tips?

0 Answers
Related