Most recent activity

It would be help full to explain what you want to achieve from a birds point of view.

So when I first got the original Espruino I created animations for my LED lights using setInterval functions.

The code quickly became verbose as I added more patterns. I experimented back then trying to use gsap but there wasn't enough memory.

When I decided to look again and was amazed that the Espruino WiFi version was out with more memory I thought my idea could work out.

Gsap is designed for the browser as it transitions elements in the DOM but can also transition values on objects you create yourself, therefore you're not restricted to just DOM objects or the window object in the browser.

I've since looked at smaller libraries that could work as I want to interpolate between values to use on these lights, the power of a tween library is that it has various helper functions like repeat, reverse and yo-yo to aid with creativity.

Ah so originally when I wanted to use the 'gsap' module, I thought I'd install it in the modules folder that was created by the sandbox project thingy. To do this all you need to do (as long as you have nodejs installed of course) is:

npm install gsap

This creates the 'node_modules' folder with another folder called gsap inside, inside this is all the files associated with the gsap module.

Then in node at least, you just require it and off you go...

What I hadn't realised (but do now after reading the forums) is that there was a beta NPM setup but that was dropped, possibly unrelated to my issue anyway (I'm digressing here) but I thought maybe the Espruino expected local modules to reside in a 'node_modules' folder, but it doesn't.

Didn't use node_modules anywhere. It works fine regardless of where my sandbox folder is in the two cases mentioned previously.

I think you're right about not being able to use this on Espruino though as I can't seem to call any functions on it.

I was hoping to use it with the WS2811 lights, I used to do all my anims manually with setInterval but I've extensive knowledge of this library from doing frontend dev over the years and had an idea to Tween values using this as it's so powerful, maybe it will work out or maybe it won't...

PS. It can be used on nodejs so maybe there's a way to get it to play with Espruino.

OK so this is now working, thank you for pointing me in the right direction with the question if I had written this module myself!!!

I created a quick module to check and that was indeed loaded correctly, which made me think ahhhh I need to rename the downloaded module so that the filename matches what the Espruino is looking for, this isn't necessary using node_modules as it uses the folder name as the mapping I believe.

So it is now loading the module as expected.. Sorry for the confusion and thanks for the support.

I have tried a few ways to put a module in my local project. In the web ide I have set a folder for a project, this created a bunch of folders, one of them modules - I have tried to NPM install a module gsap there but I cannot require this with:

var gsap = require('gsap');

I thought maybe it doesn't need to be in node_modules folder so I took out the gsap folder and only that is in modules, still can't find it.

I copied the min.js file to modules folder, still cannot require it there.

Both of these examples work if I use the cmd to run node and the require('gsap'). What is the correct way to require a module from modules folder in a project?