I use processing.js
to draw some shapes on a canvas
.
If I draw more than 100-200 circles which are constantly moving on the canvas the FPS drops significantly. If I remove the drawing the FPS goes back to 60 so the other tasks do not affect the FPS.
fill(mR,mG,mB);
ellipse(mX,mY,mRadius,mRadius);
I know, for example, that for complex shapes you can draw them onto another canvas in memory to cache them and then simply draw that canvas onto the main one.
Is there any way to improve this drawing performance?
Some links that may help:
http://www.html5rocks.com/en/tutorials/canvas/performance/
http://ramkulkarni.com/blog/improving-animation-performance-in-html5-canvas-part-ii/
But I couldn't use any of these in my context, or to integrate them with Processing.js.
EDIT: Actually it looks like it can handle ~1000shapes before the fps start to drop. Tested on Google Chrome with GPU rendering enabled on an i5 processor and GTX660 gpu.
I guess that's already pretty good, but is there any way to squeeze some extra FPS?