|
- void setup(){
- size(600,600);
- }
- void draw(){
- background(255);
- hexagon(200,200,80);
- }
- void hexagon(float x, float y, float r){
- pushMatrix();
- translate(x,y);
- beginShape(POLYGON);
- for(float angle = 0;angle<=PI*2;angle+=PI/3){
- vertex(r*cos(angle),r*sin(angle));
- }
- endShape();
- popMatrix();
- }
複製代碼 |
|