Beginning Work in Processing

The practical part of the first term of our second year is going to be based around the Java-based integrated development environment Processing in order to learn the basics of programming and eventually create a piece of interactive artwork using the program.

In a processing sketch conventionally there are two main functions, void setup, where any “background information” of the sketch (such as setting up arrays) is written and void draw, where functions that provide the output of the sketch are written.  Variables and objects are declared above both these functions. void setup is initialized at the start-up of the sketch whilst void draw is a looping function where the output is drawn at 30 fps.

sketch1code sketch 1 code a sketch1

This sketch draws a line between the point (150, 25) and the mouse. The screen becomes progressively filled with lines as the mouse is moved as a new line is drawn every frame. However on each start-up of the sketch the background color is changed at random.

sketch2code sketch2

However moving the background function to the end of the code provides an output of a sketch with a rapidly changing colored background but no line-mouse output. The background function will overwrite the rest of the sketch.

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