Scroll-driven animations for better performance
AndrewKGuan opened this issue · comments
Hi,
there's this new API called Scroll-driven animations which can make scrolling smoother and jank-free. It runs on the compositor thread and therefore frees up the main thread. Here's a great demo page about what you can do with it.
Do you think GSAP can take advantage of that?
Thanks for the suggestion, @AndrewKGuan
We will definitely keep an eye on native browser technology that we can leverage to improve things. However, we place a huge priority on compatibility and the features you referenced aren't available in most browsers and won't be for some time. Even when they are universally available, we'd have to look at whether or not they actually deliver any real improvements to what GSAP already does today. Sometimes new browser features are far too limited or don't offer performance improvements beyond extreme edge cases, so we don't want to just assume it's smart to implement. For example, see this article about WAAPI: https://greensock.com/waapi
But again, thanks for pointing this out. When it becomes more mainstream, we'll look more into what's feasible/beneficial. For now, though, GSAP/ScrollTrigger already offers far more than even the future native stuff offers (from what I can tell at least). Do you see any pain points that need to be addressed?
Hi Jack,
thanks for the prompt reply and sorry for my delay.
Those are very valid concerns and I can totally sympathize.
Just am genuinely curious, in your opinion, what are the criteria to be met by an API in order to be incorporated into the code ? I suppose wide support by all browser to be one, and proven performance benefit to be another one, what else?
Here are the main criteria:
- Wide browser support and clean implementation (sometimes browsers implement things in buggy or inconsistent ways)
- Performance benefit
- Support for ALL of ScrollTrigger's current features. As explained in the WAAPI article, switching to that under the hood would actually force us to eliminate a bunch of important features. It simply wasn't robust enough to depend on for the various important things...it was great for simpler stuff.
- File size
That makes sense, thanks again Jack!