Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- int num = 50;
- Walker[] w = new Walker[num];
- Random generator;
- void setup() {
- size(800, 600);
- colorMode(HSB,360,100,100);
- background(#000000);
- for (int i=0; i<num; i++) {
- w[i]= new Walker(i);
- }
- generator = new Random();
- }
- void draw() {
- for (int i=0; i<num; i++) {
- w[i].step();
- w[i].update();
- }
- }
- void keyPressed() {
- save(random(12345)+".png");
- }
- class Walker {
- float x, y, tx, ty;
- color col;
- float rdmCol, tcol;
- float sdC = 15;
- float sz;
- int i;
- Walker(int _i) {
- i = _i;
- tx = random(100);
- ty = random(1000);
- tcol = random(10000);
- rdmCol = random(360);
- sz = 5;
- x = width/2;
- y = height/2;
- }
- void step() {
- /*
- x = map(noise(tx), 0, 1, 0, width);
- y = map(noise(ty), 0, 1, 0, height);
- tx += 0.01;
- ty += 0.01;
- */
- float s = 5;
- float stepsizeX = map(noise(tx), 0, 1, -s, s);
- float stepsizeY = map(noise(ty), 0, 1, -s, s);
- tx += 0.02;
- ty += 0.01;
- x += stepsizeX;
- y += stepsizeY;
- tcol += 0.02;
- }
- void update() {
- //col = color(noise(tcol)*rdmCol, 90, 90);
- //col = color(rdmCol, 90,90);
- fill(#cccccc);
- stroke(#000000,50);
- ellipse(x, y, sz, sz);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement