May 19, 2021 WeChat Mini Program Development Document
Draw the previous descriptions (paths, deformations, styles) in the drawing context into canvas.
Tip:
The drawing context
wx.createCanvasContext(canvasId)
Parameters | Type | Description | The lowest version |
---|---|---|---|
reserve | Boolean | Not required. Whether this draw is followed by the last draw, i.e. the reserve parameter is false, the native layer should empty the canvas before drawing this call drew, and if the reserver parameter is true, the content on the current canvas is preserved, and the content drawn by this call drew on the drawing is overwritten on it, the default false | |
callback | Function | The callback is complete when the drawing is complete | 1.7.0 |
const ctx = wx.createCanvasContext('myCanvas')
ctx.setFillStyle('red')
ctx.fillRect(10, 10, 150, 100)
ctx.draw()
ctx.fillRect(50, 50, 150, 100)
ctx.draw()
const ctx = wx.createCanvasContext('myCanvas')
ctx.setFillStyle('red')
ctx.fillRect(10, 10, 150, 100)
ctx.draw()
ctx.fillRect(50, 50, 150, 100)
ctx.draw(true)