Jump to content
Search Community

Smoothscroller effect after certain scrolling position, not before

Moritz Profitlich test
Moderator Tag

Go to solution Solved by Cassie,

Recommended Posts

Hello

I am looking for a way to accelerate objects after they passed a certain point on the viewport. Just like smootherscroll’s data-speed but without change in speed before the certain point.  The objects should scroll with normal speed before.

 

That’s what I want to achieve: Images or groups of images scroll in natural speed. They are accompanied by text. Both should scroll in normal speed. At the center of the screen, the title is pinned. Now, after the pin is released, the text should accelerate, as if it wanted to catch up with the image it belongs to.

 

In other words: Until the pin I want the behaviour I get without Smoothscroller, after the pin I want the behaviour with Smoothscroller.

 

In the pen you can see that the text very well runs after the image but you can also see that it already runs ahead of the image before it gets pinned. The latter it should not do.

 

Thanks for your ideas!
Moritz

1.thumb.png.49471cd803771b7f2b297a832dd062a2.png

 

When the text is not pinned anymore it should catch up with the image(s). I could get the effect with SmootherScroll but that slows down the text until the center of the screen.

2.thumb.png.2c639ee585dc41ef94887ef224fd30e5.png

 

 

Is

See the Pen jOQmGLP by mprofitl (@mprofitl) on CodePen

Link to comment
Share on other sites

Hi Superhero Cassie

 

That’s what I am looking for! Your demo is to the point.

 

I implemented your code into mine and my page still behaved as before. Very strange. Only after deleting the let smoother I got the desired result. I also tried to delete it from your code and find that your code also works without it (only that it also works with it).

 

Question 1: Do I assume right that ScrollSmoother is not needed as the acceleration of h2 is done by a gsap.to animation?

Question 2: If (1) is yes why does your demo also work with ScrollSmoother? Why doesn’t it interfere?

 

Now that I saw the animation, I whished for an addition. I wanted to slow down the red-framed text blocks before they get pinned. A slow halt instead of a hard stop. So I did. You can see the result here: https://staging.profitlich.ch/projekte (from July 15th on: https://profitlich.ch/projekte)

 

 

Link to comment
Share on other sites

Hi

 

53 minutes ago, Moritz Profitlich said:

I implemented your code into mine and my page still behaved as before. Very strange. Only after deleting the let smoother I got the desired result. I also tried to delete it from your code and find that your code also works without it (only that it also works with it).

 

Question 1: Do I assume right that ScrollSmoother is not needed as the acceleration of h2 is done by a gsap.to animation?

Question 2: If (1) is yes why does your demo also work with ScrollSmoother? Why doesn’t it interfere?

This is a bit weird. Storing the ScrollSmoother instance is just a convenience in case you need to access any method/property of said instance later in your code and if you create that variable/constant shouldn't make any difference whatsoever, that's why Cassie's code works the same with or without it. My best guess is that something else is messing with your setup.

 

Also I peeked a bit under the hood of your site and I think the current way you have for your mouse-follow element is not the best approach. I'd strongly recommend you using GSAP QuickTo for this:

https://greensock.com/docs/v3/GSAP/gsap.quickTo()

 

Here is an example:

See the Pen xxpbORN 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...