Adam Storr
Adam Storr

Reputation: 1450

HTML5 Move Image Along Path

I'm trying to move a png or gif along a predetermined path inside a <canvas> element. Can anyone provide a few resources or code samples to get me started?

Thanks in advance!

Upvotes: 2

Views: 9924

Answers (1)

James Black
James Black

Reputation: 41858

You may want to look at this link: https://developer.mozilla.org/En/Canvas_tutorial:Basic_animations for more information, but basically your best bet is to erase the canvas, then redraw everything having moved the image, which you drew with 'drawImage'.

The x,y coordinates will change based on your path.

Upvotes: 2

Related Questions