ryonakae
2/15/2017 - 4:30 PM

TimelinePlus (http://qiita.com/yuichiroharai/items/55b0a850ff68d3b7e3fc) をES2015で

'use strict'

import gsap from 'gsap'
import TimelinePlus from './TimelinePlus'

TimelinePlus.parallel([
  TimelinePlus.serial([
    TweenMax.to(spans[0], 0.7, {x: 400, ease: Expo.easeInOut}),
    TweenMax.to(spans[1], 0.9, {x: 400, ease: Expo.easeInOut})
  ]),

  TimelinePlus.parallel([
    TweenMax.to(spans[2], 0.7, {x: 400, ease: Expo.easeInOut}),
    TweenMax.to(spans[3], 0.9, {x: 400, ease: Expo.easeInOut})
  ]).delay(0.5)
])
export default {
  serial: (array) => {
    const tl = new TimelineMax()

    array.forEach((value) => {
      tl.add(value)
    })

    return tl
  },

  parallel: (array) => {
    return new TimelineMax().add(array)
  }
}