Jump to content
Search Community

export multiple timelines and play in a master timeline

eduardfossas test
Moderator Tag

Recommended Posts

Hello, sorry if I am bothering too much this forum but I am eager to learn.

 

I have the following code:

 

import { gsap } from 'gsap'

export const SPINNER_TIMELINE = gsap.timeline({ paused: true })
export const LOADER_TIMELINE = gsap.timeline({ paused: true })
export const HERO_TIMELINE = gsap.timeline({ paused: true })
export const HEADER_TIMELINE = gsap.timeline({ paused: true })
export const MASTER_TIMELINE = gsap.timeline({ paused: true })

 

then I am doing this in a Spinner class:

 

import { SPINNER_TIMELINE } from '@options/timelines'

class Spinner {
  constructor(element) {
    this.setLoader()
  }
  
  setLoader(spinner, spinnerBot) {
  	SPINNER_TIMELINE.to(
      spinner.left.start,
      {
        x: 10
        duration: '1',
        ease: 'none',
      },
    )
  }
}

and then I am having another class that creates and instance of this spinner class

import {
  SPINNER_TIMELINE,
  MASTER_TIMELINE,
} from '@options/timelines'

class Intro {
  constructor() {
    new Spinner()
    this.animateMasterTimeline()
  }
  
  animateMasterTimeline() {
    MASTER_TIMELINE.add(SPINNER_TIMELINE, {
      time: SPINNER_TIMELINE.duration(),
      duration: SPINNER_TIMELINE.duration(),
      ease: 'power3.inOut',
    })
  }
}

Spinner and Intro class are starting properly but the animation it's not.

What I am doing wrong?

 

Warm regards and thanks in advance

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