fmaillet Posted July 31, 2022 Share Posted July 31, 2022 Hi there, I'm pretty new with gsap (thanks for the amazing job you are doing) and I'm just doing a simple horizontal scroll gallery with the possibilities of scrolling vertical and horizontal. https://codesandbox.io/s/thirsty-leaf-rstg36 I was wondering if my approach was good or absolutely not. I also read the Observer library, and was wondering to know if it's a better approach ? Thanks for your answers ! Have a good day Link to comment Share on other sites More sharing options...
iDad5 Posted July 31, 2022 Share Posted July 31, 2022 I'm not a react guy, but from what I at first see at first glance, there seems to be nothing wrong with what you're doing. Is anything not working as intended? 1 Link to comment Share on other sites More sharing options...
GreenSock Posted August 1, 2022 Share Posted August 1, 2022 Yeah, I don't notice anything glaringly wrong except you're not passing in an empty Array to your useEffect() calls, so they'll get called on every render. And I'm not sure why you're doing that wheel event listener stuff. We don't typically have the bandwidth to provide free code reviews, but if you've got a particular GSAP-related question we'd be happy to help with that. As for Observer, it serves a very different purpose than ScrollTrigger. Each tool can be useful in various situations, but it's not typically like you need to choose between them as competitors. Observer is just a low-level way to listen for scroll-like behaviors. Enjoy! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now