Jump to content
Search Community

GSAP and NodeJs

kazoompa test
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

Hi,

 

I am planning to use NodeJS and GSAP for a small simulator project. Is there a sample code that can help me setup my project in NodeJS? The reason I am asking is that I came across several threads with people having issues using GSAP and NodeJs. Some of the solutions were for older versions and some had concerns about global scopes (see below for the threads I came across). A little sample code would be greatly appreciated, I used GSAP with my Flash applications, glad to be back with JS :)

 

Many thanks.

 

 

 

 

Link to comment
Share on other sites

Hi @10517_1494126560

 

Are you going to be using GSAP strictly in a node environment? Those posts are kind of old. I think all the issues with loading GSAP inside node have been fixed. They were related to loading TweenMax, which includes the CSSPlugin, and was expecting some objects to be there like document.

 

I just made a quick demo, and everything seems to working fine. Here's a screenshot.

 

ccpSNJn.jpg

 

 

  • Like 3
Link to comment
Share on other sites

Hi Blake,

 

Thanks a lot for your quick response, much appreciated.

 

My project is purely in NodeJS and the goal is to use TimelineMax and either of the Tween classes so I can setup a mini-simulation engine as long as the server runs.

 

I will give it a go and if you have any specific advice regarding TimelineMax in a NodeJS environment, I'll be grateful. 

 

Best,

  • Like 1
Link to comment
Share on other sites

58 minutes ago, kazoompa said:

My project is purely in NodeJS and the goal is to use TimelineMax and either of the Tween classes so I can setup a mini-simulation engine as long as the server runs.

 

Sounds interesting! If you import TweenMax like I did above, all the stuff that is part of the TweenMax.js file should be global, like TweenLite, TweenMax, TimelineLite, TimelineMax, etc.

 

1 hour ago, kazoompa said:

I will give it a go and if you have any specific advice regarding TimelineMax in a NodeJS environment, I'll be grateful. 

 

I really don't have any specific advice at the moment as I haven't spent a lot of time using GSAP inside Node, but if you come across anything that might be helpful, please report back.

 

The only thing that is slightly different when running inside Node is that there is no requestAnimationFrame, so GSAP will fallback to using setTimeout. That shouldn't cause any problems, but the update interval won't be as consistent as it is when using GSAP inside a browser.

 

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