Painting Program and “Digital Landscape”

Painting Program Code:

int width = 16;
int height = 30;
int Color = 0;
color[] colors = {
color(255,0,0),
color(255,130,0),
color(255,255,0),
color(0,255,0),
color(0,0,255),
color(180,0,255),
color(255,0,170),
color(0) };

void setup(){
size (1080,720);
smooth();
cursor(CROSS);
background(255);

}

void draw(){

if (mousePressed && (mouseButton == LEFT)){
stroke(colors[Color]);
strokeWeight(width);
line(pmouseX,pmouseY,mouseX,mouseY);
} else if (mousePressed && (mouseButton == RIGHT)){
stroke(255);
strokeWeight(height);
line(pmouseX,pmouseY,mouseX,mouseY);

}

}

void keyPressed(){
if(key == CODED){
if(keyCode == UP){
Color = (Color+1)%8;
}
if(keyCode == DOWN){
Color = (Color+7)%8;
}
if(keyCode == LEFT){
width = (width-2);
height = (height-2);
}
if(keyCode == RIGHT){
width = (width+2);
height = (height+2);
}
if (width <= 1){
width = 1;
}
if (width >= 500){
width = 500;
}
if (height <= 1){
height = 1;
}
if (height >= 500){
height = 500;
}

}
if (key == BACKSPACE){
background(255);
}
}

 

“Digital Landscape”

Digital Landscape

Advertisements
This entry was posted in Non-Timebased and tagged , , , , . Bookmark the permalink.

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