May 19, 2021 WeChat Mini Program Development Document
Transforms the origin (0, 0) of the current coordinate system, with the default coordinate system origin in the upper-left corner of the page.
Parameters | Type | Description |
---|---|---|
Ⅹ | Number | The horizontal coordinate translation |
Y | Number | The amount of vertical coordinate translation |
const ctx = wx.createCanvasContext('myCanvas')
ctx.strokeRect(10, 10, 150, 100)
ctx.translate(20, 20)
ctx.strokeRect(10, 10, 150, 100)
ctx.translate(20, 20)
ctx.strokeRect(10, 10, 150, 100)
ctx.draw()