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

WeChat applet development documentation / 微信小程序API 繪圖beginPath(開始一個(gè)路徑)

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

beginPath


定義

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

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

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

例子

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