Jump to content
Search Community

Is it possible to use such long parameters in tweening code?

learner_7n test
Moderator Tag

Recommended Posts

Hi,

 

I am using the following code to tween my PortFolio_mc but now I want to add some more parameters to make the content in the center of the page when resizing. How can I modify the code?

 

The following is the code I am using:

 

TweenMax.fromTo(PortFolio_mc, 5, {x:980, y:410, alpha:.5}, {x:100, y:410, alpha:1, delay:3, ease:Strong.easeOut});

 

The following are the detail parameters which I would like to use in WIDTH & HEIGHT of above code:

 

PortFolio_mc.x=stage.stageWidth/2-PortFolio_mc.width/2-180;
PortFolio_mc.y=stage.stageHeight/2-PortFolio_mc.height/2;

 

How can I? Please help.

Link to comment
Share on other sites

there is no limit set on how robust the equation is for determining a value inside a tween.

did you get errors?

 

 

you could do something like this

 

TweenMax.fromTo(PortFolio_mc, 5, {x:980, y:410, alpha:.5}, {x:stage.stageWidth/2-PortFolio_mc.width/2-180:, y:stage.stageHeight/2-PortFolio_mc.height/2, alpha:1, delay:3, ease:Strong.easeOut});

 

 

or once it gets unreadable most people would probably create a var as an easier way to reference a value based on a big equation.

 

var myY:Number = stage.stageHeight/2-PortFolio_mc.height/2;

TweenLite.to(mc, 1, {y:myY});

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