Jump to content
GreenSock

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

What to tween as an argument

Recommended Posts

I'm not sure if this question is more related to greensock or to action script 3 in general, but it is related to working with greensock libraries so I think somebody may gain something from it if I ask it here.

 

Is it possible to give as an argument not only how to tween, but also what to tween? To show what I mean by using pseudocode:

 

var name = x;
var value = 100;
var pair = name:value;

TweenMax.to(object, 1, { pair });

 

Is something like that somehow possible?

 

Regards!

Link to comment
Share on other sites

I think this is what you're looking for:

 

var vars:Object = {}; //this will eventually hold our name/value pair
var name:String = "x";
var value:Number = 100;

vars[name] = value;
TweenMax.to(object, 1, vars);

Link to comment
Share on other sites

Thank you very much, I was looking just for 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.
×