html5 画图canvans

来源:互联网 发布:政府数据平台建设方案 编辑:程序博客网 时间:2024/05/24 05:05
context.fill()//填充  


 context.stroke()//绘制边框   


style:在进行图形绘制前,要设置好绘图的样式


style.strokeStyle(); 边框样式


style.fillStyle();    填充样式


context.lineWidth//图形边框宽度


绘制矩形  context.fillRect(x,y,width,height) 填充 绘制 
 
              strokeRect(x,y,width,height) 边框绘制




绘制时,首先需要 var context =  canvas.getContext("2d");  得到上下文,传入2d;




清除矩形区域 context.clearRect(x,y,width,height)  xy 为横纵坐标 wight 为矩形宽  height 为矩形高




清除矩形会让矩形区域变成背景色;



0 0