Jump to content
GreenSock

ngocducdim

GSAP TimeLine how to go back original position after kill Tween?

Recommended Posts

Hi, how to kill the tween in time line and make it go back the original position? You can try the codepen, let it run finish, press kill button but still nothing happen

 

See the Pen rNdabRX?editors=1111 by ngocducdim (@ngocducdim) on CodePen

Link to comment
Share on other sites

Have you seen the docs? There is an .kill() function https://greensock.com/docs/v3/GSAP/Timeline/kill()

 

I would love to know the problem you're facing, because I think there probably is a solution for it, but where are missing the full picture of what it is you want to do.

 

See the Pen KKowORB?editors=1010 by mvaneijgen (@mvaneijgen) on CodePen

  • Like 1
Link to comment
Share on other sites

Hi, thanks for the reply, the kill you mention above is completely kill the whole timeline? My current situation is the timeline will have many tweens (using .to and .from), and  I need to edit/remove some of those tweens, but when remove I expect it come back original position but it doesn't, now have found solution that I will use .fromTo(), it more easier to control the tweens in timeline. Thanks for you help

Link to comment
Share on other sites

When you kill() a tween, it doesn't revert it to the previous values. It simply stops it immediately in its tracks and makes it eligible for garbage collection.

 

You can rewind it to the starting values if you want:

animation.progress(0).kill();

 

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