利用html5标签画圆

<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
</head>
<body>
<canvas id='myCanvas' width='500px' height='300px' style='border:1px solid #CCC'>您的浏览器不支持canvas标签</canvas>
</body>
<script>
  //开始画图,通过javascript画出来
  //1得到画布:
  var canvas = document.getElementById('myCanvas');
  //得到画笔,获得二维的画布
  var ctx = canvas.getContext('2d');
  //开始画圆
  ctx.beginPath();
  ctx.fillStyle = 'red';
  //(圆心,半径,从三点为圆心,弧度)
  ctx.arc(50,50,20,0,Math.PI*2,true);
  ctx.closePath();
  ctx.fill();
</script>
</html>

你可能感兴趣的:(html5)