Jump to content
Search Community

Interrupting and restarting a Tween while respecting the delay

animaker test
Moderator Tag

Recommended Posts

 

I am trying to interrupt a tween before it has begun, then restarting it while respecting the delay. 

 

As you see from the pen, everything works though the delay is reset to 0 in the process. 

 

Any advice on how to retain the 3 second delay would be appreciated.

See the Pen oNeozRr by loxks (@loxks) on CodePen

Edited by animaker
Improving wording
Link to comment
Share on other sites

Hi @animaker :)

 

Welcome to the forum and thanks for being a club member.

 

I think you're looking for:

tw.restart(true);

From the docs:

//restarts, not including any delay that was defined
myAnimation.restart();

//restarts, including any delay, and doesn't suppress events during the initial move back to time:0
myAnimation.restart(true, false);

https://greensock.com/docs/v3/GSAP/Tween/restart()

 

Happy tweening.

:)

 

  • Like 4
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...