Digital Bauhaus Vorkurs/Projekte/Kleckse/TassenCODE

From Medien Wiki
< Digital Bauhaus Vorkurs‎ | Projekte‎ | Kleckse
Revision as of 08:36, 11 April 2011 by Nicola (talk | contribs) (Created page with "float a = 100; float b = 100; float angle1 = 0.0; float segLength = 50; float x = width/2; float y = height/2; float s = 10; float c = 255; float klexkomplex = 5; float dichte...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

float a = 100; float b = 100; float angle1 = 0.0; float segLength = 50;

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


void setup () {

 size(700,700);
 smooth();
 background(0);
 noStroke(); 
 reset();
 //ellipse(x,y,s,s);fff

}

void reset() {

 background (240, 128, 128, 200);
 x = (float)random(width);
 y = (float)random(height);
 s = (float)random(255);
 c = (float)random(238);
 

}

void draw () {

// if(klexkomplex > (width/15) ) { // return;

//}
 //ellipse(x,y,s,s);
 int i;
 for(i=0; i<klexkomplex; i=i+1) {
   x = x + (float)random(dichteMin,dichteMax);
   y = y + (float)random(dichteMin,dichteMax);
   c = (float)random(255);
   s = (float)random(dichteMin,dichteMax);
   fill(0);
 }
 
 
 float dx = mouseX - x;
 float dy = mouseY - y;
 angle1 = atan2(dy, dx);  
 x = mouseX - (cos(angle1) * segLength);
 y = mouseY - (sin(angle1) * segLength);
 
 
 ellipse(x,y,s,s);

}



void keyPressed() {

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

}