Easy Tutorial
❮ Att Td Scope Att A Href ❯

HTML canvas rotate() Method

HTML canvas Reference Manual

Example

Rotate a rectangle by 20 degrees:

JavaScript:


Browser Support

Internet Explorer 9, Firefox, Opera, Chrome, and Safari support the rotate() method.

Note: Internet Explorer 8 and earlier versions do not support the <canvas> element.


Definition and Usage

The rotate() method rotates the current drawing.

Note: Rotation only affects drawings made after the rotation is done.

| JavaScript Syntax: | context.rotate(angle); | | --- | --- |

Parameter Values

Parameter Description
angle The angle of rotation in radians. <br> <br>To convert degrees to radians, use the formula degreesMath.PI/180. <br>Example: To rotate by 5 degrees, use the formula: 5Math.PI/180.

❮ Att Td Scope Att A Href ❯