HTML5 Canvans 常用API整理
2015-08-12 15:29
555 查看
所有API调用都是基于自定义的对象 var context = document.getElementById("myCanvas").getContext("2d");中
W3C标准:http://www.w3.org/TR/2012/WD-2dcontext-20120329/
中文介绍(部分):http://www.w3school.com.cn/htmldom/dom_obj_canvasrenderingcontext2d.asp
讲画布内容导出为图像
document.getElementById("myCanvas").toDataURL()
属性
lineWidth 影响stroke方法绘制出轮廓的宽度,例:
context.lineWidth =4;
strokeStyle 影响stroke方法绘制出轮廓的颜色,例:
context.strokeStyle="#00FF00";
context.strokeStyle="red";
fillStyle 影响fill方法绘制出图形的填充色,例:
context.fillStyle="#00FF00";
context.fillStyle="red";
W3C标准:http://www.w3.org/TR/2012/WD-2dcontext-20120329/
中文介绍(部分):http://www.w3school.com.cn/htmldom/dom_obj_canvasrenderingcontext2d.asp
讲画布内容导出为图像
document.getElementById("myCanvas").toDataURL()
属性
lineWidth 影响stroke方法绘制出轮廓的宽度,例:
context.lineWidth =4;
strokeStyle 影响stroke方法绘制出轮廓的颜色,例:
context.strokeStyle="#00FF00";
context.strokeStyle="red";
fillStyle 影响fill方法绘制出图形的填充色,例:
context.fillStyle="#00FF00";
context.fillStyle="red";
相关文章推荐
- html5canvans时钟
- 谈谈我对HTML5+CSS3的理解
- html5验证+点击button刷新页面+uncaught exception: out of memory
- HTML5中div,section,article的区别总结
- 玩转HTML5移动页面(动效篇)(转载)
- 基于CSS3和HTML5图片加工前后对比代码
- HTML5--有感
- HTMl5中sessionStorage和localStorage的区别
- HTML5 异步上传文件
- HTML5入门-2
- Html5(6)画图
- Html5(5)视频、音频 及 拖放
- 6最好的之一 HTML5/CSS3 演示(PPT)框架
- 【坑】html5中使用context.lineWidth设置线的宽度是1,然而输出的宽度是2的原因
- HTML5本地存储Localstorage
- HTML5——Data Url生成
- HTML5的Canvas实现小圆点在屏幕内跑动
- HTML5 Boilerplate - 让页面有个好的开始
- 移除HTML5 input在type="number"时的上下小箭头
- 利用html5的FormData对象和ajax实现异步文件上传