Nature 2

I find a lot of inspiration in trees. For this piece I wanted to give the user the ability to plant a forest…sort of. The idea is that a tree is created in a random shade of green, with a height based on where the mouse is when it is clicked. The only part of this that still bothers me is that if you click to create a small tree, which would appear to be off in the background, it will appear on top of larger trees in the foreground.

PImage myPicture;
PImage myPicture2;
color myColor;

void setup() {
size(500, 400);
myPicture2 = loadImage(“http://www.joshuarosenstock.com/teaching/IMGD3x00_B12/wp-content/uploads/2012/11/background.png”);
background(myPicture2);
myPicture = loadImage(“http://www.joshuarosenstock.com/teaching/IMGD3x00_B12/wp-content/uploads/2012/11/tree.png”); //load this image file (must be in same directory as sketch)
//when sketch is online, put a URL for the image, which must be on same server as sketch)
imageMode(CENTER);
}

void draw(){
}
void mousePressed(){
myColor=color(random(150,220));
tint(myColor);
image(myPicture,mouseX,400-height/2,80,mouseY);
}

I’m unable to get my projects to load properly on the blog currently, so I’m just going to post the code for the time being, and will probably upload a screen shot later or something to show what it should look like when working.

Leave a Reply