add a kind of clound and noise random walker
This commit is contained in:
parent
506453b128
commit
43a6ffeac9
25
cloud/cloud.pde
Normal file
25
cloud/cloud.pde
Normal file
@ -0,0 +1,25 @@
|
||||
void setup() {
|
||||
size(640, 240);
|
||||
background(255);
|
||||
}
|
||||
|
||||
void draw(){
|
||||
loadPixels();
|
||||
float xoff = 0.0;
|
||||
for (int x = 0; x < width; x++) {
|
||||
float yoff = 0.0;
|
||||
for (int y = 0; y < height; y++) {
|
||||
noiseDetail(2,0.65);
|
||||
float brightr = map(noise(xoff,yoff), 0, 1, 80, 200);
|
||||
noiseDetail(12,0.65);
|
||||
float brightg = map(noise(xoff,yoff), 0, 1, 80, 200);
|
||||
noiseDetail(8,0.65);
|
||||
float brightb = map(noise(xoff,yoff), 0, 1, 80, 200);
|
||||
//float bright = random(255);
|
||||
pixels[x+y*width] = color(brightr, brightg, brightb);
|
||||
yoff += 0.01;
|
||||
}
|
||||
xoff += 0.01;
|
||||
}
|
||||
updatePixels();
|
||||
}
|
35
random_noise_walker/random_noise_walker.pde
Normal file
35
random_noise_walker/random_noise_walker.pde
Normal file
@ -0,0 +1,35 @@
|
||||
class Walker {
|
||||
float x, y;
|
||||
float tx, ty;
|
||||
|
||||
Walker() {
|
||||
tx = 0;
|
||||
ty = 10000;
|
||||
}
|
||||
|
||||
void step() {
|
||||
x = map(noise(tx), 0, 1, 0, width);
|
||||
y = map(noise(ty), 0, 1, 0, height);
|
||||
tx += 0.01;
|
||||
ty += 0.01;
|
||||
}
|
||||
|
||||
void display() {
|
||||
stroke(0);
|
||||
ellipse(x, y, 16, 16);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Walker walker;
|
||||
|
||||
void setup() {
|
||||
size(640, 240);
|
||||
background(255);
|
||||
walker = new Walker();
|
||||
}
|
||||
|
||||
void draw () {
|
||||
walker.step();
|
||||
walker.display();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user