Jump to content
GreenSock

mattdavis06

timeline to only run once, but not when navigating back to homepage

Moderator Tag
Go to solution Solved by OSUblake,

Recommended Posts

Hi,

 

I've recently started using gsap (impressed so far!). However, I have a timeline which I only want the animations to run when the homepage first loads.

 

I've set a key and value in sessionStorage.setItem()checked if the page has been visited in getItem()and then called  tl.paused(true) on the timeline if true. But this obviously pauses everything. I basically want the animations to run on each first visit to the site, but not when navigating through different pages on the site, then when revisiting the hompage all the elements are in place without the animations.

 

Is this possible or a simple way to do this?

Link to comment
Share on other sites

  • Solution

Welcome to the forums @mattdavis06

 

It's possible, but I'm not exactly sure what mean by it pauses everything. If you're wanting the animations in their end state, trying using progress or totalProgress instead.

 

tl.progress(1);

 

 

Link to comment
Share on other sites

Sorry, I meant that is pauses the whole timeline, so none of the elements animate. 

 

But thank you very much, tl.progress(1) works! 

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