PROCESSING
What is processing?
a computer language originally conceived by Ben Fry and Casey Reas in 2001. Their objective was to develop a simple lan- guage for use by designers and artist so that they could experiemnt without needing an extensive knowledge of computer programming.
It is a framework built using programming language called Java.
Chararitics of Java an therefore Processing - multi platform | runs on windows, mac, or linux - secure | high level cryptography for the exchange of private information - network-centric | apps can be built around internet protocals - dynamic | dynamic memory allocation and memmory garbage collection - international | supports international characters - performance | just-in-time compiles and optimizers - simplicity | easier to learn than other languages such as C, C++, or even Java
Variable Types A few of the more commonly used variable types. There are a few others please see the documentation at http://processing. org/reference/ for more details.
boolean
int float String
boolean isInside = false; boolean myCoatisAsweater = false;
int frogs = 10 float appleSize = 7.2 String my_name = Travis Masingale
When you declare a variable you also need to tell the program what type of variable it is and if necessary give it an initial value.
type name = value;
int myAge = 36;
Arithmetic Operations Operator Use Description
+ - * / %
op1 + op2 Adds op1 and op2
op1 - op2 op1 * op2 op1 / op2 op1 / op2
Subtracts op2 from op1 Multiplies op1 by op2 Divides op1 by op2 Computes the remainder of dividing op1 by op2
Comments
It is a good idea to comment your code for your own reference of for others who look at your code
// for one line comments
/* Use these if you want to write mulitline comments
*/
If statements
if (condition) ....;
else
....;
Example
String name = “Travis”; boolean itsMe;
Loops
if( username = “Travis”) { itsMe = true;
} else { itsMe = false; }
A loop is a repitiion of statements
for loop
allows you to declare a starting condition, an ending condition, and a modification step.
while loop
continually executes a block of statements while a condition remains true.
for (start condition; end condition; modification step ) { ...;
}
for (int i=0; i<10; i=i+1) { println(i); // will printout the value of i
}
while (expressio) { statment
}
Useful links
http://processingjs.org/learning
http://www.openprocessing.org/