Jump to content
GreenSock

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

Changing ease type via a dynamic variable?

Recommended Posts

Greetings,

 

I am trying to manipulate the easing portion of the tween call with a dynamically set variable, kind of like this:

 

var myTween = "Sine.easeInOut"
TweenNano.to(my_mc,1,{_y:99, ease:myTween});

 

What type of variable is the tween expecting? Can this be done?

 

Thanks

 

Jacob

Link to comment
Share on other sites

Absolutely. It expects a function.

 

var myEase:Function = Sine.easeInOut;
TweenNano.to(my_mc,1,{_y:99, ease:myEase});

 

If you need to translate a String into the appropriate function, you can use the EaseLookup class, but in this case you don't really need that.

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