Hi guys! My first topic here!
I have an array of pages, and I want to go to the previous/next one using tweens, with different types of transitions, horizontal sliding (x coordinate), vertical sliding (y coordinate), fading (alpha parameter) or rotation (rotationY parameter).
I want to convert classic tweens to tweenlite. The original code (for just one of the two pages moving) was
new Tween(pages[whatever], transitionType, Regular.easeOut, BStart, BEnd, transitionSpeed, true);
where transitionType can be "x", "y", "alpha" or "rotationY", corresponding to 4 MovieClip native properties.
The stupid way would be the following code:
switch (transitionType)
{
case "x" :
pages[whatever].x = BStart;
TweenLite.to(pages[whatever], transitionSpeed, {x : BEnd});
break;
case "y" :
pages[whatever].y = BStart;
TweenLite.to(pages[whatever], transitionSpeed, {y : BEnd});
break;
case "alpha" :
pages[whatever].alpha = BStart;
TweenLite.to(pages[whatever], transitionSpeed, {alpha : BEnd});
break;
case "rotationY" :
pages[whatever].rotationY = BStart;
TweenLite.to(pages[whatever], transitionSpeed, {rotationY : BEnd});
break;
}
I need a smarter coding like
pages[whatever].###transitionType### = BStart;
TweenLite.to(pages[whatever], transitionSpeed, {###transitionType### : BEnd});
in order to add n transitions corresponding to n MovieClip native properties without creating a giant switch, but just keeping 2 lines of code (classic tweens need just 1!).
The problem is that I don't know how to use a string as a tween parameter name or a Movieclip property name.
Can you help me, please?