Jump to content
Search Community

How to Add smooth fade in effect to the slider in gsap on horizontal scroll?

Zain12 test
Moderator Tag

Recommended Posts

Hi,

 

Please check the example and information about Container Animation, since you're not setting it up on your demo.

 

It should look kind of like this:

const targetText = sections[2].querySelector('.sliderTxt');
gsap.from(targetText, {
  opacity: 0,
  y: 100,
  scrollTrigger: {
    trigger: sections[1],
    containerAnimation: horizontalTween,
    start: 'left center',
    end: 'lef left',
    scrub: 1,
    markers: true,
  },
});

Also is worth noticing that the positions in your example are a bit off, most likely because of some CSS, but I assume that the CSS is different in your real setup. That's why I'm using sections[1] to show sections[2] text's element, but the index should be the same in your real life scenario.

 

Hopefully this helps.

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