May 19, 2021 WeChat Mini Program Development Document
Drawing interfaces and methods
The origin is centered on the origin, which can be
modified using
the translate method. R
otate the current axis clockwise.
Rotate is
rotate
times and the angle of rotation is superimposed.
Parameters | Type | Description |
---|---|---|
rotate | Number | Rotating angle, in radian (degrees s math.PI/180; degrees range from 0 to 360) |
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()