<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
canvas{
background: #fff;
}
</style>
</head>
<body>
<canvas id="canvas" width="400" height="400"></canvas>
<script>
var oCanvas = document.getElementById("canvas")
var oC = oCanvas.getContext("2d")
oC.beginPath() //开始绘制路径
oC.moveTo(100,100) //将当前位置移动到新的目标点
oC.arc(100,100,50,-90*Math.PI/180,45*Math.PI/180)
oC.closePath() //绘制路径
oC.stroke() //设置边框
oC.fillStyle = "red" //填充背景颜色
oC.fill()
oC.beginPath()
oC.moveTo(100,100)
oC.arc(100,100,50,45*Math.PI/180,160*Math.PI/180)
oC.closePath()
oC.stroke()
oC.fillStyle = "green"
oC.fill()
oC.beginPath()
oC.moveTo(100,100)
oC.arc(100,100,50,160*Math.PI/180,-90*Math.PI/180)
oC.closePath()
oC.stroke()
oC.fillStyle = "blue"
oC.fill()
</script>
</body>
</html>