Processing has three modes of operation, in effect three different “languages” increasing in complexity. The simplest is called Basic Mode; I like to call it “Exploratory Mode” because it is easy to just code something up and see what it does. Simply put in commands and they will be executed in order, and the final result will be drawn to the screen at the end. Let's look at an example:
This gives you:
The “size(width, height)” function tells Processing how big the display window will be in pixels. If you leave this out, the window will automatically be 100×100.
The “rect(x, y, width, height)” function draws a rectangle. The x and y positions are relative to the upper left corner, which is position (0,0):
You can use loops in basic mode.
A program in Processing, in whichever mode, is called a sketch. A sketch is made up of the program file (saved as sketchname.pde) and any data objects the sketch is to work with. There will be more about this later. Processing creates a new subdirectory called sketchbook in your home directory. All your sketches will be stored in this directory.