Jump to content
Search Community

Bizzareness: Tweens starting from completely the wrong value

Dave Stewart test
Moderator Tag

Recommended Posts

I'm getting some very strange behaviour with tweening alphas, where stuff would at first appear not to tween at all, rather just "pop" to full alpha, then after setting the duration to 5 seconds, would tween from about 0.808 to 1.

 

In other words:

 

Seconds: 0           1           2           3           4           5

Values:  0    -----> 1
        0.80 -----> 0.84 -----> 0.88 -----> 0.92 -----> 1.96 -----> 1.00

 

It's almost as if nothing happens for half a second or so, then the duration has "run out" and the tween has finished. However, even with the longer tween example I just mentioned - proportionally, the tween is still starting from too high a number, in this case 0.8 (4/5) of the way through in value, although only 1/10 of the way through in time.

 

The strange thing is, this is the second project this has happened in, with unrelated code, and I'm very sure I don't have any other tweens going on.

 

This project is Gaia-based, but I don't think there is anything else tweening - but is there any way I can check for other tweens happening at the same time? There's a Dictionary on the TweenLite class, right?

 

Or could it be something else? Is this a known bug? Do I have conflicting classes? What the hell could it be? My tweens are currently very basic.

 

It has literally just raised its ugly head today, right before a deadline tomorrow, so any help would really be appreciated - I really need to solve this.

 

Thanks,

Dave

Link to comment
Share on other sites

No, there are no known bugs at all - there must be something else going on in your code that's causing the odd behavior. Well, I'm not saying it's your fault - maybe there's a conflict somewhere or a Flash bug, but it's extremely difficult to troubleshoot blind, so could you please whip together a sample that demonstrates the problem and post it here? Please include an FLA that we can just publish and see the issue, and don't forget to zip the files before posting them.

 

You are using the latest version of the classes too, right? Just makin' sure. http://www.tweenlite.com

Link to comment
Share on other sites

OK - I've stuck some pretty obvious traces in there, along with a trace on TweenLite.to() that reports any objects that get tweened and their current alpha, and an onUpdate handler which reports the current alpha when the object tweens.

 

OK - the file at http://www.davestewart.co.uk/files/files/greensock/tween-debug.zip

 

Email me on dave at davestewart dot co dot uk and I will talk you though it. Are you on skype / msn / google chat? Skype suits me as at least I can just tell you which class is doing what, without too much time spent typing.

 

