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
相关文章
相关标签/搜索