Jump to content
GreenSock

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

appendMultiple useing an array of x and y positions.

Recommended Posts

how can i animate all the objects in stuffArray to different x and y positions stored in xArray and yArray?

 

this doesn't work:

tl.appendMultiple(
			TweenMax.allTo(stuffArray, 2, {y:yArray, x:xArray },.2)
		);

 

this doesn't work they all animate to the 0 index of xArray and yArray.

 

  for (var i = 0; i< stuff.length; i++){
tl.appendMultiple(
			TweenMax.allTo(stuff, 10, {y:yArray[i], x:xArray[i], ease:Elastic.easeOut })
		);
}

 

What is the solution i am missing?

 

Thanks

Link to comment
Share on other sites

Hi,

 

allTo() allows you to tween multiple objects to the same end values.

 

if each object in stuff needs to go to specific values in yArray and xArray try this:

 

 

for (var i = 0; i< stuff.length; i++){
 tl.insert( TweenMax.to(stuff[i], 10, {y:yArray[i], x:xArray[i], ease:Elastic.easeOut }), .2 );
}

 

 

 

that code will take each element in stuff and tween its x and y values to the values stored in xArray and yArray respectively with .2 second offset.

Link to comment
Share on other sites

Carl,

thank you for your response.

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