Jump to content
Search Community

Defining correct end value for TweenLite [SOLVED]

outshine test
Moderator Tag

Recommended Posts

Hello,

 

I've run into a little bit of a wall with TweenLite (AS2). It isn't really an issue with TweenLite so much as my lack of understanding, and I'm hoping someone will be gracious enough to educate me.

 

I'm using TweenLite to tween the _xscale and _yscale of a movieclip. The issue is that the end _xscale and _yscale values will differ depending on the original size of the movieclip. I need to reduce the _xscale and _yscale until the movieclip's width is less than 620. I've created a pretty clumsy way of doing this:

 

center._alpha = 0;
center.onEnterFrame = function(){		
if(center._width > 620){			
	center._xscale -= 1;
	center._yscale -= 1;
}
else{			
	delete center.onEnterFrame;
	xScale = center._xscale;
	yScale = center._yscale;				
	center._xscale = 100;
	center._yscale = 100;		
	TweenLite.to(center, 2, {_xscale:xScale, _yscale:yScale, _alpha: 100, ease:Regular.easeIn});			
}
}		

 

This actually works fine, but there is a 2-3 second delay while the onEnterFrame is running to figure out what the _xscale and _yscale should be. Has anyone run into anything similar to this? Would it be possible to use some sort of formula to determine the appropriate _xscale and _yscale values without running an onEnterFrame loop?

 

Thank you for any feedback.

Link to comment
Share on other sites

Yes! That is exactly what I'm looking for, it's works perfectly. Thank you so much for responding so quickly.

 

It was the ratio variable that I was unable to figure out. I'm more of a Flash designer, and there have been several instances where my lack of mathematical know-how has been problematic. Would you happen to know of any resources that would be helpful to study that perhaps focus on mathematics from a Flash development standpoint, or should I just dust off my old textbooks?

 

Thank again! Really appreciate you developing TweenMax. It's been a game changer for me!

Link to comment
Share on other sites

Glad to hear TweenMax has been helpful. Always gratifying to hear of fellow designers putting it to good use. :)

 

I'd recommend Kieth Peters' book "ActionScript Animation" if you want to learn some really nifty stuff for animating things in ActionScript. Best book I've read by far. He's great at explaining things in an easy-to-understand way. There's an AS2 book as well as an AS3 one.

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