703
edits
Line 188: | Line 188: | ||
== Segmente == | == Segmente == | ||
class Segmente { | |||
float x; // X-Position | |||
float y; // Y-Position | |||
int seg; // Segmentzähler | |||
int r; // Radius | |||
float g; // Richtung bzw. Grad | |||
boolean mouseOver; //Maus über dem Objekt | |||
boolean visible; //Objekt sichtbar | |||
boolean move; //Objekt bewegt sich | |||
int h,s,b,a; // Farbe HSB und Alpha | |||
float sx,sy; //Geschwindigeit | |||
Segmente() { | |||
println("Segmente erstellt!"); | |||
} | |||
void maleSegmente() { | |||
fill(h,s,b,a); | |||
maleSegmente(seg,r,g,x,y); | |||
} | |||
void maleSegmente(int seg,int r,float g,float x,float y) { | |||
float segmentzahl = 3 + (float)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(); | |||
} | |||
} |
edits