usingMaths.com
From Theory to Practice - Math You Can Use.







<< PreviousNext >>

Code to Animate a Body (Circle) Across the HTML Canvas using JavaScript



How to Draw on the HTML Canvas

We'll will draw a circle - our body - using the arc method of the canvas JavaScript context object.



Animating a Body

To make the circle appear to move across the HTML canvas, i.e., animate the circle. we'll simply draw the circle with JavaScript repeatedly, changing its position progressively as well as clearing the previous image.

Create a new file; On Notepad++: File, New.
Call it moving_body.html.
Type out the adjoining JavaScript code for animating an image body across the HTML canvas.










<< PreviousNext >>