I want to make a circle line, but it makes a black box. What am I missing?
here is my jsfiddle: http://jsfiddle.net/j6y5f7xb/1/
My code is:
var x = 0;
var maxLoops = 800;
var counter = 0;
function loop(){
if (counter++ >= maxLoops) return;
var c = document.getElementById("canvas");
var ctx = c.getContext("2d");
ctx.clearRect(0, 0, 800, 500);
ctx.moveTo(400,250);
ctx.lineTo(x,100);
ctx.stroke();
x++;
setTimeout(function(){
console.log(counter);
loop();
}, 10);
}
loop();
source
share