Jump to content
Search Community

Smooth animations

matashaEs test
Moderator Tag

Recommended Posts

Hello.

I'm doing animations now using ScrollTriger. In order for them to be smooth, I used the SmoothScroll plugin, I don't like that the elements that need to be fixed should be written above the smoother class. Could you recommend another smooth animation plugin or library that could be integrated with GSAP?

Link to comment
Share on other sites

Hello there,

 

that's how it is with just about ANY smooth-scrolling library, since that's just how browser's work. The fixed positioning will change its context in parent elements that have transforms applied - and since (probably) all of them need to use transforms to smoothen the scroll, that is the recommended way to handle it. This is also the case for other popular libraries like locomotive-scroll and smooth-scrollbar.

 

But since you are using ScrollSmoother (and thus need to be loading ScrollTrigger anyway) you could probably also leverage ScrollTrigger's pinning, to emulate position fixed on elements, as an alternative.

 

Edit:

Apparently lenis works a bit different, and it seems that position fixed / sticky work with it as it does with native scrolling - but I have no experience with that library at all - I only just stumbled upon it in this forum recently.

 

 

Since ScrollSmoother is a GreenSock product though, I definitely still recommend going with it instead, because you can not expect much, if any, support for lenis on here if something doesn't work the way you'd expect e.g. in combination with ScrollTrigger.

 

Nonetheless, here is a quick fork (with position fixed included) of an example I found on codepen by somebody else.

 

See the Pen zYajKdJ by akapowl (@akapowl) on CodePen

 

  • Like 2
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.
×
×
  • Create New...