码迷,mamicode.com
首页 > Windows程序 > 详细

canvas基础API

时间:2016-10-19 03:05:12      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:

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

canvas基础API

标签:

原文地址:http://www.cnblogs.com/peachGirl/p/5975705.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!