greensock / GSAP

GSAP (GreenSock Animation Platform), a JavaScript animation library for the modern web
https://gsap.com
19.85k stars 1.72k forks source link

EasePack & Webpack #91

Closed Makio64 closed 9 years ago

Makio64 commented 9 years ago

Hi guys,

I get some troubleshoot about how I should require the TweenMax & Easing function in webpack

I try to add this : TweenMax: vendors+'greensock/uncompressed/TweenMax.js', EasePack: vendors+'greensock/uncompressed/easing/EasePack.js'

It works for TweenMax but I can't get the ease function like Quint when i do require('EasePack').Quint .

Thanks for helping!

jackdoyle commented 9 years ago

I'm not quite sure I understand your question, but keep in mind that:

Does that help at all?

tcw165 commented 9 years ago

hi @jackdoyle ,

Can you fire some example of how to tell GSAP to add its classes to a different object rather than the global one, by defining a GreenSockGlobals property of the global scope.?

jackdoyle commented 9 years ago

I'm not familiar with Webpack specifically, but I can tell you that in a web page all you have to do is:

var gs = window.GreenSockGlobals = {}; //then load the GSAP file(s). Then: gs.TweenLite.to(...);

Does that help?

Makio64 commented 9 years ago

This bug was fix since this time. ( https://github.com/greensock/GreenSock-JS/pull/106 & https://github.com/Makio64/GreenSock-JS/commit/6fbfc74888155765a1d97443139c112f1b9f1892 )

If it can help you, in my webpack config I have this ( I remove the code unrealeted with tweenmax ) :

resolve: { alias: { TweenMax: vendors+"gsap/src/uncompressed/TweenMax.js", } }, plugins: [ new webpack.ProvidePlugin({TweenMax: "TweenMax"}) ]

then in my code i can use now tweenmax / easing wihout any require :

TweenMax.to(position,.8,{y:0,delay:delay,ease:Back.easeOut});

glebmachine commented 8 years ago

Is there any canonical way, like?:

import { TweenMax, Power2, Power3 } from 'TweenMax';
jackdoyle commented 8 years ago

Not that I know of today, no. I'm just not at all familiar with Webpack. Sorry. We do hope to move to an ES6 model at some point, so that should help. But I can't promise any delivery dates yet (it's a lot of work, as you can probably imagine).

glebmachine commented 8 years ago

Yep, it would help.

So this case work correctly now:

import { Power2 } from 'gsap/src/uncompressed/easing/EasePack.js';