Monday 12 June 2017

Safer/Less intense way doing it?

As I'm trying to paint some line on a canvas and show number(s) to people I am using such code for it.

timer = setInterval(function(){
        x += 0.1;
        io.sockets.emit('message', {
            type: 'graph',
            x: x
        });
}, 100);

I also have an if variable there if that X goes over example 5 then it will stop it and same thing will start again in 5 seconds. Is there a better way of doing such thing?



via Jordn

No comments:

Post a Comment