Jump to content
Search Community

Suggestion for TimeLineMax

Axonn test
Moderator Tag

Recommended Posts

I got a TimelineMax which repeats non stop (repeat = -1) UNTIL a certain event happens. When that happens, what I want is the animation to STOP REPEATING. Unfortunately, setting repeat to 0 also resets the "playhead" to 0 instead of waiting for the current animation to finish.


I don't know if there is another method to do this. Also note that I'm using the OLD animation platform (2012-06-30 / TimelineMax 1.698).


To accomplish my task, I had to make "_cyclesComplete" in TimelineMax publicly accessible (via property).




tl.repeat = tl.cyclesComplete;


So the suggestion is to take care of this issue so that it is no longer an issue ::- D.

Link to comment
Share on other sites

if your Timeline has yoyo:false, this should work fine:



import com.greensock.*;

var tl:TimelineMax = new TimelineMax({repeat:-1 , repeatDelay:1});

tl.insert(TweenLite.to(mc, 3, {x:400}));

stage.addEventListener(MouseEvent.CLICK, stopIt)

function stopIt(e:MouseEvent){

var myProgress = tl.currentProgress;
tl.repeat = 0;
//tl.pause(); optional
tl.totalProgress = myProgress;

  • Like 1
Link to comment
Share on other sites

Yep, good solution(s).


I wouldn't want to make this behavior automatic because it's actually picking up the tween/animation and moving its startTime (where it sits in its parent timeline) which might not be what users want. Thanks for the suggestion, though.


Happy tweening!

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