Processing – Workshop 1

In the first processing workshop we experimented with the ‘draw’ ‘mouseClicked’ and ‘if else’ commands, we had to set up a space for the program to exist in, draw the ellipse where the mouse was pointing (mouseX, mouseY) and the size of the ellipse (80, 80), program what it will do when the mouse is clicked (mouseClicked) and gave it an if and else variable stating that if the mouseX was more than 400 pixels it would erase all the ellipses, if the mouse was less than 400 it would say “Click over to the right”, though a very simple looking program, a fair amount of code went in to building it; this was probably the biggest misconception I had about programming, until you start learning how to do it you take for granted the super-sleek, fluid programs that are immensely powerful (photoshop etc), this did leave me unsettled and feeling a tad out of my depth in regards to getting to a competent level of programming knowledge; obviously much practice is needed.

complete set of code:

void setup() {
  println("Setting up our program");
  size(600, 300);
  background(150);
}

void draw() { 
  ellipse(mouseX, mouseY, 80, 80); 
}

void mouseClicked() {
  println("User has clicked the mouse");
  
  if (mouseX > 400) {
    clearStage(); 
  } else {
    println("Click over to the right");
  }
}

void clearStage() {
  println("Clear stage function called");
  background(150);
}

Workshop 1 Screenshot of application in action.

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