I am trying to make the ball smaller and smaller using HTML5 canvas. I was able to make it larger, so I decided that the opposite would be simple. What am I doing wrong here? Console.log shows that values ββfrom 11 to 0 decrease by 1. When x is less than 0, it stops. But the ball does not change shape, and I suspect, because it draws smaller pieces on top of each other, maybe? I thought clearRect would work for this?
function draw2() { console.log(x); context2D.clearRect(0, 0, canvas.width, canvas.height); context2D.arc(10, 10, x, 0, Math.PI * 2, true); context2D.fill(); x -= 1; if (x < 0) { clearInterval(s); } }
The demo is available at: http://www.chronicled.org/dev/test.html
Thanks!
source share