Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
FlashDev2007

Animation on the Espruino

Go to solution Solved by OSUblake,

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

I have been using GSAP products for many years. Recently I started to play around with a JS interpreted board called the Espruino. As this little board doesn't have a native browser, it doesn't have access to a window object or a DOM.

I have a series of LED lights attached to this board and I can set any RGB colour value to any of the lights, I thought ah yes I could do some crazy animations using one of the GSAP libraries.

I tried to add the library to my code but unfortunately there were too many obstacles, firstly the linting on the device is rather strict and it complained about lots of missing semi-colons at the end of functions. So I thought yeah I could spend time adding these and get around this, but then TweenMax for example expects window to be passed in to the library.

So what I am asking is, are there any plans to have a version which doesn't incorporate any DOM related code and is purely a value driven animation library? I suspect in the future there will be many other devices that can run JS that don't have a window based DOM, but may benefit from interpolation and animation of values to drive the connected devices.

Link to comment
Share on other sites

Thanks for the reply, I had already looked at the post you mentioned prior to posting my own topic. I cannot use TweenMax because of the limited memory on the Espruino. I think I could get away with just TweenLite, but the way you described using TweenMax don't seem to apply to TweenLite.

Any ideas how to use TweenLite as a module?

Link to comment
Share on other sites

Yeah, you probably won't need TweenMax. Most of the file is plugins, which you could remove. But the TweenLite file should be the same. The file looks a little different, but it still doing the same checks for module.exports and a window.

Link to comment
Share on other sites

Thanks again, I see the check for module.exports but I am not sure how I can use this as a module with the Espruino.

I'm using TweenLite from https://github.com/greensock/GreenSock-JS/blob/master/src/uncompressed/TweenLite.js  I require the TweenLite module in the terminal using node here is what I get:

 

> var gsap = require('./gsap.js');

> gsap

[Function] version: '1.10.1', API: 2, activate: [Function] }


How do I access functions of TweenLite from this gsap var?

 

I cannot seem to get my Espruino to recognise the module, once I get it working in node I will post on the Espruino forums for help getting it working in their environment.

 

Thanks for your time here.

Link to comment
Share on other sites

  • Solution

That looks like the TweenPlugin, so you're close. Do you see in anything related to GreenSock on the global object, like GreenSockGlobals or com.greensock?

 

And did you try adding this to the end of the file? That should export TweenLite and be the value of gsap on your require.

module.exports = TweenLite;
  • Like 1
Link to comment
Share on other sites

Ah yes of course, this does indeed give me the TweenLite instance I needed. OK now on to the Espruino guys to sort out part 2.

 

Thank you for helping me OSUblake.

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.
×