Jump to content
GreenSock

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

Events making a tween choppy?

Recommended Posts

Hi,

 

I'm having a weird issue, maybee it's normal but I have a tweenlite playing in loop (in a timelinelite) on my project. There is a lot of eventlisteners too on the stage and when I move the mouse quicly on the stage, the listeners are fired but it makes the looping tweenlite animation very choppy. This tweenlite animation is completely on it's own and is not affected by the listeners in any way... Anyone has a fix for this?

 

Thanks

Link to comment
Share on other sites

If you have other things in your application that are taking a lot of resources (events firing, handlers doing things, animation, etc.) it can affect performance of all parts of your application including TweenLite and TimelineLite instances. It probably isn't a problem with TweenLite/TimelineLite per se, but you likely need to optimize your other code. Typically TweenLite and TimelineLite are extremely efficient and they don't hog a lot of resources (http://blog.greensock.com/tweening-speed-test/). If you think it's a problem with the engine, please post an example that demonstrates the issue.

 

Oh, and do you have a LOT of objects on the stage? If so, mouse events bubble through them all and can cause performance issues. Just a thought.

Link to comment
Share on other sites

Yeah I'll have to do some test :( . I have 2 similar classes (both running timelineLite in loop) having instances running at the same time in my project. They're not in the same display object and one of them is working correctly (not choppy) and the other one (whis is a similar graphic with the same kind of timeline loop) is very choppy when mousing over the buttons.

 

I did set my buttons so they would not bubbles but anyway the "problem animation" is nested deeper than the buttons that are listeners. They're is only a dozen of buttons. It probably is a silly issue but it's driving me nuts :)

 

I don't think it's a tweenlite problem but every thought on what my problem could be will be appreciated.

Link to comment
Share on other sites

Ok here are my findings so it might help others.

 

I have a button class which have it's own listeners applied to it so as soon as I add a button it is already set up. These events included a RollOver and a RollOut. The reason my little application was running slow is this (simplified code to make it simple):

 

private function fadeIn(e:MouseEvent):void  //RollOver listener
{			
TweenLite.to(texte_mc.titre_mc, .2, {colorTransform:{tint:0xffffff}});
}

private function fadeOut(e:MouseEvent):void  //RollOut listener
{
TweenLite.to(texte_mc.titre_mc, .2, {colorTransform:{tintAmount:0}});
}

 

It seems that when I was moving the mouse over the buttons very fast, the fact that the tweens were "going one over the other" (which I don't understand since I didn't init the overwrite manager) was completely bugging my app... To solve the problem I just did a timelineLite so even if the tween isn't complete it will just reverse from where it is. Like this:

 

public var timeline:TimelineLite = new TimelineLite({paused:true});

timeline.append(TweenLite.to(texte_mc.titre_mc, .2, {colorTransform:{tint:0xffffff, tintAmount:1}}));

private function fadeIn(e:MouseEvent):void  //RollOver listener
{			
timeline.play();
}

private function fadeOut(e:MouseEvent):void  //RollOut listener
{
timeline.reverse();
}

 

Thanks again

Link to comment
Share on other sites

Didn't you mean reverse() instead of stop()?

 

By the way, the latest version of TweenLite now includes a reverse() method, so you don't even need a TimelineLite. http://blog.greensock.com/v11beta/

 

And by the way, since you didn't init() OverwriteManager previously, your tweens were overwriting each other which is exactly what you'd want. Don't worry - the tweens weren't "stacking up" or anything. That's one of the features of TweenLite actually (verses many other engines). I have TweenLites on buttons like you were doing all the time and I can roll over/out/over/out quickly and performance is great. I'd be interested to see an example, though, that demonstrates choppy behavior. Maybe there's something else going on?

Link to comment
Share on other sites

Oups sorry my mistake, you are right I meant reverse. I will edit my post. This is also great news to hear that tweenlite now supports reverse, I always wanted that :)

 

For the overwrite manager, I thought that if you didn't initialize it it would automatically overwrite any overlapping tween. Anyway good info to hear that it wasn't the case. So it would mean that I could have probably solved my problem by initialising it?.

 

I could send you my project if you want to see the behavior but it was the problem to be sure... since I change that for a timelineLite (a Tweenlite VERY soon :D ) the animation runs very smoothly and as it should.

 

Thanks

Link to comment
Share on other sites

For the overwrite manager, I thought that if you didn't initialize it it would automatically overwrite any overlapping tween. Anyway good info to hear that it wasn't the case. So it would mean that I could have probably solved my problem by initialising it?.

 

No, I think you misunderstood. The default behavior in TweenLite (when you DON'T call OverwriteManager.init() or use TweenMax/TimelineLite/TimelineMax) is to immediately and completely kill all existing tweens of the same object when a new tween is created. So initializing OverwriteManager wouldn't help you performance-wise. TweenLite was already overwriting previous tweens immediately. And even if OverwriteManager is initialized, you can pass overwrite:true in your tween to force it to overwrite all existing tweens of the same object. Maybe try that and see if it helps things at all. Although if you're just going to play() and reverse() a single tween now, that's even better.

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