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

Call the scale method in the WeChat applet to scale the horizontal coordinates


May 19, 2021 WeChat Mini Program Development Document


Table of contents


Call the scale method in the WeChat applet to scale the horizontal coordinates Drawing interfaces and methods

canvasContext.scale


Defined

After the scale is called, the horizontal coordinates of the path that is then created are scaled. Scale is scale times, and the multiples are multiplied.

Parameters

Parameters Type Description
scaleWidth Number Multiply of horizontal coordinate scaling (1 x 100%, 0.5 x 50%, 2 x 200%)
scaleHeight Number Multiply the scale of the ordinate axis (1 s 100%, 0.5 s 50%, 2 s 200%)

Example

const ctx = wx.createCanvasContext('myCanvas')

ctx.strokeRect(10, 10, 25, 15)
ctx.scale(2, 2)
ctx.strokeRect(10, 10, 25, 15)
ctx.scale(2, 2)
ctx.strokeRect(10, 10, 25, 15)

ctx.draw()

Call the scale method in the WeChat applet to scale the horizontal coordinates

Call the scale method in the WeChat applet to scale the horizontal coordinates Drawing interfaces and methods