摘要: 一、canvas是基于状态的绘图环境 1、canvas是基于状态的绘制 context.moveTo(100,100); context.lineTo(700,700); context.lineWidth=10; //直线的宽度状态设置 context.strokeStyle="#058"; // 阅读全文
posted @ 2018-03-27 23:04 starof 阅读(3905) 评论(0) 推荐(1) 编辑
摘要: 图形变换。 一、画一片星空 先画一片canvas.width宽canvas.height高的黑色星空,再画200个随机位置,随机大小,随机旋转角度的星星。 window.onload=function(){ var canvas=document.getElementById("canvas"); 阅读全文
posted @ 2018-03-27 21:39 starof 阅读(1280) 评论(0) 推荐(2) 编辑
摘要: 一、线条的帽子lineCap 取值:butt(默认值),round圆头,square方头 var canvas=document.getElementById("canvas"); canvas.width=800; canvas.height=800; var context=canvas.get 阅读全文
posted @ 2018-03-27 08:03 starof 阅读(2225) 评论(0) 推荐(2) 编辑