Canvas arc () vs drawImage ()

It may seem harmless, but by doing it 1000+ times at 30 frames per second, it adds up. I have 3 sizes of circles that I draw, each with its own fill color (RGBA). Is it faster to draw them as images once and use drawImage()with data urls or do arc()for each of them?

Additional Information:

  • Use one canvas for all circles
  • Context and canvas are cached
  • The full challenge for the arc currently looks like

    this.scene.context.arc (newLocation, this.y + = this.speed / 80, this.distance / 2, 0, Math.PI * 2, false);

+5
source share
1 answer

enter image description here

, drawImage() , arc().

drawImage() <img>, <canvas> , Firefox <img> , .

: drawImage()

+6

All Articles