Jump to content
GreenSock

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

.totalProgress() - Why no work with TweenMax.staggerTo

Go to solution Solved by Carl,

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

What it says on the tin.

 

Why do I get a "is not a function" error when trying to get the total progress of a staggerTo (or From) tween?

 

Am I being thick here or is this a well known thing?

See the Pen JRpZqw?editors=0011 by dipscom (@dipscom) on CodePen

Link to comment
Share on other sites

  • Solution

Hi and welcome to the GreenSock forums,

 

Thank you for providing the demo. Very helpful.

 

;)

 

The reason for the error is that TweenMax.staggerTo() creates and returns an Array of tweens.

try console.log(t2) in your code.

 

 

Most people don't realize this until they try to call a method like play() or restart() or progress() on a staggerTo().

 

If you have a staggered effect that you need to track the totalProgress() use a timeline like

var tl = new TimelineLite();
tl.staggerTo(obj, 1, {x:200}, 0.2);

Let me know if you need more help.

  • Like 3
Link to comment
Share on other sites

Most exquisite behaviour.

 

Thank you sir. This place looks like a good gathering of nice people. Very welcoming ;)

 

BUT! With the information you have just provided...

 

One could argue that one can reach the totalProgress of a element with:

var t2 = TweenMax.staggerTo([{}], 1, {});
console.log("t2a:", t2[0].totalProgress());

Does not seem to be mandatory to have a timeline.

  • Like 1
Link to comment
Share on other sites

Yup. if you just need the totalProgress() of one of the tweens then that will work fine.

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