In the meantime, this is a class reference (don't worry - it looks complex, but is just well-organised):

 

class-layout.gif

 

And this is a kind of debug log - you can see TweenLite receiving the object with the alphas at 0, then immediately afterwards, the onUpdate callback reporting that the alphas are in fact 0.5 or more:

 

Gaia Framework (AS3) v3.2.0
Instantiating: [object IndexPage]
ChangeMenu
MainMenu
TWEENLITE TWEENING: [object PreloaderScaffold], which currently has an alpha of 0
Instantiating: [object HomePage]
TWEENLITE TWEENING: [object IndexPage], which currently has an alpha of 0
[object IndexPage] has an alpha of 0.78125
[object IndexPage] has an alpha of 0.78125
[object IndexPage] has an alpha of 0.796875
[object IndexPage] has an alpha of 0.80859375
[object IndexPage] has an alpha of 0.8203125
[object IndexPage] has an alpha of 0.8359375
[object IndexPage] has an alpha of 0.83984375
[object IndexPage] has an alpha of 0.84765625
[object IndexPage] has an alpha of 0.859375
[object IndexPage] has an alpha of 0.87109375
[object IndexPage] has an alpha of 0.87890625
[object IndexPage] has an alpha of 0.890625
[object IndexPage] has an alpha of 0.90625
[object IndexPage] has an alpha of 0.90625
[object IndexPage] has an alpha of 0.9140625
[object IndexPage] has an alpha of 0.921875
[object IndexPage] has an alpha of 0.92578125
[object IndexPage] has an alpha of 0.9375
[object IndexPage] has an alpha of 0.953125
[object IndexPage] has an alpha of 0.953125
[object IndexPage] has an alpha of 0.95703125
[object IndexPage] has an alpha of 0.95703125
[object IndexPage] has an alpha of 0.96484375
[object IndexPage] has an alpha of 0.96875
[object IndexPage] has an alpha of 0.9765625
[object IndexPage] has an alpha of 0.984375
[object IndexPage] has an alpha of 0.984375
[object IndexPage] has an alpha of 0.984375
[object IndexPage] has an alpha of 0.98828125
[object IndexPage] has an alpha of 0.98828125
[object IndexPage] has an alpha of 0.9921875
[object IndexPage] has an alpha of 0.99609375
[object IndexPage] has an alpha of 0.99609375
[object IndexPage] has an alpha of 0.99609375
[object IndexPage] has an alpha of 0.99609375
[object IndexPage] has an alpha of 0.99609375
[object IndexPage] has an alpha of 1
Instantiating: [object GroupPage]
> GROUP PAGE INITIALIZED
TWEENLITE TWEENING: [object PreloaderScaffold], which currently has an alpha of 0
Instantiating: [object ContentPage]
>> CONTENT PAGE INITIALIZED
TWEENLITE TWEENING: [object PreloaderScaffold], which currently has an alpha of 0.15234375
> GROUP PAGE TRANSITIONING IN
TWEENLITE TWEENING: [object GroupPage], which currently has an alpha of 0
[object GroupPage] has an alpha of 0.515625
[object GroupPage] has an alpha of 0.5859375
[object GroupPage] has an alpha of 0.6171875
[object GroupPage] has an alpha of 0.68359375
[object GroupPage] has an alpha of 0.70703125
[object GroupPage] has an alpha of 0.765625
[object GroupPage] has an alpha of 0.7890625
[object GroupPage] has an alpha of 0.8359375
[object GroupPage] has an alpha of 0.83984375
[object GroupPage] has an alpha of 0.859375
[object GroupPage] has an alpha of 0.89453125
[object GroupPage] has an alpha of 0.89453125
[object GroupPage] has an alpha of 0.91015625
[object GroupPage] has an alpha of 0.94140625
[object GroupPage] has an alpha of 0.953125
[object GroupPage] has an alpha of 0.953125
[object GroupPage] has an alpha of 0.97265625
[object GroupPage] has an alpha of 0.97265625
[object GroupPage] has an alpha of 0.98046875
[object GroupPage] has an alpha of 0.9921875
[object GroupPage] has an alpha of 0.9921875
[object GroupPage] has an alpha of 0.99609375
[object GroupPage] has an alpha of 1
>> CONTENT PAGE TRANSITIONING IN
TWEENLITE TWEENING: [object ContentPage], which currently has an alpha of 0
> GROUP PAGE TRANSITIONING IN COMPETE!
[object ContentPage] has an alpha of 0.9765625
[object ContentPage] has an alpha of 0.98828125
[object ContentPage] has an alpha of 0.99609375
[object ContentPage] has an alpha of 0.99609375
[object ContentPage] has an alpha of 0.99609375
[object ContentPage] has an alpha of 1
>> CONTENT PAGE TRANSITIONING IN COMPETE!

 

I really appreciate this! I am so donating after this.

 

Thanks,

Dave

Link to comment
Share on other sites

OK. There is definitely something funny going on.

 

I replaced the TweenLite calls with some old fashioned enterframe handlers and the pages smoothly animate in and out as they should. The Preloader clip however still pops on and off as it is still controlled by TweenLite.

 

This also only seems to happen on animating in... out is fine.

 

Am happy to provide more info, and I hope to hell this is not be being a klutz somewhere along the line.

Link to comment
Share on other sites

Right - I swapped back to my old TweenLite version, 8.16, and everything (again) is fine:

 

 >> CONTENT PAGE TRANSITIONING IN
[object ContentTest] has an alpha of 0.10546875
[object ContentTest] has an alpha of 0.20703125
[object ContentTest] has an alpha of 0.296875
[object ContentTest] has an alpha of 0.37890625
[object ContentTest] has an alpha of 0.3828125
[object ContentTest] has an alpha of 0.46484375
[object ContentTest] has an alpha of 0.53515625
[object ContentTest] has an alpha of 0.5390625
[object ContentTest] has an alpha of 0.609375
[object ContentTest] has an alpha of 0.609375
[object ContentTest] has an alpha of 0.671875
[object ContentTest] has an alpha of 0.671875
[object ContentTest] has an alpha of 0.734375
[object ContentTest] has an alpha of 0.734375
[object ContentTest] has an alpha of 0.78515625
[object ContentTest] has an alpha of 0.78515625
[object ContentTest] has an alpha of 0.8359375
[object ContentTest] has an alpha of 0.875
[object ContentTest] has an alpha of 0.91015625
[object ContentTest] has an alpha of 0.94140625
[object ContentTest] has an alpha of 0.96484375
[object ContentTest] has an alpha of 0.96484375
[object ContentTest] has an alpha of 0.98046875
[object ContentTest] has an alpha of 0.9921875
[object ContentTest] has an alpha of 0.9921875
[object ContentTest] has an alpha of 0.99609375
[object ContentTest] has an alpha of 1
>> CONTENT PAGE TRANSITIONING IN COMPETE!

 

So this might suggest that there's something up with the latest and greatest... :o

Link to comment
Share on other sites

Alright, just to give others an update, Dave and I chatted and the issue had to do with the fact that there was a large amount of processing happening in his app at startup that caused there to be a big gap in time between ENTER_FRAME events. It was not a bug in TweenLite/Max (at least not that we can find thus far). So, for example, let's say that a tween is created when the app initializes and the time is 0 (for the sake of simplicity). Those tweens have a startTime of 0. Then the app runs a bunch of other code (unrelated to TweenLite/Max) that requires a lot of processing power such that the next ENTER_FRAME event doesn't fire for a full 0.8 seconds. That means that when the tweens render the next time, they'll be rendered at 0.8 seconds. It might look like they suddenly jump, but that's not a bug - it's due to the fact that TweenLite/Max honors the duration you set (that's a good thing).

 

