Setting up a sketch

To view this guide as an illustrated sheet click on the image below or on the .PDF link

set up.pdf

Projects in Processing are called ‘sketches’.

To define the size and background colour of a sketch, we need to write a set up function. A function is the name we give smaller ‘programs’ within our Processing sketch.

The ‘void setup()’ function is referenced by Processing once when it first runs a sketch.

It is useful to control things that need to happen just once.

  •  e.g. setting the size of your sketch.
  •  e.g. positioning pictures or text that won’t need to change over time

To remind Processing to set the size of the sketch the same each second would be a waste of its power, so usually do it only once.

How to write the void setup() function.

Type the following ….

void setup() {

}

Leaving a line between the open { & the closed } curly brackets.

This is the space where we tell Processing what to do when the void setup() function is run.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: