Jump to content
Search Community

ScrollTrigger Start Before Section

shMattyP93 test
Moderator Tag

Recommended Posts

Hi,

 

All you have to do is play with the start position. Keep in mind that the start and end parameters signal the position of a specific part of the trigger element, relative to the scroller area. If you want to start something before becomes visible you need to signal that the top of the element hits the bottom of the scroller, plus a few pixels or percentage.

 

gsap.to("#box", {
  xPercent: 150,
  scrollTrigger: {
    trigger: "#two",
    start: "top bottom+=150px",
    end: "top center",
    scrub: true,
  }
});

In this example the green and purple boxes should be perfectly aligned, but the animation of the purple box starts before it enters the viewport:

See the Pen wvjpbYj by GreenSock (@GreenSock) on CodePen

 

You can read about it in the docs:

https://greensock.com/docs/v3/Plugins/ScrollTrigger

 

I hope this makes things clearer.

 

Happy Tweening!

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