Jump to content
GreenSock

bm1967

TweenMax and RequireJS 2014 update

Recommended Posts

Hi

 

I love GreenSock tools, they're a first class complement to HTML5.

 

I've just renewed my subscription and am in the process of understanding how TweenMax works with RequireJS. Through perseverance I've got TweenMax working, but I'm a bit unsure if my workflow is correct.

 

I've read various posts that seem to confuse my understanding, perhaps as they may be out of date.

 

It would be great if Greensock or community could post an up-to-date tutorial on how TweenMax and it's Plugins work with RequireJS and some clear examples.

 

What I find confusing is based on various areas (and the following questions are based from other posts on sites/forums perhaps now out of date). So with TweenMax v 1.11.6 and RequireJS v 2.1.11 (latest downloads at the time of writing):

  1. Do we still need a GreensockAMDPath?
  2. Why define window.GreenSockGlobals? (Is this best practice with RequireJS). My understanding of RequireJS is that we benefit from avoiding the global namespace.
  3. Are we still expected to use a 'shim' in the RequireJS config object to get TweenMax working?
  4. How are TweenMax plug-ins added with RequireJS.
  5. Is the latest TweenMax AMD?

I have a feeling that there could be quite a few others asking similar questions. If anyone in the GreenSock community can help then I (and am sure others) look forward to reading your posts.

 

Many thanks in advance for any help / examples...

 

:-)

Link to comment
Share on other sites

First of all, thanks for renewing your membership and being a part of the club. Great to have you on board.

 

As for RequireJS, I have never personally used it and when I looked into it a while back, it seemed to have some very significant limitations, like it could only define one class per file. Isn't that still the case? Defining one class per file isn't really an option for GreenSock stuff (long story, but trust me, you wouldn't want it that way). I sure hope RequireJS changes that limitation at some point. When I was trying it, I must admit it was a nightmare. Perhaps that has changed, but I haven't heard about anything significant changing in recent versions, though I'm admittedly not following it closely at all.

 

Unfortunately, we just don't have the time to research other 3rd party tools, learn their API and quirks, and provide support for them on an ongoing basis, especially because there are SOOO many 3rd party frameworks out there. If you have specific recommendations for things we could do to ensure compatibility with RequireJS, we'd be happy to consider those. And of course if you have a question that's specific to GSAP, we'd gladly help with that too. 

 

If your main purpose in using RequireJS is because you think accessing global variables is slow, there are better ways to address that concern like creating our own local variable once at the top of your code, pointing it to the class(es). But really, the speed difference is negligible in the vast majority of situations (in fact, I doubt you'd ever notice a difference in real-world apps). 

  • Like 1
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.
×