arc()Â Syntax (p5.js)arc(x, y, w, h, start, stop);
| Parameter | Meaning | Think of it as |
|---|---|---|
x |
x-position of center | center left â right |
y |
y-position of center | center up â down |
w |
width of ellipse | how wide |
h |
height of ellipse | how tall |
start |
start angle | where the arc begins |
stop |
stop angle | where the arc ends |
arc() (VERY important)p5.js uses RADIANS, not degrees.
| Angle | Visual |
|---|---|
0 |
points to the right â |
PI / 2 |
down â |
PI |
left â |
PI * 1.5 |
up â |
TWO_PI |
full circle |
So this:
arc(x, y, w, h, 0, PI);
draws the bottom half of a circle
(perfect for a smile đ)
arc(x, y + 10, 40, 30, 0, PI);
Why this works:
0 â PIÂ = half circle