|
|
Line 1: |
Line 1: |
| == Summary ==
| |
| void setup(){
| |
|
| |
| size(500,500);
| |
| background(255);
| |
|
| |
| }
| |
|
| |
| void draw(){
| |
| if (mousePressed);{
| |
| background(129, 130, 87);
| |
| noFill();
| |
| strokeWeight(4);
| |
| stroke(174, 221, 60);
| |
| }
| |
|
| |
| float o=60;
| |
| for(int x=0; x<500; x+=2*o+2*o*sin(PI/6)){
| |
| for(int y=0; y<500; y+=2*o*cos(PI/6)){
| |
|
| |
| drawHexagon(x, y, o);
| |
| drawHexagon(x+o+o*sin(PI/6), y+o*cos(PI/6), o);
| |
| }
| |
| }
| |
| }
| |
|
| |
| void drawHexagon(float x, float y, float radius) {
| |
|
| |
| pushMatrix();
| |
| translate(x, y);
| |
| beginShape();
| |
| for (int i = 0; i < 6; i++) {
| |
| pushMatrix();
| |
| float angle = PI*i/3;
| |
| vertex(cos(angle) * radius, sin(angle) * radius);
| |
| popMatrix();
| |
| }
| |
| endShape(CLOSE);
| |
| popMatrix();
| |
|
| |
| fill (mouseX, (mouseX+mouseY), mouseY);
| |
| ellipse ( x, y, 40, 40 );
| |
|
| |
|
| |
| float dimension = mouseX;
| |
|
| |
| if (mousePressed) {
| |
| ellipse (dimension,dimension,dimension,dimension);
| |
|
| |
| }
| |
| else {
| |
| stroke (0);
| |
| fill (255);
| |
| }
| |
| }
| |
|
| |
| == Copyright status: == | | == Copyright status: == |
|
| |
|
| == Source: == | | == Source: == |