好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

html5教程调用绘图api画简单的圆形代码分享


复制代码

代码如下:


<!DOCTY PE ht ML ><head>
< ;m eta charset=utf-8>
<t IT le>HTML5画 圆 形</title>
<script src="<a hr ef="http://ajax. GOOGLE apis .COM /ajax/libs/ jq uery/1.7.1/jquery.min.js"></script">http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script</a>>
</head>
<script>
$(document).ready(function(){
VAR c=document.getElementById("drawbox");
var draw=c.getContext("2d"); //获取2d内容的引用,调用绘图API</p> <p>draw.fillStyle=" red "; //颜色
draw.be gin Path(); //从新画
draw.arc(50,50,50,0,Math.PI*2,true); //圆心x坐标|圆心y坐标|直径|始|PI为 圆周率 ,Math.PI*2为画圆|true为时针 方向 :逆时针,0为顺时针,
draw.closePath(); //结束
draw.fill();
})
</script>
</body>
<canvas id="drawbox" width="500" h ei ght="500"></canvas>
</body>
</html>



效果图

总结

以上是 为你收集整理的 html5教程调用绘图api画简单的圆形代码分享 全部内容,希望文章能够帮你解决 html5教程调用绘图api画简单的圆形代码分享 所遇到的问题。

如果觉得 网站内容还不错, 推荐好友。

查看更多关于html5教程调用绘图api画简单的圆形代码分享的详细内容...

  阅读:20次