Jump to content
Search Community

GSAP 3 syntax for chaining timelines

Daniel Hult test
Moderator Tag

Recommended Posts

Hi!

Just wondering how I go about chaining my timelines into a master timeline with GSAP 3.

What does this become in GSAP 3?
 

let tl = new TimelineMax()


Like if that is inside a function would it just be this?
 

const someAnimation = element => {
  let tl = gsap.timeline()

  tl.to(element, {
    duration: 1,
    x: 100
  })

  return tl
}

 

Link to comment
Share on other sites

7 minutes ago, Daniel Hult said:

Like if that is inside a function would it just be this?
 


const someAnimation = element => {
  let tl = gsap.timeline()

  tl.to(element, {
    duration: 1,
    x: 100
  })

  return tl
}

Yep! A master timeline has no special significance. It's just a common name for one that you use to control other (sub) timelines. 

 

For example:

const someAnimation = element => {
  let tl = gsap.timeline()

  tl.to(element, {
    duration: 1,
    x: 100
  })

  return tl
}

const master = gsap.timeline();
master.add(someAnimation);

 

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