Jump to content
GreenSock

Kitson Chan

Title moving to next section using scrollTrigger

Recommended Posts

Hi guys. Recently I have seen a very impressive text title animation from a couple of websites. I was trying to copy the idea and us it on my own website. However I failed to achieve the effect after some trails. My final result is hoping to be similar to the following example  (https://www.signalworksarchitecture.com/ and https://outofthevalley.co.uk/our-story/). Is it done by moving the title element a proportional or a fixed distance according to the layout? Thank you :).

 

See the Pen VwWYmoy by kitsonchan (@kitsonchan) on CodePen

Link to comment
Share on other sites

Hi Kitson!

 

I think you might need to pin your titles.

 

Quote
pin Boolean | String | Element - An element (or selector text for the element) that should be pinned during the time that the ScrollTrigger is active, meaning it will appear to "stick" in its starting position while the rest of the content continues scrolling underneath it. Only one pinned element is allowed, but it can contain as many elements as you want. Setting pin: true will cause it to pin the trigger element. Warning don't animate the pinned element itself because that will throw off the measurements (ScrollTrigger is highly optimized for performance and pre-calculates as much as possible). Instead, you could nest things such that you're animating only elements INSIDE the pinned element.

 

Link to comment
Share on other sites

wow :0. Never thought that it would be that simple to achieve the effect. Thx!

  • Like 1
Link to comment
Share on other sites

I have updated my above codepen a bit. Using pin is surely doing the effect i want to achieve. However, as in my codepen, how do I calculate the distance so that the title text touch the line? I am not quite sure about how to achieve the effect as in https://www.signalworksarchitecture.com/ .

Link to comment
Share on other sites

You'll need to play around with your start and end triggers to get that working! Here's a demo with different positions/different end triggers. If you add markers:true you can see where the triggers are

See the Pen KKqwmyJ?editors=1010 by GreenSock (@GreenSock) on CodePen

 

 

  • Like 2
Link to comment
Share on other sites

8 minutes ago, Cassie said:

You'll need to play around with your start and end triggers to get that working!
 

 

 

If you add markers:true you can see where the triggers are

Playing with start and end seems to be not working well on different screen size. I have updated the codepen and it is working now. Anyway thx for all the help :D!

  • Like 2
Link to comment
Share on other sites

Oh yeah that wasn't a full solution - Just a demo to show that you can use markers and endTrigger!

Glad you got it working!

  • Like 2
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.
×