Jump to content
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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();

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.