I was attempting to use GSAP with Node.js, but I encountered some difficulties i could not manage to solve on my own. I am using the GSAP supplied by NPM (https://www.npmjs.com/package/gsap). I have read the other questions asked on this forum and tried their suggestions (http://greensock.com/forums/topic/7422-using-tweenlite-timelinelite-server-side-with-nodejs/), however, GSAP still throws an error saying that "document" is not defined. Help would be much appreciated
I was able to get it working using what Sebastian wrote in this thread.
// Using the uncompressed file in node_modules/gsap/src/uncompressed/TweenMax.js
var window = {}
, navigator = { userAgent: "" }
, dummyElement = { style: {}, getElementsByTagName: function() { return [] } }
, document = { createElement: function() { return dummyElement } };
// START OF FILE
var _gsScope = (typeof(module)...
... this || window, "TweenMax");
// END OF FILE
module.exports = TweenMax;
Inside your