国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

微信小程序開(kāi)發(fā)文檔 / 使用arc()方法在微信小程序canvas中畫(huà)弧線

使用arc()方法在微信小程序canvas中畫(huà)弧線

arc


定義

畫(huà)一條弧線。

Tip: 創(chuàng)建一個(gè)圓可以用 arc() 方法指定其實(shí)弧度為0,終止弧度為 2 * Math.PI。

Tip: 用 stroke() 或者 fill() 方法來(lái)在 canvas 中畫(huà)弧線。

參數(shù)

QQ截圖20170208142325.png

例子

const ctx = wx.createCanvasContext('myCanvas')// Draw coordinatesctx.arc(100, 75, 50, 0, 2 * Math.PI)
ctx.setFillStyle('#EEEEEE')
ctx.fill()

ctx.beginPath()
ctx.moveTo(40, 75)
ctx.lineTo(160, 75)
ctx.moveTo(100, 15)
ctx.lineTo(100, 135)
ctx.setStrokeStyle('#AAAAAA')
ctx.stroke()

ctx.setFontSize(12)
ctx.setFillStyle('black')
ctx.fillText('0', 165, 78)
ctx.fillText('0.5*PI', 83, 145)
ctx.fillText('1*PI', 15, 78)
ctx.fillText('1.5*PI', 83, 10)// Draw pointsctx.beginPath()
ctx.arc(100, 75, 2, 0, 2 * Math.PI)
ctx.setFillStyle('lightgreen')
ctx.fill()

ctx.beginPath()
ctx.arc(100, 25, 2, 0, 2 * Math.PI)
ctx.setFillStyle('blue')
ctx.fill()

ctx.beginPath()
ctx.arc(150, 75, 2, 0, 2 * Math.PI)
ctx.setFillStyle('red')
ctx.fill()// Draw arcctx.beginPath()
ctx.arc(100, 75, 50, 0, 1.5 * Math.PI)
ctx.setStrokeStyle('#333333')
ctx.stroke()

ctx.draw()

201612241615535114.png

針對(duì) arc(100, 75, 50, 0, 1.5 * Math.PI)的三個(gè)關(guān)鍵坐標(biāo)如下:

  • 綠色: 圓心 (100, 75)
  • 紅色: 起始弧度 (0)
  • 藍(lán)色: 終止弧度 (1.5 * Math.PI)