Jump to content
GreenSock

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

Stagger onStart when using distributeByPosition?

Recommended Posts

Hey friends,

 

With an object based stagger, you can do an onStart like so:

stagger: {
  each: 1,
  onStart: myFunc
}

 

However if you use the distributeByPosition stagger helper function (like this demo) it doesn't work that way. Any ideas how to get a stagger onStart to work with a setup like the linked demo?

Link to post
Share on other sites

Sure, you could just manually loop through the targets and insert the tweens using the distribute helper function like this: 

See the Pen KKaQoLq?editors=0010 by GreenSock (@GreenSock) on CodePen

 

And put your onStart there (in each tween). 

 

The whole stagger thing is simply a way of calculating the delays on the resulting tweens (one for each target), so this is just doing it in a more manual way so that you have total control. 

 

Does that clear things up?

  • Like 5
Link to post
Share on other sites

Yes, makes sense. I was going to do it that way if there were not something secret already built in that supports this :) Thanks for the info!

Link to post
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.

×