CanvasContext.rotate

Set the original point as the center, rotate the coordinate clockwise. The angle will be added if rotate isinvoked multiple times.

Parameters

It is Object type.

PropertyTypeDescription
rotateNumberThe rotate angle, use radiant(degrees * Math.PI/180, degree in 0-360).

Sample Code

copy
//.js
const ctx = my.createCanvasContext('awesomeCanvas')

ctx.strokeRect(200, 20, 180, 150)
ctx.rotate(30 * Math.PI / 180)
ctx.strokeRect(200, 20, 180, 150)
ctx.rotate(30 * Math.PI / 180)
ctx.strokeRect(200, 20, 180, 150)

ctx.draw()