Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Conversant

KillTweensOf + Timeline restart

Recommended Posts

See code pen URL. Wait for the animation to play. In 2 seconds, a TweenMax.killTweensOf call will be made. I'm attempting to stop the autoAlpha from advancing (animating). That woks successfully.

 

When I click on the square, I'm expecting the Timeline (frame_1_in) to restart and the first tween in the timeline to start like it originally did. However, the 'autoAlpha' property is now ignored (not what I was expecting). Is there a way to restart the Timeline and all the corresponding tweens/properties like 'killTweensOf' never happened? My intent was to only use killTweensOf once--- with it not impacting the timeline after it restarted.

 

 

 

See the Pen zQZNqz by anon (@anon) on CodePen

Link to comment
Share on other sites

Well, there isn't really a way to resurrect an animation back from the dead. You killed it! ;)

 

Maybe just recreate the timeline when you need it again, or only pause() the tween instead of killing it(?)

 

  • Like 3
Link to comment
Share on other sites

45 minutes ago, GreenSock said:

Well, there isn't really a way to resurrect an animation back from the dead. You killed it!

 

Unless you've used the little known zombie timeline in which case you need another method to kill it.?

 

var tl = new ZombieTimelineMax();

tl.removeTheHead();

 

p8DfPSt.jpg

  • Haha 2
Link to comment
Share on other sites

var div = document.getElementById("square");

var frame_1_in = new TimelineMax()
	if(div){frame_1_in
       .from(div, 10, {x:"+250",ease: 'Power2.easeOut'}, 0.5)
       .fromTo(div, 2, {autoAlpha: 0},{autoAlpha: 0.2},"-=10");
    };			

div.addEventListener("click", function(){
  frame_1_in.restart();
})

You should probably just put the autoAlpha on a second separate tween that runs for 2 sec.

  • Like 1
Link to comment
Share on other sites

10 hours ago, GreenSock said:

 

Maybe just recreate the timeline when you need it again, or only pause() the tween instead of killing it(?)

 

Yeh, why go all bloodthirsty murdering rampage? What has this timeline done to you to deserve such violence?

  • Haha 3
Link to comment
Share on other sites

Thanks. I was hoping there was a way to restart the timeline from its initial state. For this particular case, I'll have to recreate the timeline rather than calling .restart();

 

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