Digital Landscape

I drew an image using a drawing software I programmed in Processing

screen-shot-2016-09-30-at-12-59-29-am

This is the code for the program:

color paint;
int paintRed=0;
int paintGreen=0;
int paintBlue=0;
boolean redAdd=false;
boolean redSub=false;
boolean greenAdd=false;
boolean greenSub=false;
boolean blueAdd=false;
boolean blueSub=false;
int brushSize=30;

void setup(){
size(1280,720);
background(255);
}

void draw(){

}

void mouseDragged(){
noStroke();
fill(paint);
paint=color(paintRed,paintGreen,paintBlue);
if(redAdd == true){
paintRed=paintRed+1;
if(paintRed>255){
paintRed=255;
}
}
if(redSub == true){
paintRed=paintRed-1;
if(paintRed<0){
paintRed=0;
}
}
if(greenAdd == true){
paintGreen=paintGreen+1;
if(paintGreen>255){
paintGreen=255;
}
}
if(greenSub == true){
paintGreen=paintGreen-1;
if(paintGreen<0){
paintGreen=0;
}
}
if(blueAdd == true){
paintBlue=paintBlue+1;
if(paintBlue>255){
paintBlue=255;
}
}
if(blueSub == true){
paintBlue=paintBlue-1;
if(paintBlue<0){
paintBlue=0;
}
}

ellipse(mouseX,mouseY,brushSize,brushSize);
if(keyPressed){
if(key==’a’){
redAdd=true;
}
if(key==’z’){
redSub=true;
}
if(key==’s’){
greenAdd=true;
}
if(key==’x’){
greenSub=true;
}
if(key==’d’){
blueAdd=true;
}
if(key==’c’){
blueSub=true;
}
}
}

void keyReleased(){
if(key==’a’){
redAdd=false;
}
if(key==’z’){
redSub=false;
}
if(key==’s’){
greenAdd=false;
}
if(key==’x’){
greenSub=false;
}
if(key==’d’){
blueAdd=false;
}
if(key==’c’){
blueSub=false;
}
}
void keyTyped(){
//this is to keep the color without holding the key down
if(key==’f’){
background(paint);
}

if(key == ‘[‘){
brushSize = brushSize – 1;
if(brushSize < 1){
brushSize = 1;
}
}
if(key == ‘]’){
brushSize = brushSize + 1;
}
}

Advertisements

About degrafgo

I am a fun, green loving guy who owns 3 YouTube channels under the name DeGraphics.
This entry was posted in Lectures & Workshops, Non-Time Based 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