[whatwg] context.arc and current point

Ian Hickson ian at hixie.ch
Tue Mar 1 16:23:44 PST 2011


On Thu, 2 Dec 2010, Andrea Canciani wrote:
>
> What will be the current point after an arc with endAngle-startAngle > 
> 2pi?
> 
> The specification seems to say that the end point is defined to be the 
> point at endAngle, but the path is required to be exactly a circle.

The path is a circle but the end point is unaffected by this; it is 
defined as being endAngle aleng the circle's circumference, measured in 
radians clockwise from the positive x-axis.

So for example:

  c.beginPath();
  c.moveTo(20,20);
  c.arc(200, 200, 100, 0, 5*Math.PI, false);
  c.lineTo(380,380);
  c.stroke();

...draws a line from the top left, diagonally down to the right edge of a 
circle, and then draws a line from the left edge of that circle diagonally 
down to the bottom right.

HTH,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


More information about the whatwg mailing list