Jump to content
Search Community

timeline.currentTime flashes to near zero value

Guest Berbank
Moderator Tag

Recommended Posts

Guest Berbank

Hello all,

 

I'm new to GreenSock (and loving it), but not new to programming.

I've encountered something a little odd:

 

I've moved all of my tweens into a timeline which repeats infinitely. Everything works on the tweened object perfectly except currentTime occasionally flips to a near zero value, and then back to its correct value. See below:

 

Current Time from timeline: 6.7620000000000005

Current Time from timeline: 6.784000000000001

Current Time from timeline: 6.805999999999999

Current Time from timeline: 6.827999999999999

Current Time from timeline: 6.853

Current Time from timeline: 6.872999999999999

Current Time from timeline: 6.897

Current Time from timeline: 6.9190000000000005

Current Time from timeline: 6.9399999999999995

Current Time from timeline: 6.964

Current Time from timeline: 6.984999999999999

Current Time from timeline: 0.006000000000000227

Current Time from timeline: 7.029999999999999

Current Time from timeline: 7.052999999999999

Current Time from timeline: 7.077999999999999

Current Time from timeline: 7.102

Current Time from timeline: 7.1259999999999994

Current Time from timeline: 7.15

Current Time from timeline: 7.1739999999999995

 

these are the bits of code called:

 

 

from Function myfunctionA

timeline.append(TweenMax.to(this, 1, {x:newPos.x, y:newPos.y, ease:Cubic.easeInOut, onComplete:myFunctionB, onUpdate:updateChildren}));

 

from function myFunctionB

this.currentState.timeline.append(TweenMax.to(this, idleTime, {onComplete:myFunctionA}));

 

Does anyone have any idea what is causing this?

 

Thanks for you help,

Link to comment
Share on other sites

I can't conjecture why TimeLine is doing that (My best guess is that it's being reset every time you append a new tween).

 

However, Jack thought of this and made it possible to do that sort of looping with the yoyo and repeat properties.

 

var myTimeline:TimelineMax = new TimelineMax({repeat:0, yoyo:true, onUpdate:updateChildren});

 

(setting repeat to '0' will repeat infinitely).

Link to comment
Share on other sites

Guest Berbank

Hi JonDum,

 

Thanks for your reply, the yoyo fix did get rid of the unusual 0 values, but it caused some strange behaviour in the way my object moves. I've removed the timeline entirely now and will try a different way to handle my tweens. Thanks for your help though.

Link to comment
Share on other sites

Let me clear up a few things:

 

1) Setting "repeat" to -1 causes it to repeat infinitely (not 0)

 

2) When you append() a tween, the timeline doesn't reset the time or anything like that - it does, however, update the duration (which kinda makes sense) :)

 

I'd be VERY curious to see an example FLA that demonstrates the issue. Is there any way you can send me something or post it here? The simplest FLA would be great. Even if it's just a line or two of code and a trace() statement. I'm not aware of any bugs in TimelineLite or TimelineMax but if you stumbled across something nobody else found, I'd really like to squash it. Sometimes what people think is a "bug" ends up just being an anomaly in their own code (not saying that's the case here, but since I can't reproduce the results or explore the issue, it's tough to say without seeing your stuff in context).

Link to comment
Share on other sites

Guest Berbank

Hi Greensock (Jack?)

 

1) Yep, understood.

 

2) Makes complete sense.

 

I will see what I can do to sort you out an example FLA although it might be a while as I'm in development. I understand you are keen in sorting this out if it is a bug, it's more likely to be something I've done given the quality of your product, but I can't fathom what I could be doing to cause this. If currentTime went to zero and then incremented from there it would make more sense, but to zero out and then continue from where it was before is very strange. I'm sure it's something I've done but I will get you an FLA as soon as I can.

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