WeChat applet API drawing rotates the coordinate axis clockwise


rotate


Definition

Centered on the origin, which can be modified using the translate method. Rotate the current coordinate axis clockwise. If rotate is called multiple times, the rotation angles will be superimposed.

Parameters

QQ截图20170208145346.png

const ctx = wx.createCanvasContext('myCanvas')

ctx.strokeRect(100, 10, 150, 100)
ctx.rotate(20 * Math.PI / 180)
ctx.strokeRect(100, 10, 150, 100)
ctx.rotate(20 * Math.PI / 180)
ctx.strokeRect(100, 10, 150, 100)

ctx.draw()

201612261754012187.png