Jump to content
Search Community

Animating "y" axis of a target breaks its start/end point from itself in ScrollTrigger.

Yunus Emre test
Moderator Tag

Recommended Posts

Hi,

After animating y axis position in callback functions like "onEnter" in ScrollTrigger, the target moves but its start/end points doesn't follow it. How can I fix it?

I'm trying to make a text fade-in / fade-out animation like in the  "apple.com/airpods-max"  website.

I might ask other questions as the work progress. ( eg: how to effectively manage multiple targets for this example )

 

 

See the Pen BaRjWEO by ynsmrsk (@ynsmrsk) on CodePen

Link to comment
Share on other sites

I tried the timeline way but didn't work for me.

By making it scrollable I wanted to users had the ability to see text as much as they want. Not just in a timeline duration.

If you are talking about using scrolltrigger with timeline instead of callback events, I don't have an idea how to do that.

And tried a tricky way like playing on start/end values but that didn't help either.

 

Actual problem is when onEnter and onLeave, the fading in/out works but sliding text don't because of its start/end point is shifted.

Do you have any other advise about achieving this type of animation? I think GSAP is robust enough to do it how apple does exactly.

Link to comment
Share on other sites

I'm not sure what you're really asking, but everything on the Apple site can be done using GSAP. Not saying it will be easy. Those Apple engineers are pretty good at their craft.

 

By a timeline, I meant like this.

 

gsap.timeline({
  scrollTrigger: {
   	trigger: "...",
    toggleActions: "..."
  }
})
.to(".foo", {
  ...
});

 

  • Like 1
Link to comment
Share on other sites

Yes this was the approach I went first. 

Code was like the following:

 

See the Pen RwVrQvv?editors=0010 by ynsmrsk (@ynsmrsk) on CodePen

 

This time the target's opacity can stay between 0 and 1. So the text looks a bit faded but visible for the most part in the scrolltrigger area.

I wanted it to fully opaque between scrolltrigger area and totally fades out to zero when goes out from that area.

 

--

 

I solved problem through adjusting y values in gsap.to() in callbacks.

 

See the Pen BaRjWEO?editors=0010 by ynsmrsk (@ynsmrsk) on CodePen

 

Thanks for the help though.

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