Jump to content


Use TweenLite/Max without a browser?

Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts



Strange question maybe...but I'm wondering if it's possible to use GSAP without a browser. I know it's geared towards animating CSS properties etc. But I'm developing an application, written in JavaScript, which runs without the need for a browser.


I've written my own animation library so far (which does the job) but it would be nice to be able to leverage all the cool features Jack has implemented. So my question is...is it possible or should I forget GSAP and continue to write my own.



Link to comment
Share on other sites

Sure, that should be entirely possible although I must admit I've never personally tried it. I believe several other people have done this successfully - the key is to simply declare a "window" object just so that it doesn't throw an error when TweenLite references "window" (it only does so a few times). Like

var window = this; //or perhaps {}

Obviously CSSPlugin wouldn't work very well outside of a browser, but I doubt you'd even try using that.


The animation platform itself was built so that it is extremely flexible and can animate any numeric property of any JavaScript object (even generics and even function-based getters/setters), so I bet you'd find it to be a very nice fit for what you're doing, especially because the timeline classes can be a very powerful way to modularize your animation workflow. 


Also note that we're looking into the possibility of reworking things in a Browserify manner to make it even easier to do exactly what you're talking about (no promises yet - we're researching it now but our goal is to make it more module-friendly). 

  • Like 3
Link to comment
Share on other sites

Ah ok,


I did give that a try in TweenLite.js but I got an error saying 'to' method didn't exist - looked like the Object returned when calling TweenLite only has a few static properties and 'activate' method.


I'll play around with it and see if I can get it working.




Link to comment
Share on other sites

  • 2 years later...

Hi. I'm afraid I'm in the same boat as lewispeel.

Trying to use gsap via npm for the first time today in a non-browser JavaScript environment (specifically NativeScript) and I keep getting browser related errors such as "document is undefined". OK, so I tried adding "var document = document || {}". Now I get "_doc.createElement is not a function". I'm starting to get the feeling that I'm going down a rabbit hole here. 

Is there a way to use gsap without a browser and if there is, then how can I do it?


Thank you,


Link to comment
Share on other sites

I know that several people have done exactly that, but unfortunately I have zero experience with it and we really designed GSAP to be used in a browser so I'm afraid I can't be of much use here. OSUblake may have some insight.

Link to comment
Share on other sites

Thanks OSUblake . I will give that a try. GSAP looks like a really promising library, but I found it with a promise (can't find the reference now, of course) that it doesn't depend on the browser so I really was looking forward to using it without hacks, as I'm creating courseware, and don't want to include hacks for my students.

I will definitely come back to this library for my web dev work.



Link to comment
Share on other sites

  • 1 year later...

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.