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


scale


Definition

After calling the scale method, the horizontal and vertical coordinates of the path created afterwards will be scaled. Call scale multiple times and the multiples will be multiplied.

Parameters

QQ截图20170208145233.png

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

201612241806425160.png