anteksiler Posted March 23, 2020 Share Posted March 23, 2020 Is there any way we can add classes to the elements of each iteration of stagger? onRepeat callback does not provide the current iteration 's target as far as I can see. Link to comment Share on other sites More sharing options...
OSUblake Posted March 23, 2020 Share Posted March 23, 2020 You can put callbacks inside the stagger object. gsap.to(elements, { x: 100, repeat: -1, stagger: { each: 0.1, onComplete() { console.log(this.targets()[0]); // <= the current target } } }) 5 Link to comment Share on other sites More sharing options...
anteksiler Posted March 23, 2020 Author Share Posted March 23, 2020 2 minutes ago, OSUblake said: You can put callbacks inside the stagger object. gsap.to(elements, { x: 100, repeat: -1, stagger: { each: 0.1, onComplete() { console.log(this.targets()[0]); // <= the current target } } }) Oh wow! This is super useful! I don't think this is on documentation. Thank you @OSUblake Link to comment Share on other sites More sharing options...
OSUblake Posted March 23, 2020 Share Posted March 23, 2020 1 minute ago, anteksiler said: Oh wow! This is super useful! I don't think this is on documentation. There's a new documentation page for staggers. Check out the Repeat / Yoyo / Callbacks section. https://greensock.com/docs/v3/Staggers 2 Link to comment Share on other sites More sharing options...
ZachSaucier Posted March 23, 2020 Share Posted March 23, 2020 38 minutes ago, anteksiler said: I don't think this is on documentation. 35 minutes ago, OSUblake said: There's a new documentation page for staggers. Check out the Repeat / Yoyo / Callbacks section. https://greensock.com/docs/v3/Staggers It's also explained in the video on the staggers documentation page Link to comment Share on other sites More sharing options...
GreenSock Posted March 23, 2020 Share Posted March 23, 2020 It is in those two places but I'm also curious if you thought it belonged elsewhere in the docs, @anteksiler. Like...where were you expecting it? It's always a balancing act for us between having concise (but "detailed enough") docs and having overwhelmingly detailed docs (where the volume of content can actually become an impediment). Link to comment Share on other sites More sharing options...
anteksiler Posted March 23, 2020 Author Share Posted March 23, 2020 Hi @GreenSock, it would be great if "stagger" information under parameters inside https://greensock.com/docs/v3/GSAP/gsap.to() have a link to https://greensock.com/docs/v3/Staggers And, https://greensock.com/docs/v3/Staggers can have row for callbacks here: 2 Link to comment Share on other sites More sharing options...
ZachSaucier Posted March 23, 2020 Share Posted March 23, 2020 20 minutes ago, anteksiler said: it would be great if "stagger" information under parameters inside https://greensock.com/docs/v3/GSAP/gsap.to() have a link to https://greensock.com/docs/v3/Staggers Good suggestion! Thanks. I added a link in the relevant pages to the staggers docs. 21 minutes ago, anteksiler said: And, https://greensock.com/docs/v3/Staggers can have row for callbacks here: That's a little more complex. There are actually a lot of special properties that are available for use inside of the stagger object (almost as many as on tweens themselves). Instead of muddying the docs for the stagger object with values that aren't helpful in 99% of cases, I added a note before the listing. I also added a note after the property listing specifically mentioning callbacks and repeat since they're the most common special property inside of the stagger object. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now