TOC : Script API > JavaScript > JavaScript API > GeneralScript > DrawingContext > Method >

 

arc

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

TOC : Script API > JavaScript > JavaScript API > GeneralScript > DrawingContext > Method >

 

arc

 

 

Adds points to a path that represents an arc.

 

 

 

Prototype :

 

void arc

(

        float X,

        float Y,

        float Radius,

        float StartAngle,

        float EndAngle,

        [ bool Anticlockwise ]

)

 

 

 

Arguments :

 

X

The X-coordinate, in pixels, for the center point of the arc

Y

The Y-coordinate, in pixels, for the center point of the arc

Radius

The radius or distance from the point (x,y) that the arc's path follows

StartAngle

The starting angle, in radians

EndAngle

The ending angle, in radians

Anticlockwise

Whether to draw a counterclockwise direction

If not set, applies as false

 

 

 

Reference :

 

The X and Y coordinates are for the center point of the arc in relation to the upper-left corner of the component.

 

Zero degree angle is the 3 o'clock position of the arc's circle and 90 degree (Math.PI/2) angle is the 6 o'clock position.

 

The function draws the shape on the screen regardless of transparency or clipping of the component and it can draw the arc even in areas outside of the component. However, the shape drawn outside the input component area is clipped.

 

The shape drawn by the function can be exported only in pdf, jpg, png, gif, tif, svg format.

 

 

 

Example :

 

//filled half circle

  ctx.fillStyle = "#FF0000";

  ctx.arc(30, 30, 20, 0, Math.PI, true);

  ctx.fill();

 

//non filled circle

  ctx.strokeStyle = "#FF0000";

  ctx.arc(30, 30, 20, 0, Math.PI/2, true);

  ctx.arc(30, 30, 20, Math.PI/2, 0, true);

  ctx.stroke();

 

 

 

Available Events :

 

OnPostDraw,  OnPreDraw