Digital Bauhaus Vorkurs/Projekte/Kleckse/Fliegenkacke

From Medien Wiki
< Digital Bauhaus Vorkurs‎ | Projekte‎ | Kleckse
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
PGraphics pg;


float angle1 = 0.0;
float segLength = 50;


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



void setup () {

  size(700,700);
  pg = createGraphics(width, height, P2D);
  pg.beginDraw();
  pg.background(255);
  pg.noStroke();
  pg.fill(193, 97,30, 200);
  pg.endDraw();



  smooth();
  frameRate(300); 




  reset();
}  

void reset() {

  background (255);
  x = (float)random(width);
  y = (float)random(height);
  s = (float)random(255);
  c = (float)random(238);
}  



void draw () {




  if (mousePressed == true) {
    line(pmouseX, pmouseY, mouseX, mouseY);
  }


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

  

  background(255);



  int i;
  x = x + (int)random(dichteMin,dichteMax);
  y = y + (int)random(dichteMin,dichteMax);
  c = (int)random(255);
  s = c + (int)random(dichteMin,dichteMax);
  t = (int)random(255);
  z = (int)random(dichteMin,dichteMax);
  fill(193, 94, 50, 210);
 


  float dx = mouseX - x ;
  float dy = mouseY - y ;
  angle1 = atan2(dy, dx);  
  x = mouseX - (cos(angle1) * segLength);
  y = mouseY - (sin(angle1) * segLength);


  fill ( 120, 130, 200);

  // draw kack
  if(mousePressed) {
    pg.beginDraw();
    pg.ellipse(x+300,y, z, z);
    pg.ellipse(x+300, y+3, z+3, z+3);
    pg.ellipse(x+300,y+10,z+10,z+10);
    pg.endDraw();
  }
  image(pg, 0,20);

  if(keyPressed== true) {
    reset();
  }

 
  ellipse(x+300,y, z, z);
  ellipse(x+300, y+3, z+3, z+3);
  
}