Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

The WeChat program API drawing rotates the axes clockwise


May 19, 2021 WeChat Mini Program Development Document


Table of contents


The WeChat program API drawing rotates the axes clockwise Drawing interfaces and methods

canvasContext.rotate


Defined

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

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()

The WeChat program API drawing rotates the axes clockwise

The WeChat program API drawing rotates the axes clockwise Drawing interfaces and methods