I did my first canvas, and you can see it here My Canvas. The main idea of this canvas is that when you go with the cursor against the points they escape from it. What I want now is to know how much my canvas will use the resources of the user's PC. For example, the RAM, the CPU or GPU. In particular, in my script there is a function called every 7ms:
setInterval (spiderFree, 7);
I wonder how this can be expensive for a computer. However the question is, how can I control the expenditure of computer resources due to my script?
You should take a look at this article from Paul Irish on his requestAnimationFrame cross-browser shim.
It will firstly try to optimise frames based on browser capability, and also, have backwards compatibility for old, non-GPU enabled browsers.
From the jQuery ticket:
Benefits:
let the browser choose the best 'animation tick' rate (instead of our arbitrary 13ms)
greatly reduce animation CPU usage when switching tab
helps keep animation synchronized
This is the 'industry standard' way of ensuring the best possible frame rate and resource utilisation of your animations.