Jump to content
GreenSock

CrisCaducoy

Reset and and stop All Tweens (TweenMax and TimelineMax)

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Is there any way for all the timeline/tweens to reset back to starting position all at once and pause them there and wait until triggered to play/resume again except the currently triggered timeline?

for example, I have 2 slides which identifies element if it was currently on the viewport and then fires the tween sequence inside a timelineMax. (don't mind the viewport identification as it was already done)

 

I tried 

TweenMax.killAll(false, true, false);

but what it did was, it pauses all the delayed and remaining tweens which leaves the current state of element. What I want is since these elements are came from autoAlpha:0, it will be set back to their starting timeline sequence and wait until being triggered again. That means when another timeline is triggered, it will abort all remaining tweens of the previous timeline and vise versa for both slides. 

The killAll scenario is, I can see the elements that are stopped and I don't want that. I want them to have all fresh entry everytime the sequence is triggered.

 

 

I am sorry for this issue has been solved years ago. Sorry for opening same thread.

Link to comment
Share on other sites

hello and welcome to the forums

 

have you tried after using the kill methods to clearProps? ... go to the below link and scroll down to clearProps to read about it:

 

http://api.greensock.com/js/com/greensock/plugins/CSSPlugin.html

also maybe something like this:

var targetElement = document.getElementById("targetElement");
TweenMax.killAll(false,true,fasle);
TweenMax.set(targetElement, {clearProps:"all"}); // or you can use "autoAlpha" as the value for clearProps
Link to comment
Share on other sites

Hi,

 

I'm not 100% clear on what you need to accomplish, but have you looked into TimelineLite's exportRoot() method?

 

In short it allows you to grab all loose tweens and timelines and place them in a new TimelineLite that you can then reverse() or set progress(0);

Link to comment
Share on other sites

Hey Carl.. when you use the exportRoot() method.. when using and exporting into another timeline,  are the initial values reset to when the timeline was first created? thx

Link to comment
Share on other sites

Thank you for the very fast and very informative replies there folks. I am sorry if I am that too lazy on reading docs or related topics. I tried searching some time but it returns to be not the one I want. I had accomplished what I want with this code:
 

myElementTL.pause(0);
myElementTL.clear();

and then trigger it again to make it restart if my condition triggers its restart with this:
 

myElementTL.restart();

...Anyway, thank you for all the replies. I will try and reconfigure what I did if the above of your solutions are better. Thanks

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