摘要: 颜色合成 globalCompositeOperation 属性:?1234567891011//先绘制一个图形。ctx.fillStyle = "#00ff00";ctx.fillRect(10,10,50,50);//设置 lobalCompositeOperation 属性。ctx.globa... 阅读全文
posted @ 2015-04-02 09:44 dodo-yufan 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 文字对齐方式 :水平对齐?1234//是用 textAlign 属性设置水平对齐方式(默认坐标点)ctx.textAlign = "start";ctx.font = "30px Arial";ctx.fillText("Hello World",100,50);//水平的三个坐标点分别为 star... 阅读全文
posted @ 2015-04-02 09:43 dodo-yufan 阅读(266) 评论(0) 推荐(0) 编辑
摘要: 画直线:?1234567891011var c = document.getElementById("myCanvas"); //不要忘写documentvar ctx = c.getContext("2d");ctx.lineWidth = 10; ctx.strokeStyle = "red";... 阅读全文
posted @ 2015-04-02 09:38 dodo-yufan 阅读(290) 评论(0) 推荐(0) 编辑
摘要: addEventListener 用于注册事件处理程序,IE 中为 attachEvent,我们为什么讲 addEventListener 而不讲 attachEvent 呢?一来 attachEvent 比较简单,二来 addEventListener 才是 DOM 中的标准内容。简介addEve... 阅读全文
posted @ 2015-04-02 09:16 dodo-yufan 阅读(478) 评论(0) 推荐(0) 编辑