703
edits
(Created page with " == Zufällige Kompositionen == == Segmente ==") |
|||
Line 4: | Line 4: | ||
== Segmente == | == Segmente == | ||
<source lang="Java">class Segmente { | |||
float x; // X-Position | |||
float y; // Y-Position | |||
float seg; // Segmentzähler | |||
int r; // Radius | |||
float g; // Richtung | |||
boolean mouseOver; //Maus über dem Objekt | |||
boolean visible; //Objekt sichtbar | |||
int h,s,b,a; // Farbe HSB und Alpha | |||
Segmente() { | |||
println("Segmente erstellt!"); | |||
} | |||
void maleSegmente() { | |||
fill(h,s,b,a); | |||
maleSegmente(seg,r,g,x,y); | |||
} | |||
void maleSegmente(float seg,int r,float g,float x,float y) { | |||
float segmentzahl = 3 + seg; | |||
float angleStep = 360/segmentzahl; | |||
beginShape(); | |||
vertex(x, y); | |||
for (float angle=0; angle<=360; angle+=angleStep) { | |||
float vx = x + cos(radians(angle-g))*r; | |||
float vy = y + sin(radians(angle-g))*r; | |||
vertex(vx, vy); | |||
} | |||
vertex(x + cos(radians(360-g))*r, y + sin(radians(360-g))*r); | |||
endShape(); | |||
} | |||
} | |||
</source> |
edits