Processing, for loops, image processing and if statements

tinting images:

Screen Shot 2014-10-24 at 15.00.01Screen Shot 2014-10-24 at 14.59.46  Screen Shot 2014-10-24 at 15.01.49

getting to grips with for loops


int s=20;

void draw(){

for(int y =0; y<height; y=y+s){
for(int x =0; x<width; x=x+s){
rect(x,y,s,s);
}
}
}

This for loops creates a grid of rectangles to create pixels.

Pixels


processing tutorials for pixels:

processing.org/tutorials/pixels

Screen Shot 2014-10-24 at 15.35.41 Screen Shot 2014-10-24 at 15.43.51

using the pixelated image above, I used:

if (mousePressed && mouseButton== LEFT || key==’i’){
img1=loadImage(“car.jpg”);
} else {
img1=loadImage(“Chocolate.jpg”);}
}

to change the image to another image when clicked or by pressing the i button.

Text


Screen Shot 2014-10-24 at 16.18.05 Screen Shot 2014-10-24 at 16.17.57

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