Jump to content
GreenSock

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

Detect last stagger

Recommended Posts

How do I detect when last staggered element is fired? I need to start another animation on this event.

Link to comment
Share on other sites

Inside of the stagger object you can place callbacks like onStart that will fire once that element is fired. For example:

gsap.to(".box", {
  x: 100,
  stagger: {
    each: 0.1,
    onStart: myFunc
  }
});

See the stagger docs for more info.

Link to comment
Share on other sites

As i understand, if you need detect only last element (when animation finish), you can use onComplete 

See the Pen abdwjMW?editors=1111 by -greg- (@-greg-) on CodePen

 

If you need detect for every element, place onComplete inside stagger: {}

Link to comment
Share on other sites

Thanks, it works 👍. But it is practically not noticeable in Docs

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