Jump to content
Search Community

Timeline doesn't finish/pause for added timelines

Fakebook 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

 I created a simple example of what I've been working on.  Basically, I want to do the following with multiple timelines.

 

In my example, only one box should be moving at a time.  Currently, multiple will play at the same time.  So, red box moves and stops, then green box moves and stops, then blue box moves and stops, then finally red box moves again and then stops.

 

It is also important that I use functions, because in my working project example I am taking advantage of certain callback functions.

var tl = new TimelineMax({
    repeat: -1
  }),
  tl2 = new TimelineMax(),
  tl3 = new TimelineMax();

tl.to("#one", 1, {
  left: 300
});

tl.add(tl2);
tl.add(tl3);

tl.to("#one", 1, {
  left: 60
});

function timeline2() {

  tl2.to("#two", 1, {
    left: 400
  });

}

function timeline3() {
  tl3.to("#three", 1, {
    left: 300
  });
}

timeline2();
timeline3();

See the Pen KVXdrB by NerdOrDie (@NerdOrDie) on CodePen

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