Met Canvas Rotate
# HTML canvas rotate() Method
[ Canvas Object](#)
## Example
Rotate a rectangle by 20 degrees:
YourbrowserdoesnotsupporttheHTML5canvastag.
JavaScript:
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.rotate(20*Math.PI/180);
ctx.fillRect(50,20,100,50);
[Try it Β»](#)
* * *
## Browser Support

The rotate() method is supported in Internet Explorer 9, Firefox, Opera, Chrome, and Safari.
**Note:** Internet Explorer 8 and earlier versions do not support the element.
* * *
## Definition and Usage
The rotate() method rotates the current drawing.
**Note:** The rotation will only affect drawings made after the rotation is applied.
| JavaScript Syntax: | _context_.rotate(_angle_); |
| --- |
## Parameter Values
| Parameter | Description |
| --- | --- |
| _angle_ | The rotation angle, in radians. To convert degrees to radians, use the formula _degrees_*Math.PI/180. Example: To rotate 5 degrees, specify the following formula: 5*Math.PI/180. |
* * Canvas Object](#)
YouTip