Jump to content
GreenSock

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

What could set TimelineMax.duration() == 0 ?

Recommended Posts

I've solved this, but I have no idea how, and I'm trying to understand what happened.

 

I have TImelineMax's set up in a class.  One of them is this, super-simple -- I use it to have a person 'escaping' or not escaping -- if they are escaping, they move off screen, if you click, the timeline is reversed and they come back.  Instantiations of this class are being moved in z-space forwards, in a timelinemax which contains repeat = -1 tweenmaxes (as per Carl's great help) -- when the person disappears off screen in the distance I reset this timeline to get them not escaping anymore. I was using gotoAndStop(0) but now am using seek(0), pause() -- the reset can happen while the timeline is moving forwards, or reverse.

_escapeString = Math.random() > .5 ? "+="  + ESCAPE_DISTANCE : "-=" + ESCAPE_DISTANCE;
			_escapeTimeline = new TimelineMax({paused:true,onStart:tlStart,onComplete:tlComplete,onReverseComplete:tlReverseComplete,ease:Linear.easeNone});
			
			_escapeTimeline.add(new TweenMax(this,ESCAPE_TIME,{x:_escapeString,ease:Linear.easeNone}));

As I said, I solved it, somehow -- but as I don't like unknown unknowns, my question is:

 

apart from kills(), is there anything else that would make the duration() of a timeline == 0, and the progress() == NaN ? That's what was happening.  But the timeline itself existed, i.e. != null.  

Link to comment
Share on other sites

Not really sure. the duration should only be 0 if the timeline has no tweens inside or if all the child elements have no duration also.

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