Canvas Rotate Method in HTML5

Canvas Rotate Method in HTML5 

 
Canvas Rotate Method is used to rotate the Canvas. It takes a parameter radians. We can set the degree of rotation by using the formula: 
 
For 10 degree:
 
10 * PI/180
  1. <html><body><canvas id="myfirstcan" width="200" height="100" style="border:2px solid #FF00FF;">  
  2.  CANVAS</canvas><script type="text/javascript" 
  3. var canv=document.getElementById("myfirstcan");  
  4. var x=canv.getContext("2d");  
  5. x.rotate(10*Math.PI/180);  
  6. x.fillRect(20,30,100,20);  
  7. </script></body></html>  
 
1234565.png
Next Recommended Reading CANVAS in HTML5 (Best Drawing Surface)