Tuesday, February 9, 2016

Forest



void setup(){
size(480,400);
smooth();
}

// VARIABLES
int xloc = 100;
int dia = 10;
int space = 50;
int x = 50;
int y = 50;
int s = 50;
float r = random(10);
float rx = random(480);
float ry = random(100);


// DRAW START -- DRAW START -- DRAW START
// DRAW START -- DRAW START -- DRAW START
// DRAW START -- DRAW START -- DRAW START

// IMAGE

// Background Color
void draw(){
fill(171,220,252);
rect(0,0,width,height);
fill(0,0,0,200-mouseX/2);
rect(0,0,width,height);


// Sky Lines
strokeWeight(2);
stroke(128,217,234,50);

for(int i=0; i<= height; i += 10){
line (0,0,width,i);
}
stroke(128,152,234,50);
for(int i=0; i<= height; i += 10){
line (0,height,i,0);
}
stroke(152,128,234,50);
for(int i=0; i<= height; i += 10){
line (width,0,i,height);
}
stroke(190,128,234,50);
for(int i=0; i<= height; i += 10){
line (width,height,0,i);
}

// Sun
noStroke();
fill(255,252,198);
ellipse(width/2,height/2-mouseX/2,50,50);

// Trees
tree(20,0,50);
tree(170,0,10);
tree(390,0,65);
tree(400,0,20);
tree(100,0,5);


// Grass Colors
stroke(0);
fill(51,142,47);
rect(0,100,490,400);
fill(0,0,0,200-mouseX/3);
rect(0,100,490,400);



// Grass Perspective Lines
strokeWeight(2);
stroke(12,57,0);
for (int i = 10; i < 480; i += 5) {
line(i, 100, i + i/.5, 400);
}
translate(20,20);
tree(100,200,15);
tree(200,360,10);
tree(350,400,10);
tree(420,90,5);
tree(50,0,5);
tree(240,90,5);
translate(0,50);
tree(100,200,15);
tree(200,360,10);
tree(350,400,10);
tree(420,90,5);
tree(50,0,5);
tree(240,90,5);
translate(-20,70);
tree(100,200,15);
tree(200,360,10);
tree(350,400,10);
tree(420,90,5);
tree(50,0,5);
tree(240,90,5);
translate(70,60);
tree(100,200,15);
tree(200,360,10);
tree(350,400,10);
tree(420,90,5);
tree(50,0,5);
tree(240,90,5);
}


// DRAW END -- DRAW END -- DRAW END
// DRAW END -- DRAW END -- DRAW END
// DRAW END -- DRAW END -- DRAW END


// OBJECTS

// Tree Drawing
void tree(int tx, int ty, int ts){
pushMatrix();
stroke(0,0,0,200);
fill(35,108,15);
for(int i = 5; i <= 200; i += 3){
ellipse(tx, i,ts+i,ts);
}
popMatrix();
}

No comments:

Post a Comment