Learning Processing 3

processing3_00056 processing3_00090

In the third processing workshop we learned functions and frame saving. Functions is a key part of coding however it is not one that I enjoy, my lecturer went very fast through this and made it hard to remember while I feel the processing workshop was very necessary the amount of numbers and letters (which is essentially functions) was quite overwhelming. I went away and then looked over it several times to try and understand it a bit more as there was so much to it that it became confusing what each one did.

From this I learnt that names for functions such as c isn’t helpful and instead clr for colour would be much more suitable. However now I understand the functions and using a colour palette (in which was something I tried to research) I feel a lot more confident with processing more complicated pieces.

void setup (){

size (800,400);
}

color[]plt = {#225378,#1695A3,#ACF0F2,#F3FFE2,#EB7F00};
int rot = 0;

void draw (){
saveFrame(“processing3_#####.png”);
translate(width/2,height/2);
rotate(rot);
for(int i=0; i<width; i=(i+40)){ house(i,20,4); };
rot=rot+1;
}

void house(int x, int y, int r){

color cl=plt[int(random(r))];

fill(cl,50);

noStroke();

triangle(x+15,y,x,y+15,x+30,y+15);

rect(x,y+15,30,30);

rect(x+12,y+30,10,15);

fill(255,255,255);

noStroke();

ellipse(mouseX/3,y,40,40);

}

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