亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Documentation de développement de l'applet WeChat / 微信小程序API 繪圖beginPath(開始一個路徑)

微信小程序API 繪圖beginPath(開始一個路徑)

beginPath


定義

開始創(chuàng)建一個路徑,需要調(diào)用fill或者stroke才會使用路徑進行填充或描邊。

Tip: 在最開始的時候相當于調(diào)用了一次 beginPath()。

Tip: 同一個路徑內(nèi)的多次setFillStyle()、setStrokeStyle()setLineWidth()等設置,以最后一次設置為準。

例子

const ctx = wx.createCanvasContext('myCanvas')// begin pathctx.rect(10, 10, 100, 30)
ctx.setFillStyle('yellow')
ctx.fill()// begin another pathctx.beginPath()
ctx.rect(10, 40, 100, 30)// only fill this rect, not in current pathctx.setFillStyle('blue')
ctx.fillRect(10, 70, 100, 30)

ctx.rect(10, 100, 100, 30)// it will fill current pathctx.setFillStyle('red')
ctx.fill()
ctx.draw()

201612241606409703.png