This reference is for Processing 2.0+. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Javadoc.

Name

setup()

Examples
void setup() {
  size(200, 200);
  background(0);
  noStroke();
  fill(102);
}

int a = 0;

void draw() {
  rect(a++%width, 10, 2, 80); 
}
Description The setup() function is called once when the program starts. It's used to define initial enviroment properties such as screen size and background color and to load media such as images and fonts as the program starts. There can only be one setup() function for each program and it shouldn't be called again after its initial execution. Note: Variables declared within setup() are not accessible within other functions, including draw().
Syntax
setup()
Returnsvoid
Relatedsize()
loop()
noLoop()
draw()
Updated on May 19, 2014 05:29:58pm PDT

Creative Commons License