For example, drawing a black circle followed by a white circle of the same radius in the same location leaves behind a grey residue. I'm assuming it's not drawing the circles the same, per pixel, each time.
I wish to have a circle move around in a canvas but in order to do this I will need to overwrite the circle before drawing it in its new location.
HTML:
<canvas id="myCanvas" width="960" height="540" style="border:1px solid #000000;"></canvas>
Javascript:
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");
context.fillStyle = "white";
context.fillRect(0, 0, canvas.width, canvas.height);
context.beginPath();
context.arc(100, 100, 40, 0, 2 * Math.PI);
context.strokeStyle = "black";
context.stroke();
context.beginPath();
context.arc(100, 100, 40, 0, 2 * Math.PI);
context.strokeStyle = "white";
context.stroke();