Jump to content
Search Community

TweenMax.staggerTo and staggerForm issue

idarfan test
Moderator Tag

Go to solution Solved by Ihatetomatoes,

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

  • Solution

Hi idarfan,

I've created a CodePen showing you a few options - 

See the Pen 1462ef622d1488e3c956bbdddb6f39fb by ihatetomatoes (@ihatetomatoes) on CodePen


As MindGamer mentioned, your TweenMax staggerTo and staggerFrom tweens are running at the same time, giving you the wrong result.


The best way would be to use a timeline:

// Timeline controlling boxes up/down
var tl = new TimelineMax();
tl.staggerTo(".box", 2, {rotation:360, y:300}, 0.5)
  .staggerTo(".box", 2, {rotation:0, y:0}, 0.5);

By default the starting position of the elements is the position defined in the stylesheet. In other words if you would want to swap the order of your animations, you could use something like this:

// Timeline controlling boxes down/up
var tl = new TimelineMax();
tl.staggerFrom(".box", 2, {rotation:360, y:300}, 0.5)
  .staggerTo(".box", 2, {rotation:360, y:300}, 0.5);

Explore the code in the CodePen, I've commented out some of the code snippets.




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