How to move image in JavaScript

Hey, I am trying to move an image I have drawn to a blank canvas using JavaScript. I’ve tried searching to web but I haven’t been able to find anything that will actually move my picture. I want to picture to move in a random rotation touching all sides of my canvas. 

The code I have to draw the image is below:

var img = new Image();

canvasContext.drawImage(img, canvas.width/2, canvas.height/2, imageWidth, imageHeight);

Google for “javascript canvas animation”. Here is one possibly useful link.

1 Like