對了,要看到完整的麥田圈需要直接點入這篇文章才可
<script type="text/javascript">
<!--
function drawPie(context,centerX,centerY,radius,startingAngle,
endingAngle, antiClockwise,fillStyle,globalCompositeOperation)
{
context.globalCompositeOperation = globalCompositeOperation;
context.beginPath();
context.arc(centerX,centerY,radius,startingAngle, endingAngle,antiClockwise);
context.lineTo(centerX, centerY);
context.closePath();
context.lineWidth=1;
context.fillStyle=fillStyle;
context.fill();
}
function drawBlackPie(context,centerX,centerY,radius,startingAngle,
endingAngle, antiClockwise,fillStyle,globalCompositeOperation)
{
drawPie(context,centerX,centerY,radius,startingAngle,
endingAngle, antiClockwise,fillStyle,globalCompositeOperation);
drawPie(context,centerX,centerY,radius,startingAngle,
endingAngle, antiClockwise,fillStyle,globalCompositeOperation);
drawPie(context,centerX,centerY,radius*0.95,startingAngle,
endingAngle, antiClockwise,fillStyle,globalCompositeOperation);
}
function drawWhitePie(context,centerX,centerY,radius,startingAngle,
endingAngle, antiClockwise,fillStyle,globalCompositeOperation)
{
drawPie(context,centerX,centerY,radius,startingAngle,
endingAngle, antiClockwise,fillStyle,globalCompositeOperation);
drawPie(context,centerX,centerY,radius*0.95,startingAngle,
endingAngle, antiClockwise,fillStyle,globalCompositeOperation);
}
var canvas=document.getElementById("myCropCircle0420");
var context=canvas.getContext("2d");
var centerX = 150;
var centerY = 150;
var radius = 150;
//var lineWidth = 1;
context.beginPath();
context.arc(centerX,centerY,radius,0, 2*Math.PI,false);
context.fillStyle="white";
context.fill();
context.lineWidth=2;
context.strokeStyle="black";
context.stroke();
var i=0;
while (i<18)
{
drawBlackPie(context,centerX,centerY,radius,Math.PI*(1.5+i/9),Math.PI*(1.5+(++i)/9),false,'black','xor');
drawWhitePie(context,centerX,centerY,radius,Math.PI*(1.5+i/9), Math.PI*(1.5+(++i)/9),false,'black','xor');
}
var dbb=setTimeout("drawPie(context,centerX,centerY*3/8,radius/3.2,0, Math.PI*2,false,'black','xor')",1000);
var dbb=setTimeout("drawPie(context,centerX,centerY*4/3,radius/1.7,0, Math.PI*2,false,'black','xor')",1500);
var llb=setTimeout("drawPie(context,centerX*3/7,centerY*2/3,radius/8,0, Math.PI*2,false,'black','xor')",2000);
var rlb=setTimeout("drawPie(context,centerX*11/7,centerY*2/3,radius/8,0, Math.PI*2,false,'black','xor')",2500);
</script>
沒有留言:
張貼留言