HTML5 canvas image rotate left rotate right
问题 I have drawn an image into canvas. Now what i am trying is if user click on roate left button total canvas should rotate left (i.e., Image rotate to 90 degress) and if rotate right canvas should rotate right. this is what i tried for rotation. Please suggest me the code to achieve this var canvasId = document.getElementById("preview"); var cntxt = canvasId.getContext("2d"); cntxt.translate($("#preview").width()-1, $("#preview").height()-1); cntxt.rotate(convertToRadians(90)); cntxt.drawImage