1.画圆以及圆弧
<style>
canvas {
margin: 0 auto;
border: 2px solid #aaa;
display: block; /*画布居中*/
}
</style>
<body>
<canvas id="cont" width="500px" height="500px">Hello Canvas</canvas>
<script>
var canvas = document.querySelector("#cont");
//获取画布上下文
var ctx = canvas.getContext('2d');
//画圆
ctx.beginPath();
ctx.arc(250, 250, 150, 0, Math.PI*2, false);
ctx.fillStyle = 'gold';
ctx.fill();
ctx.lineWidth = 3;