43
edits
Line 256: | Line 256: | ||
</source> | </source> | ||
== Final Project == | == Final Project "natürlich" == | ||
''My final prohect trys to discuss the topic of nature. What's natural at all? Aren't the things we consider as natural, like forests or rivers, influenced by humans and so therefore not "natural". So if these things are nature, why isn't the city, with all its streets and buildings, nature after a while? | ''My final prohect trys to discuss the topic of nature. What's natural at all? Aren't the things we consider as natural, like forests or rivers, influenced by humans and so therefore not "natural". So if these things are nature, why isn't the city, with all its streets and buildings, nature after a while? | ||
Line 267: | Line 267: | ||
<source lang = "java"> | <source lang = "java"> | ||
//"natürlich" by Jason Langheim | |||
//This sketch creates random trees and applys them as masks | |||
//on pictures of cities and puts them on top of another picture. | |||
//creating the variables | |||
PImage img; | PImage img; | ||
PImage bg; | PImage bg; | ||
Line 279: | Line 285: | ||
PImage m; | PImage m; | ||
int b=0; | int b=0; | ||
//create an array of slices of the city picture and the mask | |||
void setup(){ | void setup(){ | ||
frameRate( | frameRate(15); | ||
size(500,500); | size(500,500); | ||
smooth(); | smooth(); | ||
tree1 = createGraphics(500,500); | tree1 = createGraphics(500,500); | ||
img = loadImage(" | img = loadImage("Haus.jpg"); | ||
m = loadImage("m.png"); | m = loadImage("m.png"); | ||
bg = loadImage(" | bg = loadImage("Wald.png"); | ||
bg.resize(width,height); | bg.resize(width,height); | ||
img.resize(width,height); | img.resize(width,height); | ||
Line 307: | Line 315: | ||
} | } | ||
//gray scale the background and apply the masks on the city | |||
void draw() { | void draw() { | ||
Line 323: | Line 333: | ||
} | } | ||
} | } | ||
//funtion to create random trees using math | |||
void branches(float beginX, float beginY, float bLength, float angle) | void branches(float beginX, float beginY, float bLength, float angle) | ||
Line 342: | Line 354: | ||
} | } | ||
} | } | ||
//function that draws the tree | |||
void mask(){ | void mask(){ | ||
Line 352: | Line 366: | ||
tree1.endDraw(); | tree1.endDraw(); | ||
} | } | ||
//redraw a random tree when a key is pressed | |||
void keyPressed(){ | void keyPressed(){ | ||
Line 366: | Line 382: | ||
} | } | ||
frame = 0; | frame = 0; | ||
bg = loadImage(" | bg = loadImage("Wald.png"); | ||
bg.resize(width,height); | bg.resize(width,height); | ||
} | } |
edits