bs.choi Posted December 24, 2021 Share Posted December 24, 2021 hi. I found scrollTrigger.scrollerProxy while looking for GSAP scrollTrigger to do smooth scrolling in a specific section of my page, and I was looking at the descriptions and demos. Among the demos, I saw a demo that used only scrollTrigger and a demo that added a third party library. () There a question arose. Why are you using these together? You can implement smooth scrolling with only scrollTrigger (native), and smooth-scrollbar can implement the same function independently, so why use the two together? In my page, the scrollTrigger and smooth-scrollbar functions were applied first because they needed a function when they were used together rather than independently implemented functions. However, I'm curious about the difference between writing the two separately and writing them together. Lastly, I'm sorry for my poor English See the Pen oNLqgBm by GreenSock (@GreenSock) on CodePen Link to comment Share on other sites More sharing options...
Cassie Posted December 24, 2021 Share Posted December 24, 2021 Hi @bs.choi, There's no way to do smooth scrolling purely within the provided ScrollTrigger API. This following demo is using a helper function, written by @GreenSock for smooth scrolling - but it's not integrated into scrollTrigger. See the Pen gOgWELo by GreenSock (@GreenSock) on CodePen https://greensock.com/docs/v3/Plugins/ScrollTrigger/static.scrollerProxy() scrollerProxy() provides a way to hook smooth scrolling libraries up to scrollTrigger. Quote Basically you're saying "Hey ScrollTrigger, whenever you want to get or set the scrollTop or getBoundingClientRect() on this element, use these methods instead" and then you do whatever you want inside those methods. The choice to use the helper function we provided or a third party is up to you really! It's not really about 'using them together or separately' it's more a choice between using a helper function or a third party library. Does this answer your question? 2 Link to comment Share on other sites More sharing options...
bs.choi Posted December 27, 2021 Author Share Posted December 27, 2021 @Cassie ye i got it. thank you!!! one more, What is the performance difference between helper functions or 3rd party libraries? Link to comment Share on other sites More sharing options...
Cassie Posted December 27, 2021 Share Posted December 27, 2021 I wouldn't be able to give a thorough answer about third party libraries I'm afraid. But the helper function is written by the GSAP library author to be used with GSAP and the third party libraries aren't. So I would assume that our helper function would be better performance-wise. Link to comment Share on other sites More sharing options...
bs.choi Posted December 28, 2021 Author Share Posted December 28, 2021 @Cassie okay Thank u. Have a good year end! 1 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