canvas基础API

1.路径绘图:

  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
posted @ 2016-10-19 00:26  壹轮明月  阅读(164)  评论(0编辑  收藏  举报