Draws an arc of a fixed radius between two tangents that are defined by the current point in a path and two additional points.
object.arcTo(x1, y1, x2, y2, radius);
- x1 [in]
The x-coordinate for the first tangent that intersects with the current path point.
- y1 [in]
The y-coordinate for the first tangent that intersects with the current point.
- x2 [in]
The x-coordinate for the second tangent that intersects with the x1 and y1 points.
- y2 [in]
The y-coordinate for the second tangent that intersects with the x1 and y1 points.
- radius [in]
The radius of the arc to create.
This method does not return a value.
The radius given is negative.
- HTML Canvas 2D Context, Section 9
The ICanvasRenderingContext2D::arcTo method creates an arc of radius radius between two tangents. The first tangent is defined by an imaginary line that is drawn through the last point in a path and the point (x1, y1). The second tangent is defined by an imaginary line that is drawn through the point (x1, y1) and the point (x2, y2).
The arc is drawn between the two tangents using radius as the radius. ArcTo will draw a straight line from the last point of the path to the start of the arc which lies on the tangent that contains the last point on the path and x1 and y1.
When ICanvasRenderingContext2D::arcTo draws an arc, it tries to fit the arc between the two tangents. The following illustration shows two graphics. Both graphics create a path, and both draw horizontal and vertical lines and use the same parameters for ICanvasRenderingContext2D::arcTo. However, the second graphic moves the last point on the path down by 20 pixels, which changes the angle between the two tangents. In the first graphic, the values make the arc complete a rounded corner.
In the second example, because the angle of the intersecting tangents is narrower, arcTo needs to move the fixed radius arc to a point where it fits.