<!doctype html>
<html>
<canvas width=300px height=300px id="mycanvas" style="border:3px solid #ff00ff"></canvas>
<script>
var mycanvas = document.getElementById("mycanvas");
var context = mycanvas.getContext("2d");
context.fillStyle = "#ff0";
context.fillRect(0,0,150,150);
context.fillStyle = "#0f0";
context.fillRect(150,0,150,150);
context.fillStyle = "blue";
context.fillRect(0,150,150,150);
context.fillStyle = "red";
context.fillRect(150,150,150,150);
//context.beginPath();
//context.strokeStyle = "#fff";
context.fillStyle = "#fff";
context.globalAlpha = 0.2;
for(var i=0;i<15;i++)
{
context.beginPath();
context.arc(150,150,10+10*i,0,2*Math.PI,true);
//context.stroke();
context.fill();
}
//context.stroke();
</script>
</html>
效果图如下