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

WeChat applet development documentation / 在微信小程序繪圖API中創(chuàng)建二次方貝塞爾曲線

在微信小程序繪圖API中創(chuàng)建二次方貝塞爾曲線

quadraticCurveTo


定義

創(chuàng)建二次貝塞爾曲線路徑。

Tip: 曲線的起始點為路徑中前一個點。

參數(shù)

QQ截圖20170208143203.png

例子

const ctx = wx.createCanvasContext('myCanvas')// Draw pointsctx.beginPath()
ctx.arc(20, 20, 2, 0, 2 * Math.PI)
ctx.setFillStyle('red')
ctx.fill()

ctx.beginPath()
ctx.arc(200, 20, 2, 0, 2 * Math.PI)
ctx.setFillStyle('lightgreen')
ctx.fill()

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

ctx.setFillStyle('black')
ctx.setFontSize(12)// Draw guidesctx.beginPath()
ctx.moveTo(20, 20)
ctx.lineTo(20, 100)
ctx.lineTo(200, 20)
ctx.setStrokeStyle('#AAAAAA')
ctx.stroke()// Draw quadratic curvectx.beginPath()
ctx.moveTo(20, 20)
ctx.quadraticCurveTo(20, 100, 200, 20)
ctx.setStrokeStyle('black')
ctx.stroke()

ctx.draw()

QQ截圖20170208143223.png

針對 moveTo(20, 20) quadraticCurveTo(20, 100, 200, 20) 的三個關(guān)鍵坐標(biāo)如下:

  • 紅色:起始點(20, 20)
  • 藍(lán)色:控制點(20, 100)
  • 綠色:終止點(200, 20)