Jump to content
Search Community

Slight delay with timeline and tween with staggerFromTo

Yaniv Nagar test
Moderator Tag

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

Hello all,

 

I have this Codepen:

See the Pen vrMVLY by trueicecold (@trueicecold) on CodePen

You'll notice there is a slight delay between the two tweens for each cube animated, because it waits for the entire animation to finish before moving on to the next animation. Is there a way of telling each cube that has finished to move on to the next tween?

 

Thanks!

Link to comment
Share on other sites

You can use a position parameter (0.5) on the staggerTo() so that it starts immediately after the first tween in the staggerFromTo()

 

.staggerFromTo($(".menu_tile"), 0.5, {top:"-120px", opacity:0}, {top:0, opacity:1,onUpdate:onHeaderUpdate, onUpdateParams:["{self}"]}, 0.1)
    .staggerTo($(".menu_tile"), 1, {top:"0px", onUpdate:onHeaderUpdate, onUpdateParams:["{self}"], onComplete:onHeaderComplete, onCompleteParams:["{self}"]}, 0.16, 0.5);

 

See the Pen bKJZzZ?editors=0010 by GreenSock (@GreenSock) on CodePen

 

https://greensock.com/position-parameter

 

https://greensock.com/docs/TimelineLite/staggerFromTo()

 

  • Like 3
Link to comment
Share on other sites

Thanks @Carl, but if you have a close look, there's still a delay for the last letters, until they enter the next animation.

Is it possible to achieve the same behavior as my example (no delay for any of the letters) using timeline?

 

Reason I'm asking is because I want to reverse it at some point...

 

Thanks!

Link to comment
Share on other sites

The default behavior for a timeline is to run the tweens in succession. By adding the position parameter you can alter the start times of the tweens. Either with a label, relative time or absolute time.

 

https://greensock.com/position-parameter

 

If you had a collection of tweens that were not part of a timeline, they would all start at the same time (0) provided none of them had a delay or was put into a paused state. Hopefully that helps. Happy tweening.

:)

 

  • 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.
×
×
  • Create New...