Av9ry
Content Type
Profiles
Forums
Store
Blog
Product
Showcase
FAQ
Downloads
Posts posted by Av9ry
-
-
7 minutes ago, SteveS said:
I would look at the existing ways of integrating scrollTrigger with other smooth scrolling libraries like locomotive scroll or AsScroll
Thank you for advice. The question remains the same, what exactly ScrollTrigger.refresh() does behind the scenes, and is it ok to call it on each frame?
-
Hi. I have my own solution for smooth scrolling. It changes the translateY of the container element on scroll using request animation frame. I was looking for a way to make ScrollTrigger work, and what I did is put this line into my update() function that's being called each frame:
ScrollTrigger.refresh();It works fine, and triggers all ScrollTrigger instances across my entire application correctly. No issues.
The question is, what exactly the refresh method does, and is it okay to use it performance wise? I imagine if it calls getBoundingClientRect() it should be pretty bad to use it on each frame. The documentation says that it calculates
start
andend
values, but what exactly are these values, and where do they come from — I have no idea. Would appreciate any helpThanks,
calling ScrollTrigger.refresh on each frame?
in GSAP
Posted
Thank you @Rodrigo and @akapowl
Happy New Year 🎄