How to update the canvas?

4

On a canvas, I added 10 small squares, but I want to be able to change the position of these squares continuously, and that this change is drawn on the screen whenever I do (I do not necessarily need an animation, just understand how I can update the canvas any time you want). How can I do this?

    
asked by anonymous 17.04.2015 / 00:36

2 answers

0

Use context.clearRect to clear canvas or just the square. And then redesign.

    
17.04.2015 / 01:28
0

To delete you use context.clearRect(width,height); , to draw you use context.drawImage(imagem,x,y); .

    
17.04.2015 / 16:20