November 2011
Intermediate to advanced
348 pages
7h 2m
English
In this recipe, we'll use what we've learned from the transform() method of the canvas context to create a custom shear transformation to skew the canvas context horizontally.

Follow these steps to draw a sheared rectangle:
window.onload = function(){
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");
var rectWidth = 150;
var rectHeight = 75;// shear matrix: // 1 sx 0 // sy 1 0 // 0 0 1 var sx = 0.75; // 0.75 horizontal shear ...
Read now
Unlock full access