/**
* Regular Polygon
*
* What is your favorite? Pentagon? Hexagon? Heptagon?
* No? What about the icosagon? The polygon() function
* created for this example is capable of drawing any
* regular polygon. Try placing different numbers into the
* polygon() function calls within draw() to explore.
*/
void setup() {
size(1000, 800);
}
void draw() {
background(255);
ntust(width/2,height/2,0,102,179,frameCount / 200.0, map(mouseX,0,width,0,10));
}
void polygon(float x, float y, float radius, int npoints) {
float angle = TWO_PI / npoints;
beginShape();
for (float a = 0; a < TWO_PI; a += angle) {
float sx = x + cos(a) * radius;
float sy = y + sin(a) * radius;
vertex(sx, sy);
}
endShape(CLOSE);
}
void ntust(float logoX, float logoY, float colorR, float colorG, float colorB, float rotate, float size )
{
pushMatrix();
translate(logoX, logoY);
rotate(rotate);
strokeWeight(12*size);
stroke(255);
fill(colorR,colorG,colorB);
ellipse(0,0,240*size,240*size);
line(28*size,0,118*size,0);
polygon(-52*size, 0, 80*size, 6);
fill(255);
ellipse(-52*size,0,68*size,68*size);
popMatrix();
}
沒有留言:
張貼留言