Skewing images individually using canvas
问题 I'm using an HTML5 canvas to create a series of trees and their corresponding shadows. I want each shadow to be based on the position of a light source. I can draw each tree and it's shadow as well as skew all the shadows at once, but trying to skew each shadow individually eludes me. Here's my code: var ctx = cvs[0].getContext('2d'); ctx.save(); //skew the canvas ctx.transform(1,0,0.3,-1,0,0); ctx.drawImage(tree1,74,-117,20,40); ctx.drawImage(tree1,126,-125,20,40); var imgd = ctx