jscottsmith/react-scroll-parallax

Making parallax move to end and back

asjustis opened this issue · 2 comments

Support

Hi, while scrolling through, I want to use Parallax to either move to the end position and then into the start position, or for opacity - from 0 to 1 and back to 0. Is this something that is possible with the <Parallax> element?

Sorry this isn't supported.

Try something like Framer Motion or GSAP ScrollTrigger for more advanced scroll animations.

Got it, thanks. I did a dirty hacky workaround for this if anyone will be curious anytime:

<Parallax
    onProgressChange={(newProgress) => {
    if (progress < 0.5 && newProgress >= 0.5) {
	setOpacity([2, 0, easing]);
    } else if (progress >= 0.5 && newProgress < 0.5) {
	setOpacity([0, 2, easing]);
    }
    ...
}>
...