Jump to content
Search Community

How to have a ScrollTrigger smoothly continue a page load animation if the page is scrolled before the first animation finishes

decemberly test
Moderator Tag

Go to solution Solved by Cassie,

Recommended Posts

I have a page load animation that animates mask-size from 0 to a certain value. Then a ScrollTrigger that animates from that value to the intended end value.

This works as intended as long as the page isn't scrolled before the page load animation has finished. 

If I scroll before the page load animation has finished, the ScrollTrigger doesn't start until later (or at all if I scroll fast). Any ideas how to get a smooth animation even if I start scrolling immediately?

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

Link to comment
Share on other sites

Mmmm. No that doesn't work.

When the scrubbed (ScrollTrigger driven) fromTo kicks in midway through the intial tween it will jump to the initial '0' from position, then animate to the final 'to' position.

We can interrupt the intial animation with a 'to' tween because then all we're doing is adjusting the final destination, it picks up from whatever the mask value is and continues from there...

 

This is the closest to a solution I can think of? But maybe I'm missing something. @Carl is an expert on about overwrite modes. 👀

See the Pen QWRRKVZ?editors=0010 by GreenSock (@GreenSock) on CodePen


   

 

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