WeChat applet API draws rect to create a rectangle


rect


Definition

Creates a rectangle.

Tip: Use the fill() or stroke() method to actually draw the rectangle into the canvas.

Parameters

QQ截图20170208140502.png

Example

const ctx = wx.createCanvasContext('myCanvas')
ctx.rect(10, 10, 150, 75)
ctx.setFillStyle('red')
ctx.fill()
ctx.draw()

201612241545257647.png