p5art

Drawing Circles

In p5, we can use the ellipse function to create both circles and ovals.

The ellipse function needs 4 parameters for placement and size.

ellipse(x, y, width, height)

Circle diagram

The center of the ellipse with be at the x y position given.

Here is the code to draw a circle at the location 100, 100 with a size of 200.

ellipse(100, 100, 200, 200)

Here is the code to draw an oval that is wider than it is tall.

ellipse(100, 100, 200, 100)

Try it out!

Try drawing 3 different circles or ovals in the p5 editor