If you first want to draw a canvas , then rotate it for use, for example. corners, you can do this when you "clone" the canvas or using CSS.
<strong> Examples
Get the first element of the canvas:
var canvas = document.getElementById("canvas"); var ctx = canvas.getContext("2d");
draw it:
ctx.fillStyle = 'blue'; ctx.fillRect(0,0, 25, 5); ctx.fill(); ctx.fillStyle = 'red'; ctx.fillRect(25, 0, 25, 5); ctx.fill();
clone it to another canvas (which rotates using CSS):
var ctx2 = document.getElementById("canvas2").getContext("2d"); ctx2.drawImage(canvas, 0,0);
or rotate the canvas while you βcloneβ it:
var ctx3 = document.getElementById("canvas3").getContext("2d"); ctx3.rotate(Math.PI/2); ctx3.translate(0,-50); ctx3.drawImage(canvas, 0,0);
here is the CSS for its rotation:
#canvas2 { -webkit-transform:rotate(90deg); -moz-transform:rotate(90deg); -o-transform:rotate(90deg); -ms-transform:rotate(90deg); }

Here is a complete example:
<!DOCTYPE html> <html> <head> <script> window.onload = function() { var canvas = document.getElementById("canvas"); var ctx = canvas.getContext("2d"); ctx.fillStyle = 'blue'; ctx.fillRect(0,0, 25, 5); ctx.fill(); ctx.fillStyle = 'red'; ctx.fillRect(25, 0, 25, 5); ctx.fill(); var ctx2 = document.getElementById("canvas2").getContext("2d"); ctx2.drawImage(canvas, 0,0); var ctx3 = document.getElementById("canvas3").getContext("2d"); ctx3.rotate(Math.PI/2); ctx3.translate(0,-50); ctx3.drawImage(canvas, 0,0); } </script> <style> #canvas2 { -webkit-transform:rotate(90deg); -moz-transform:rotate(90deg); -o-transform:rotate(90deg); -ms-transform:rotate(90deg); } </style> </head> <body> <canvas id="canvas" width="50" height="50"></canvas> <canvas id="canvas2" width="50" height="50"></canvas> <canvas id="canvas3" width="50" height="50"></canvas> </body> </html>