永发信息网

HTML5 canvas 怎么画半圆

答案:1  悬赏:0  手机版
解决时间 2021-03-17 15:26
  • 提问者网友:你给我的爱
  • 2021-03-17 06:40
HTML5 canvas 怎么画半圆
最佳答案
  • 五星知识达人网友:拜訪者
  • 2021-03-17 08:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Canvas</title>
</head>
<style type="text/css">
body{margin:20px auto; padding:0; width:800px; }
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(400,300,200,0,Math.PI,1);
cans.closePath();
cans.strokeStyle = 'red';
cans.lineWidth = 10;
cans.stroke();
}
</script>
<body onload="pageLoad();">
<canvas id="can" width="800px" height="600px"></canvas>
</body>
</html>
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