Jump to content
GreenSock

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

TweenMax.staggerTo and pause

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

Share this post


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

Share this post


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

Share this post


Link to post
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 :)

Share this post


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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×