Jump to content
Search Community

Next.js + Scroll Trigger + scrub animation problem

Pavel Buchta test
Moderator Tag

Go to solution Solved by akapowl,

Recommended Posts

  • Pavel Buchta changed the title to Next.js + Scroll Trigger + scrub animation problem
  • Solution


Hello Pavel, welcome to the forum.

ScrollTrigger does have a built in tool for debugging your start / end positions.

You can ...

 

Quote

Enable visual markers during development to see exactly where the start/end/trigger points are.
Customization options abound, like markers: {startColor:"green", endColor:"red", fontSize:"12px"}.


https://gsap.com/docs/v3/Plugins/ScrollTrigger/?page=1#markers
 

Once you enable markers in your project you'll notice that you have passed the end point of your ScrollTrigger already on load.

Unbenannt.thumb.png.987fa9ab401eb320c0e5c5eda75dfdc6.png
That is because  your end is set to 'when the top of that div hits 20% of the viewport's height' - which has already happend as the top of that div is at the top of the viewport on load. So now at the start of your ScrollTrigger you basically instantly also trigger the end, which is what you see.

So you'll probably want to adjust your end - maybe to something like 'bottom 20%'or'+=75%'instead.

You can find more explanation on how the end properety works in the docs, too.

https://gsap.com/docs/v3/Plugins/ScrollTrigger/?page=1#end
 

  • 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...