赞
踩
话不多说,直接上代码
<!doctype html> <html> <head> <meta charset="UTF-8"> </head> <style type="text/css"> canvas{border:dashed 2px #CCC} </style> <script type="text/javascript"> function $$(id){ return document.getElementById(id); } function pageLoad(){ var can = $$('can'); var cans = can.getContext('2d'); cans.beginPath();//按照下边参数开始绘制新路径 cans.arc(200,150,100,0,Math.PI*2,true);//(圆心X坐标,圆心Y坐标,半径,开始角度(弧度),结束角度弧度,是否按照顺时针画) cans.closePath();//关闭路径 cans.fillStyle = 'green';//设置填充颜色 cans.fill();//开始填充 } </script> <body onload="pageLoad();"> <canvas id="can" width="400px" height="300px">4</canvas> </body> </html>
效果图:
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。