158
edits
(Created page with "== Linien von allen Seiten == '''zufällig und am Mauszeiger''' <source lang="Java" highlight="14">") |
|||
Line 4: | Line 4: | ||
<source lang="Java" highlight="14"> | <source lang="Java" highlight="14"> | ||
boolean aON=false; | |||
boolean bON=false; | |||
boolean cON=false; | |||
boolean dON=false; | |||
boolean eON=false; | |||
boolean fON=false; | |||
boolean gON=false; | |||
boolean hON=false; | |||
boolean iON=false; | |||
boolean jON=false; | |||
boolean kON=false; | |||
float helligkeit=0; | |||
float groesse=1; | |||
void setup() { | |||
size(screen.width/2, screen.height/2); | |||
background(255); | |||
smooth(); | |||
} | |||
void draw() { | |||
if(aON) { | |||
drawLine(); | |||
} | |||
if(bON) { | |||
drawLine1(); | |||
} | |||
if(cON) { | |||
drawLine2(); | |||
} | |||
if(dON) { | |||
drawLine3(); | |||
} | |||
if(eON) { | |||
drawLine4(); | |||
} | |||
if(fON) { | |||
drawLine5(); | |||
} | |||
if(gON) { | |||
drawLine6(); | |||
} | |||
if(hON) { | |||
drawLine7(); | |||
} | |||
if(iON) { | |||
drawLine8(); | |||
} | |||
if(jON) { | |||
drawLine9(); | |||
} | |||
if(kON) { | |||
background(255); | |||
} | |||
if(aON = true) { | |||
aON = false; | |||
} | |||
if(bON = true) { | |||
bON = false; | |||
} | |||
if(cON = true) { | |||
cON = false; | |||
} | |||
if(dON = true) { | |||
dON = false; | |||
} | |||
if(eON = true) { | |||
eON = false; | |||
} | |||
if(fON = true) { | |||
fON = false; | |||
} | |||
if(gON = true) { | |||
gON = false; | |||
} | |||
if(hON = true) { | |||
hON = false; | |||
} | |||
if(iON = true) { | |||
iON = false; | |||
} | |||
if(jON = true) { | |||
jON = false; | |||
} | |||
if(kON = true) { | |||
kON = false; | |||
} | |||
if (mousePressed == true) { | |||
aON = true; | |||
} | |||
else { | |||
aON = false; | |||
} | |||
} | |||
void keyTyped() { | |||
if(keyPressed) { | |||
if (key == '0' || key == '=') { | |||
kON = true; | |||
stroke(0); | |||
groesse = 1; | |||
helligkeit = 0; | |||
} | |||
else { | |||
kON = false; | |||
} | |||
} | |||
if(keyPressed) { | |||
if (key == '!') { | |||
bON = true; | |||
} else { | |||
bON = false; | |||
} | |||
} | |||
if(keyPressed) { | |||
if (key == '"') { | |||
cON = true; | |||
} else { | |||
cON = false; | |||
} | |||
} | |||
if(keyPressed) { | |||
if (key == '§') { | |||
dON = true; | |||
} else { | |||
dON = false; | |||
} | |||
} | |||
if(keyPressed) { | |||
if (key == '$') { | |||
eON = true; | |||
} else { | |||
eON = false; | |||
} | |||
} | |||
if(keyPressed) { | |||
if (key == '%') { | |||
fON = true; | |||
} else { | |||
fON = false; | |||
} | |||
} | |||
if(keyPressed) { | |||
if (key == '&') { | |||
gON = true; | |||
} else { | |||
gON = false; | |||
} | |||
} | |||
if(keyPressed) { | |||
if (key == '/') { | |||
hON = true; | |||
} else { | |||
hON = false; | |||
} | |||
} | |||
if(keyPressed) { | |||
if (key == '(') { | |||
iON = true; | |||
} else { | |||
iON = false; | |||
} | |||
} | |||
if(keyPressed) { | |||
if (key == ')') { | |||
jON = true; | |||
} else { | |||
jON = false; | |||
} | |||
} | |||
} | |||
void keyPressed() { | |||
if (key == '+' || key == '*') { | |||
groesse=groesse+1; | |||
if(groesse > 15) { | |||
groesse = 15; | |||
} | |||
println("Dicke: " + (int)groesse); | |||
} | |||
if (key == '-' || key == '_') { | |||
groesse=groesse-1; | |||
if(groesse < 1) { | |||
groesse = 1; | |||
} | |||
println("Dicke: " + (int)groesse); | |||
} | |||
if (key == 'w' || key == 'W') { | |||
helligkeit=helligkeit+50; | |||
if(helligkeit > 250) { | |||
helligkeit = 250; | |||
} | |||
} | |||
if (key == 's' || key == 'S') { | |||
helligkeit=helligkeit-50; | |||
if(helligkeit < 0) { | |||
helligkeit = 0; | |||
} | |||
} | |||
if ((key == 's' || key == 'w' || key == 'S' || key == 'W') && (int)helligkeit == 0) { | |||
println("Farbe: schwarz"); | |||
} | |||
if ((key == 's' || key == 'w' || key == 'S' || key == 'W') && (int)helligkeit == 50) { | |||
println("Farbe: schwarz-grau"); | |||
} | |||
if ((key == 's' || key == 'w' || key == 'S' || key == 'W') && (int)helligkeit == 100) { | |||
println("Farbe: grau-schwarz"); | |||
} | |||
if ((key == 's' || key == 'w' || key == 'S' || key == 'W') && (int)helligkeit == 150) { | |||
println("Farbe: grau-weiß"); | |||
} | |||
if ((key == 's' || key == 'w' || key == 'S' || key == 'W') && (int)helligkeit == 200) { | |||
println("Farbe: weiß-grau"); | |||
} | |||
if ((key == 's' || key == 'w' || key == 'S' || key == 'W') && (int)helligkeit == 250) { | |||
println("Farbe: weiß"); | |||
} | |||
if (key == '1' || key == '!') { | |||
println("links oben"); | |||
} | |||
if (key == '2' || key == '"') { | |||
println("mitte oben"); | |||
} | |||
if (key == '3' || key == '§') { | |||
println("rechts oben"); | |||
} | |||
if (key == '4' || key == '$') { | |||
println("mitte rechts"); | |||
} | |||
if (key == '5' || key == '%') { | |||
println("rechts unten"); | |||
} | |||
if (key == '6' || key == '&') { | |||
println("mitte unten"); | |||
} | |||
if (key == '7' || key == '/') { | |||
println("links unten"); | |||
} | |||
if (key == '8' || key == '(') { | |||
println("mitte links"); | |||
} | |||
if (key == '9' || key == ')') { | |||
println("mitte"); | |||
} | |||
if (key == '0' || key == '=') { | |||
println("alles auf Anfang"); | |||
println("Farbe: schwarz"); | |||
println("Dicke: 1"); | |||
} | |||
} | |||
void drawLine() { | |||
smooth(); | |||
stroke(helligkeit); | |||
strokeWeight(groesse); | |||
if (key == '1') { | |||
line(mouseX,mouseY,0,0); | |||
} | |||
if (key == '2') { | |||
line(mouseX,mouseY,width/2,0); | |||
} | |||
if (key == '3') { | |||
line(mouseX,mouseY,width,0); | |||
} | |||
if (key == '4') { | |||
line(mouseX,mouseY,width,height/2); | |||
} | |||
if (key == '5') { | |||
line(mouseX,mouseY,width,height); | |||
} | |||
if (key == '6') { | |||
line(mouseX,mouseY,width/2,height); | |||
} | |||
if (key == '7') { | |||
line(mouseX,mouseY,0,height); | |||
} | |||
if (key == '8') { | |||
line(mouseX,mouseY,0,height/2); | |||
} | |||
if (key == '9') { | |||
line(mouseX,mouseY,width/2,height/2); | |||
} | |||
} | |||
void drawLine1() { | |||
smooth(); | |||
stroke(helligkeit); | |||
strokeWeight(groesse); | |||
int x=(int)random((int)width); | |||
int y=(int)random((int)height); | |||
line(0,0,x,y); | |||
} | |||
void drawLine2() { | |||
smooth(); | |||
stroke(helligkeit); | |||
strokeWeight(groesse); | |||
int x=(int)random((int)width); | |||
int y=(int)random((int)height); | |||
line(width/2,0,x,y); | |||
} | |||
void drawLine3() { | |||
smooth(); | |||
stroke(helligkeit); | |||
strokeWeight(groesse); | |||
int x=(int)random((int)width); | |||
int y=(int)random((int)height); | |||
line(width,0,x,y); | |||
} | |||
void drawLine4() { | |||
smooth(); | |||
stroke(helligkeit); | |||
strokeWeight(groesse); | |||
int x=(int)random((int)width); | |||
int y=(int)random((int)height); | |||
line(width,height/2,x,y); | |||
} | |||
void drawLine5() { | |||
smooth(); | |||
stroke(helligkeit); | |||
strokeWeight(groesse); | |||
int x=(int)random((int)width); | |||
int y=(int)random((int)height); | |||
line(width,height,x,y); | |||
} | |||
void drawLine6() { | |||
smooth(); | |||
stroke(helligkeit); | |||
strokeWeight(groesse); | |||
int x=(int)random((int)width); | |||
int y=(int)random((int)height); | |||
line(width/2,height,x,y); | |||
} | |||
void drawLine7() { | |||
smooth(); | |||
stroke(helligkeit); | |||
strokeWeight(groesse); | |||
int x=(int)random((int)width); | |||
int y=(int)random((int)height); | |||
line(0,height,x,y); | |||
} | |||
void drawLine8() { | |||
smooth(); | |||
stroke(helligkeit); | |||
strokeWeight(groesse); | |||
int x=(int)random((int)width); | |||
int y=(int)random((int)height); | |||
line(0,height/2,x,y); | |||
} | |||
void drawLine9() { | |||
smooth(); | |||
stroke(helligkeit); | |||
strokeWeight(groesse); | |||
int x=(int)random((int)width); | |||
int y=(int)random((int)height); | |||
line(width/2,height/2,x,y); | |||
} |
edits