<!DOCTYPE html><head>
<meta charset=utf-8>
<title>HTML5画圆形</title>
<script src=\"<a href=\"http://ajax.googleapis.com/ajax/libs/jquery/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.beginPath(); //从新画
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\" height=\"500\"></canvas>
</body>
</html>
效果图
本文地址:https://www.stayed.cn/item/5612
转载请注明出处。
本站部分内容来源于网络,如侵犯到您的权益,请 联系我