I am making an HTML5 canvas game, and I wish to rotate one of the images.
var link = new Image(); link.src=\'img/link.png\'; link.onload=function(){ ctx.
Use .save() and .restore() (more information):
.save()
.restore()
link.onload=function(){ ctx.save(); // save current state ctx.rotate(Math.PI); // rotate ctx.drawImage(link,x,y,20,20); // draws a chain link or dagger ctx.restore(); // restore original states (no rotation etc) }