Jump to content
GreenSock

thad

Intersection Observer to ScrollTrigger, is it worth it performance wise?

Recommended Posts

Hi all. 

Just recently I have created a site that runs GSAP tweens with intersection observer. There are quite few different animations going on. 
While I was developing site, scrollTrigger got released, and I imported scrollTrigger to test it, and I left it in project because of Scrub animations which are very nice, but everything else is powered by intersection observer.

I was wondering if it was worth it performance wise, to convert everything to scrollTrigger, especially now that scrollTrigger is included it project anyway?

Link to comment
Share on other sites

Why change something if it's not broken? I doubt you are going to see a performance difference either way.

 

  • Like 3
Link to comment
Share on other sites

Intersection observers aren't intrinsically bad. In fact there are some rare cases where it makes more sense to have ScrollTriggers + intersection observers than only ScrollTriggers. ScrollTrigger just allows you to do more things than intersections observers, and especially do it more intuitively (I think).

  • Like 1
Link to comment
Share on other sites

45 minutes ago, OSUblake said:

Why change something if it's not broken? I doubt you are going to see a performance difference either way.

 

That's why I'm asking :) Thanks

  • Like 1
Link to comment
Share on other sites

3 minutes ago, ZachSaucier said:

rare cases where it makes more sense to have ScrollTriggers + intersection observers

I see. Please let me know if you have any example of those rare cases, would love to see them :)
Think I will just leave it as is. Was just wondering since I'm already using scrollTrigger for scrub animation. Thanks for comment

Link to comment
Share on other sites

51 minutes ago, thad said:

Please let me know if you have any example of those rare cases, would love to see them

Needing to know when an element that is within a pinned element goes in and out of the viewport might be one case:

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×