Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

Animation starts before scrolling with ScrollTrigger plugin

Recommended Posts

Hello everyone,


I have this sample code using ScrollTrigger. What I would like to achieve is starting my animation when the top of the trigger hits 20% from the top of the viewport.

However, my animation starts as soon as the page loads (start and scroller-start markers haven't aligned yet).

What am I doing wrong ?


Thanks for help!



        scrollTrigger: {
          trigger: '#Shape_1',
          markers: true,
          start: 'top 20%',
        defaults: { duration: 3, ease: 'none' },
      .to('#Shape_1', {


Link to post
Share on other sites

It's pretty tough to diagnose without seeing it in context - would you mind providing a CodePen or something? I wonder if maybe you're not loading ScrollTrigger or forgot to activate it or something. Are you getting any errors in the console? 


  • Like 1
Link to post
Share on other sites

Hey @theolavaux


I think this is related to your initial setup.


When the ScrollTrigger setup is being executed, the path you are targetting as the 'trigger' is not yet in the position that you initially tween it to, so the trigger is way more up the page, than you suppose.


You can work around this by either wrapping your ScrollTrigger-Setup in a delayedCall or even better in an onComplete-function of that initial tween you have there. Or another way - and probably the easiest - would be to simply just use the container-element of those SVGs as the trigger.


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



But how you do it really depends on where exactly you want to go with this.



Hope this helps though.




  • Like 3
  • Thanks 1
Link to post
Share on other sites

Thanks! With the onComplete function, it seems that I got it to work!

Link to post
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.