Jump to content
Search Community

ScrollTrigger above the fold

decemberly test
Moderator Tag

Go to solution Solved by mvaneijgen,

Recommended Posts

I have a number of sections with a ScrollTrigger and fromTo animation that changes the background-color from red to blue during scroll (scrub).

The first section is located at the top of the viewport and starts with a purple color instead of red like the others below, as expected.

Is it possible to let the user see the animation from red to purple (before scrolling) on the sections that starts fully or partially visible?

See the Pen OJGVMBM by decemberly (@decemberly) on CodePen

Link to comment
Share on other sites

Thank you for answering. But no, sorry for being vague.

The section already in viewport on page load has a different starting point, it is purple instead of red.
I would like a visible animation from red to that starting point as soon as it has loaded, before the user starts scrolling.

 

So that it starts out red, then takes a second to animate to the right purple, and when the user starts scrolling the background turns to blue as usual.
 

Link to comment
Share on other sites

  • Solution

I think you'll then have to make a separate ScrollTrigger for the first one, or at least check if it's the first one and then set it scrub: false. But you state you also want it to take a second, so creating a whole separate tween without even ScrollTrigger for the first one will be the way to go. I think. 

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