canvas基礎API
1.路徑繪圖:api
- 把「鋼筆」移動到畫布的某個位置上
- ctx.moveTo(x,y)
- 把「鋼筆」連線到畫布的某個位置上
- ctx.lineTo(x,y)
- 描邊路徑的api
- ctx.stroke()
- 填充路徑的api
- ctx.fill()
- 描邊路徑的樣式
- ctx.strokeStyle = 'red' 描邊的顏色
- ctx.lineWidth = 5 線寬
- 填充的樣式
- ctx.fillStyle = 'blue' 填充的顏色
- 路徑的閉合
- ctx.closePath 把起點和終點連接到一塊兒
- 另起一個新的路徑
- ctx.beginPath
歡迎關注本站公眾號,獲取更多信息