Jump to content
GreenSock

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

TweenMax.staggerTo and pause

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi everyone,

 

this isn't a question, just an observation!

I was using TweenMax.staggerTo recently and was wondering why my tween was playing if I didn't pass paused: true, but if I did and then tried to use .play() I would get an error saying something like tween.play() is not a function.

 

Turns out staggerTo creates an array of tweens, and arrays do indeed lack a .play() function.

 

So if you plan on controlling the playback of a single staggerTo tween, you still should put it into a timeline :) Maybe this ought to be mentioned in the docs? Caused me quite the headache :P 

  • Like 1
Link to comment
Share on other sites

The docs do state that stagger returns an array of TweenMax instances, but I'd agree that an extra note about needing a timeline for control would probably be a good addition to the docs. I have seen this question asked a few times in the forum so it can be confusing.

  • Like 5
Link to comment
Share on other sites

It's a great suggestion. I just cracked open the docs to make a note and noticed that TweenMax.staggerTo(), staggerFrom(), and staggerFromTo() already address this:

 

https://greensock.d.pr/KlFXqM

 

There's a chance Jack may have added it over the weekend or maybe you just missed it. Either way, thanks for the suggestion. Let us know if there is a way to make it more clear.

  • Like 3
Link to comment
Share on other sites

I'm not sure if I missed it or it was added, but imo even that's a bit easy to miss. Usually when I read a doc – and I am aware this isn't great, but I assume I'm not the only one doing this – I skim the page to find the parts that are relevant to what I'm doing... with the way the staggerTo page is laid out right now, I would have read:

Quote

staggerTo() can also work on a jQuery collection as shown below:

<codepen>

<paragraph presumably about using a jQuery collection that can safely be ignored since I don't use jQuery>

 

I would put a note under the "Returns" paragraph at the top, something like:

Quote

Returns : Array

An array of TweenMax instances (one for each object in the targets array). If you want to control the playback of all the tweens together, you should consider using TimelineLite's staggerTo() method.

 

Just a suggestion :)

Link to comment
Share on other sites

Great ^_^

 

In related news, as some might know I'm working with Three.js as well as GSAP right now, and the docs/communities are simply not in the same league. It's weird to go from Three.js's documentation to GSAP's, and to suddenly have some actual explanation for things! Would you believe it? A documentation that actually tries to make it easier to use a product...

  • Like 2
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.

×