The reason v8 appeared to work "better" in this case is because old versions of TweenLite/Max did not offer syncronized tweening and instead based startTime on whatever getTimer() was when the tween is created. This means that if you create a lot of tweens at one time, the first one would start (and finish) before the last one. In most cases, that's not desirable which is why I added the syncronized feature in v10 and later. TweenLite/Max is one of the VERY few tweening engines that offers syncronized tweening. So if you create 10000 tweens in a single for() loop, they'll all begin and end at precisely the same time. Not in v8, though.

 

Thanks, Dave, for the example code and the help in understanding what was going on in your files.

Link to comment
Share on other sites

  • 3 weeks later...

Hey Jack,

 

You know I think I've figured out the problem, and you will be pleased that I can 100% confirm that it has nothing to do with TweenLite. The culprit lies with MonsterDebugger, or more accurately, how I was calling traces with it.

 

The standard way to trace something to the MonsterDebugger console for inspection is as so:

 

MonsterDebugger.trace(, );

 

The first parameter must always be the application, i.e. "this", and the second parameter is what you want to inspect. So to simply inspect an XML list, I would write the following code...

 

MonsterDebugger.trace(this, assetNodes);

 

...giving an output like this:

 

# | Time         | Target              | Message         | Memory
6 | 20:05:49:466 | [object IndexPage]  | (XMLList)       | 66824Kb

 

Double-clicking on the entry in the debugger would allow you to visually inspect and navigate the passed XMLList, however, there is no way to inspect the Target parameter, which is often what I wanted to look at, so I started to trace the following throughout my app:

 

MonsterDebugger.trace(this, this);

 

It turns out that ONLY this code, and not anything in Gaia, my app or Greensock was making the animation seemingly "pop" in, I guess as Flash and MD communicated, and some intensive processing took place.

 

Interestingly, the memory consumption column in MD stayed around the same, so I don't think it was this - I suspect that perhaps inside MD it was resolving recursive references or something like that.

 

Anyway - good to finally get to the bottom of it. My app is now performing as smoothly as I would have expected, and I just want to thank you again for your help in looking at the problem.

 

I will be purchasing a Greensock membership as soon as the client pays me!

 

All the best,

Dave

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