November 2011
Intermediate to advanced
348 pages
7h 2m
English
In this recipe, we'll rotate an image by translating and rotating the canvas context, and then drawing an image on the transformed context.

Follow these steps to rotate an image:
window.onload = function(){
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");image object and set its onload property: var imageObj = new Image();
imageObj.onload = function(){// translate context to center of canvas ...
Read now
Unlock full access