Thursday, September 25, 2008

learning processing pt1

So Derek and I had a little learning session last night. He's attempting to teach me how to code in processing. It's starting to make better sense to me now, and we wrote a program last night that helped me a ton.

Here is what we did:
void setup() {
size(400,400); //WINDOW SIZE
smooth();
}

void draw() {
background(0); //BG COLOR
translate(width/2, height/2); //CENTERS SCREEN

for(int i=0; i < 10; i++) {
int xPos = int(random(-width, width));
int yPos = int(random(-height, height));

drawCircle(xPos, yPos, 50, color(50, 0, 100));
}
}

void drawCircle(int xPos, int yPos, int diam, color col) {
fill(col);
noStroke();
ellipse(xPos, yPos, diam, diam);
}

It turned out well and got me to understand how processing works as a language. I'm happy with what we did last night and I look forward to more learning... apparently he created a folder for me on his desktop: "Zac Lessons" haha. Thanks dude.

No comments: