Jump to content
Search Community

Tweening Objects in a carousel

eware3000 test
Moderator Tag

Recommended Posts

Hi, I just started using TweenMax today.

I have a question about tweening multiple objects, not sure if I'm going about this the best way.

Objects A, B, C are on the stage in order and scaled accordingly (100%, 60% and 40%)

eg. 1st place =A at 100%, 2nd place= B at 60%, 3rd place =C at 40%

 

When you click B. The order need to change in a tween to this --> B, C, A.

 

When you click C. The order need to change in a tween to this --> C, A, B.

 

You can click A, B, or C at any time and change the order/focus.

 

Here's my code:

3 if statements that check to see where the object is positioned (in 1st plae, 2nd or 3rd.)

 

// ActionScript Document

	if(productC._x > 250){
	trace ("hello");
	//TweenMax.to(productA, 1, {_x:140, _y:75, _xscale:60, _yscale:60});  //to 2
	TweenMax.to(productB, 1, {_x:-13, _y:40, _xscale:100, _yscale:100}); //to 1
	TweenMax.to(productA, 1, { _alpha:0});  //to invisible
	TweenMax.to(productA, 1, {_x:268, _y:90, _xscale:40, _yscale:40,  _alpha:100}); //to 3	
	TweenMax.to(productB, 1, { _alpha:0});  //to invisible\
	TweenMax.to(productC, 1, {_x:-13, _y:40, _xscale:100, _yscale:100}); //to 1
	//TweenMax.to(productB, 1, {_x:-116, _y:154, _xscale:40, _yscale:40,  _alpha:0 ,delay:2, overwrite:1}); //to down and out
	}

	//TweenMax.to(productB, 1, { _alpha:0}); //to invisible
	//TweenMax.to(productC, 1, {_x:-13, _y:40, _xscale:100, _yscale:100}); //to 1
if(productC._x = 140){
	trace ("yo_140");
	TweenMax.to(productC, 1, {_x:-13, _y:40, _xscale:100, _yscale:100}); //to 1
	TweenMax.to(productB, 1, { _alpha:0});  //to invisible
	productB._x = 350;
	productB._y = 90;
	productB._xscale = 40;
	productB._yscale = 40;
	productB._alpha=100;
	TweenMax.to(productA, 1, {_x:140, _y:75, _xscale:60, _yscale:60,  _alpha:100}); //to 2			
	TweenMax.to(productB, 1, {_x:268, _y:90, _xscale:40, _yscale:40,   _alpha:100, timeScale : 0.5 }); //to 3	
}

if(productC._x < 0){
	trace ("yo_0");

	TweenMax.to(productC, 1, { _alpha:0});  //to invisible
	TweenMax.to(productA, 1, {_x:-13, _y:40, _xscale:100, _yscale:100}); //to 1
	TweenMax.to(productB, 1, {_x:140, _y:75, _xscale:40, _yscale:40,  _alpha:100}); //to 2			
	TweenMax.to(productC, 1, {_x:268, _y:90, _xscale:40, _yscale:40,  _alpha:100}); //to 3	
}

 

Any help/direction would be greatly appreciated.

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