add a kind of clound and noise random walker
This commit is contained in:
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();
|
||||
}
|
Reference in New Issue
Block a user