Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Kendaros

ES6 import TweenLite not working?

Recommended Posts

Hello,

 

First of all thank you for your work on gsap (and forums), which is a library that I like to use :)

I've always used TweenMax so I didn't have any problem with ES6 import before, but right now I'm struggling to use TweenLite through ES6 import.

 

What I do is:

import TweenLite from 'gsap/TweenLite'

 

TweenLite is loaded in my bundle, no error is thrown, but this line does not work at all (no animation).

TweenLite.from(this.$refs.animate, 0.2, { opacity: 0 })

 

If I do import only gsap (and not gsap/TweenLite), the animation does trigger properly, but because gsap refers to TweenMax, TweenLite in this example is in fact TweenMax which loads a bunch of things I don't need for simple animations:

import { TweenLite } from 'gsap' // or import TweenMax from 'gsap/TweenMax'


So what I am seeing here is that the animation works with TweenMax, but not TweenLite, when importing through ES6.

Am I doing something wrong here when I import TweenLite?

 

I have searched the web but found only this thread where Jack says that import TweenLite from 'gsap/TweenLite' should be working: 

 

(Using version 1.20.3)

Thank you for reading!

Link to comment
Share on other sites

Hi and welcome to the GreenSock forums,

 

My guess is that you aren't loading CSSPlugin which is necessary to animate css properties of DOM elements.

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

Yes! That was a simple as that.

Sorry for my mistake. I thought that I could tween CSS properties with TweenLite alone as I am used to use TweenMax. I should have payed more attention. 

 

import TweenLite from 'gsap/TweenLite'
import 'gsap/CSSPlugin'

 

Thank you for the help! :)

  • Like 2
Link to comment
Share on other sites

No worries. Glad it was that simple.

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