1 The Fundamentals of Drawing

Sketch 1: A Circle

Drawing a circle requires quite a bit of code in C or Java, but it’s one of the simplest programs in Processing. There isn’t a circle function in Processing, so to draw a circle we draw an ellipse that has equal width and height, which is the same thing as a circle.

Example A

The setup() function calls the predefined size() function to open a sketch window with a width of 400 pixels and a height of 300 pixels 1.

The draw() function draws a circle every time it’s called (60 times per second by default) with the ellipse() function, which has four parameters. The first and second parameters ...

Get An Artist's Guide to Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.