Digital Bauhaus Vorkurs/Projekte/Kleckse/Fliegenkacke: Difference between revisions
From Medien Wiki
< Digital Bauhaus Vorkurs | Projekte | Kleckse
(Created page with "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...") |
m (source tag verwenden!) |
||
Line 1: | Line 1: | ||
<source lang="Java"> | |||
PGraphics pg; | PGraphics pg; | ||
Line 109: | Line 111: | ||
} | } | ||
</source> |
Revision as of 15:33, 17 April 2011
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);
}