Jump to content
Search Community

Animation completing when hitting the scrollTrigger's "start" value

BlakeDykes test
Moderator Tag

Go to solution Solved by OSUblake,

Recommended Posts

Hello!

 

I want my timeline to play when the element reaches the ScrollTrigger's start point. Right now it will play correctly when the page is refreshed with the element in view. If I scroll to the element, it will complete as soon as it reaches the start point. 

 

First time using ScrollTrigger, I'm sure I'm forgetting something pretty trivial 

 

Thanks

 

See the Pen vYZbraa by blakedykes (@blakedykes) on CodePen

Link to comment
Share on other sites

  • Solution

Welcome to forums @BlakeDykes

 

ScrollTrigger should not be in the defaults object as that will create a ScrollTrigger for every tween in the timeline.

 

let t1 = gsap.timeline({
  defaults:{    
    duration: 0.75,
  },
  scrollTrigger: {
    trigger: ".cta-full-width-container",
    start: "top center",
    end: "bottom top",
    markers: true
  }
});

 

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