问题 I am trying to draw a line in a canvas. I am trying to make the line moving with time. I am using the following code to do so var ctx = mycanvas.getContext('2d'); ctx.beginPath(); for (var x = 0; x < 200; x++) { setInterval(draw(x, 0, ctx), 3000); x = x++; } And here is the draw function function draw(x, y, ctx) { ctx.moveTo(10 + x, 400); ctx.lineTo(11 + x, 400); ctx.lineWidth = 10; ctx.strokeStyle = "#ff0000"; ctx.stroke(); } But the setInterval() function is not working and the line is