# CanvasContext.beginPath()
with Promise style call: Not supported
Mini Program plugin: Support
Start creating a path. Need to call fill
or stroke
Will use the path to fill or stroke
- At the very beginning, it's a call to
beginPath
。 - Multiple times in the same path.
setFillStyle
、setStrokeStyle
、setLineWidth
The last setting shall prevail.
# sample code
const ctx = wx.createCanvasContext('myCanvas')
// begin path
ctx.rect(10, 10, 100, 30)
ctx.setFillStyle('yellow')
ctx.fill()
// begin another path
ctx.beginPath()
ctx.rect(10, 40, 100, 30)
// only fill this rect, not in current path
ctx.setFillStyle('blue')
ctx.fillRect(10, 70, 100, 30)
ctx.rect(10, 100, 100, 30)
// it will fill current path
ctx.setFillStyle('red')
ctx.fill()
ctx.draw()