703
edits
Line 2: | Line 2: | ||
== Bauhaus Formen == | == Bauhaus Formen == | ||
<source lang="Java">float seg = 0; //Segmentzähler | <source lang="Java"> | ||
float seg = 0; //Segmentzähler | |||
void setup() { | void setup() { | ||
size( | size(600, 600); | ||
smooth(); | smooth(); | ||
noStroke(); | noStroke(); | ||
Line 12: | Line 13: | ||
void draw() { | void draw() { | ||
background(0); | background(0); | ||
for (float i=0; i<=400; i+=200) { | |||
maleSegmente(100,100+i,100); | |||
maleSegmente(100,100+i,300); | |||
maleSegmente(100,100+i,500); | |||
} | |||
} | } | ||
void maleSegmente(int r,float x,float y | void maleSegmente(int r,float x,float y) { | ||
float segmente = 0; | float segmente = 0; | ||
segmente = 3 + seg | segmente = 3 + seg; | ||
float angleStep = 360/segmente; | float angleStep = 360/segmente; | ||
Line 28: | Line 28: | ||
vertex(x, y); | vertex(x, y); | ||
for (float angle=0; angle<=360; angle+=angleStep) { | for (float angle=0; angle<=360; angle+=angleStep) { | ||
float vx = x + cos(radians(angle- | float vx = x + cos(radians(angle-90))*r; | ||
float vy = y + sin(radians(angle- | float vy = y + sin(radians(angle-90))*r; | ||
vertex(vx, vy); | vertex(vx, vy); | ||
} | } | ||
vertex(x + cos(radians( | vertex(x + cos(radians(270))*r, y + sin(radians(270))*r); | ||
endShape(); | endShape(); | ||
} | } | ||
void | void keyPressed() { | ||
if (key == CODED) { | if (key == CODED) { | ||
if (keyCode == UP) { | if (keyCode == UP) { |
edits