Jump to content
Search Community

Fade in and fade out animation on element based on scroll position

OrganicBlue test
Moderator Tag

Go to solution Solved by Rodrigo,

Recommended Posts

Hi,

 

Maybe this achieves what you're after:

pinGroupContent.forEach((e, i) => {
  gsap.from(e, {
    opacity: 0,
    y: '+=100',
    duration: .4,
    lazy: false,
    scrollTrigger: {
      trigger: e,
      start: 'center 80%',
      end: "bottom 40%",
      toggleActions: "play reverse play reverse",
      markers: true
    },
  });
});

 

Let us know how it works.

 

Happy Tweening!

Link to comment
Share on other sites

  • Solution

Hi,

 

Ok so in that case instead of creating a GSAP instance with ScrollTrigger, is better to just use a ScrollTrigger instance and leverage the ScrollTrigger's callback system to run the animations. Maybe something like this?

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

 

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