I volontari di MDN non hanno ancora tradotto questo articolo in Italiano. Unisciti a noi e traducilo tu stesso.
Puoi anche consultare l’articolo in English (US).

The CanvasRenderingContext2D.arc() method of the Canvas 2D API adds a circular arc to the current sub-path.

Note: Want to draw a circle? The arc() method is the best way. Simply specify a start angle of 0 radians (0°) and an end angle of 2π radians (360°).


void ctx.arc(x, y, radius, startAngle, endAngle [, anticlockwise]);

The arc() method creates a circular arc centered at (x, y) with a radius of radius. The path starts at startAngle and ends at endAngle, and travels in the direction given by anticlockwise (defaulting to clockwise).


The x-axis (horizontal) coordinate of the arc's center.
The y-axis (vertical) coordinate of the arc's center.
The arc's radius. Must be non-negative.
The angle at which the arc starts, measured clockwise from the positive x-axis and expressed in radians.
The angle at which the arc ends, measured clockwise from the positive x-axis and expressed in radians.
anticlockwise Optional
An optional Boolean which, if true, causes the arc to be drawn counter-clockwise between the start and end angles. The default value is false (clockwise).


Drawing a full circle

This example draws a complete circle using the arc() method.


<canvas id="canvas"></canvas>


The arc is given an x coordinate of 100, a y coordinate of 75, and a radius of 50. To make a full circle, the arc begins at an angle of 0 radians (0°), and ends at an angle of 2π radians (360°).

const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');

ctx.arc(100, 75, 50, 0, 2 * Math.PI);


Different shapes demonstrated

This example draws various shapes to show what is possible when using arc().

const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');

// Draw shapes
for (let i = 0; i <= 3; i++) {
  for (let j = 0; j <= 2; j++) {
    let x             = 25 + j * 50;                 // x coordinate
    let y             = 25 + i * 50;                 // y coordinate
    let radius        = 20;                          // Arc radius
    let startAngle    = 0;                           // Starting point on circle
    let endAngle      = Math.PI + (Math.PI * j) / 2; // End point on circle
    let anticlockwise = i % 2 == 1;                  // Draw anticlockwise

    ctx.arc(x, y, radius, startAngle, endAngle, anticlockwise);

    if (i > 1) {
    } else {


ScreenshotLive sample


Specification Status Comment
HTML Living Standard
The definition of 'CanvasRenderingContext2D.arc' in that specification.
Living Standard  

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic supportChrome Full support YesEdge Full support 12Firefox Full support YesIE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes


Full support  
Full support

Gecko-specific notes

Starting with Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1):

  • The anticlockwise parameter is optional.
  • Specifying a negative radius now throws an IndexSizeError error ("Index or size is negative or greater than the allowed amount").

See also

Tag del documento e collaboratori

Hanno collaborato alla realizzazione di questa pagina: mfluehr, fscholz, thatmichael85, nmve, erikadoyle, hwiechers, michaellaszlo
Ultima modifica di: mfluehr,