Digital Bauhaus Vorkurs/Projekte/Kleckse/code: Difference between revisions

From Medien Wiki
(Created page with "int x = width/2; int y = height/2; int s = 10; int c = 255; int klexkomplex = 5; int dichteMin = -10; int dichteMax = 10; void setup () { size(700,700); smooth(); backg...")
 
m (source tag verwenden!)
 
Line 1: Line 1:
<source lang="Java">
int x = width/2;
int x = width/2;
int y = height/2;
int y = height/2;
Line 54: Line 55:
   }
   }
}
}
</source>

Latest revision as of 15:33, 17 April 2011

int x = width/2;
int y = height/2;
int s = 10;
int c = 255;
int klexkomplex = 5;
int dichteMin = -10;
int dichteMax = 10;



void setup () {

  size(700,700);
  smooth();
  background(0);
  noStroke(); 
  reset();

}

void reset() {
  
  background (255);
  x = (int)random(width);
  y = (int)random(height);
  s = (int)random(255);
  c = (int)random(238);
  
}  
  
void draw () {

  int i;
  for(i=0; i<klexkomplex; i=i+1) {
    x = x + (int)random(dichteMin,dichteMax);
    y = y + (int)random(dichteMin,dichteMax);
    c = (int)random(255);
    s = (int)random(dichteMin,dichteMax);
    fill(0, 191, 255);
  }
  
  ellipse(x,y,s,s);
}




void keyPressed() {
  if ((key== 'r')) {
    reset(); 
  }
  if (key== 'h') {
    exit();
  }
}