Friday, May 20, 2011

Draw arc on HTML5 canvas

arc(x, y, radius, startAngle, endAngle, anticlockwise)

example:
draw arc

function drawArc(context){

context.strokeStyle = "#000000";
context.lineWidth = 5;

context.beginPath();
context.arc(150, 200, 100, (Math.PI/180)*0, (Math.PI/180)*90, true);
context.stroke();

context.beginPath();
context.arc(400, 200, 100, (Math.PI/180)*0, (Math.PI/180)*270, false);
context.closePath();
context.stroke();

}


No comments:

Post a Comment