Introduction to Processing

Our first day in Open Source entailed a brief introduction to the Processing language and IDE (Integrated Development Environment). We learned how to set the scale of our app, the coordinate system, commenting, and basic shape functions.

You can download Processing yourself from processing.org. Remember you can type Command-R to run your app instead of clicking 'run' with the mouse.

Setting the App Size
// this will set our application to be 
// 600 pixels wide by 400 pixels high
size(600, 400);

Commenting Code
Any content within comment will not be read when you compile your code.
// This is an inline comment.

/*
This is a block comment.
*/


Basic Shapes
Shapes take multiple parameters. Check out the Processing reference for more information.
// x, y
point(23, 34)

// x, y, width, height, start, stop
arc(45, 35, 50, 50, 0, PI/2);

// x, y, width, height
ellipse(56, 46, 55, 55);

// x1, y1, x2, y1
line(30, 20, 85, 20);

// x1, y1, x2, y2, x3, y3, x4, y4
quad(38, 31, 86, 20, 69, 63, 30, 76);

// x, y, width, height
rect(30, 20, 55, 55);

// x1, y1, x2, y2, x3, y3
triangle(30, 75, 58, 20, 86, 75);


Grayscale Colors, Strokes, and Fills
background(0); // sets the background to black
stroke(255); // sets the stroke to white
strokeWidth(10); // sets the stroke width to 10
fill(128); // sets the fill to a medium gray


... and More
We briefly touched on Variables and Data Types, which we will be studying in depth during the next class.