canvas基礎API

1.路徑繪圖:api

  1. 把「鋼筆」移動到畫布的某個位置上
    1. ctx.moveTo(x,y)
  2. 把「鋼筆」連線到畫布的某個位置上
    1. ctx.lineTo(x,y)
  3. 描邊路徑的api
    1. ctx.stroke()
  4. 填充路徑的api
    1. ctx.fill()
  5. 描邊路徑的樣式
    1. ctx.strokeStyle = 'red' 描邊的顏色
    2. ctx.lineWidth = 5 線寬
  6. 填充的樣式
    1. ctx.fillStyle = 'blue' 填充的顏色
  7. 路徑的閉合
    1. ctx.closePath 把起點和終點連接到一塊兒
  8. 另起一個新的路徑
    1. ctx.beginPath
相關文章
相關標籤/搜索