< Digital Bauhaus Vorkurs | Projekte | Linie
Linien zufälliger Länge aus dem Mittelpunkt
<source lang="Java" highlight="14">
boolean aON=false; boolean bON=false;
void setup() {
size(500,500); background(255); smooth();
}
void draw() {
if(aON) { drawLine1(); } if(bON) { background(255); } if(aON = true) { aON = false; } if(bON = true) { bON = false; }
}
void keyTyped() {
if(keyPressed) { if (key == '1') { aON = true; } else { aON = false; } } if(keyPressed) { if (key == '2') { bON = true; } else { bON = false; } }
}
void drawLine1() {
int x2=(int)random(500); int y2=(int)random(500); stroke(0); line(250,250,x2,y2);
}