Here's another beautiful program on Processing(processing.org) I made: a colorful mountain complex. To create the "mountain"-effect, I use the noise() function, which also creates a random curve to the mountains. However, unlike random(), it creates a smooth increment/decrement on numbers called Perlin noise instead of random numbers jumping up and down.
This is the code:
float b = 0;
float c = 0;
size(1000,200);//This sets the window's length and width
for(int i = 0; i < random(80,300); i++) {
stroke(random(255),random(255),random(255),random(70,100));
strokeWeight(2);
for(int count = 0; count < width; count++) {
b = noise(c) * 200;
c = c + 0.01;
line(count,200,count,b);
}
}
Here are my results:
For more info on Perlin noise and noise() :
http://processing.org/reference/noise_.html
http://en.wikipedia.org/wiki/Perlin_noise
No comments:
Post a Comment