/**
Hexagon Wheel
Kawandeep Virdee
**/
int width=600;
int height=600;
int R = 200;
float t=0;
boolean saveFrames=false;


void setup() {
  colorMode(HSB, 360, 100, 100, 100);
  size(width, height);
  frameRate(15);
  smooth();
  background(0, 0, 100);
}

void draw() {
  noStroke();
  fill(0, 0, 100, 11);
  rect(0, 0, width, height);

  for (int i=0;i<6;i++) {
    pushMatrix();
    float cx= width/2+R/2*cos(i*PI/3);
    float cy= height/2+R/2*sin(i*PI/3);
    translate(cx, cy);

    float x1 = -R/2*cos(i*PI/3);
    float y1 = -R/2*sin(i*PI/3);
    PVector v = new PVector(x1, y1);

    v.rotate(t);
    x1 = v.x;
    y1 = v.y;
    v.rotate(radians(120));
    float x2 = v.x;
    float y2 = v.y;
    v.rotate(radians(120));
    float x3 = v.x;
    float y3 = v.y;

    stroke(0, 0, 0);
    fill(0, 0, 100);
    triangle(x1, y1, x2, y2, x3, y3);   
    popMatrix();
  }
  t+=0.1;
  t%=(2.1);

  if (saveFrames) {
    save("images/"+str(int(t*10))+".png");
  }
}

void keyPressed() {
  if (key == CODED) {
    if (keyCode == UP) {
      println("Start saving frames");
      saveFrames=true;
    } 
    else if (keyCode == DOWN) {
      println("Stop saving frames");
      saveFrames=false;
    }
  }
}
/**
Hexagon Wheel
Kawandeep Virdee
**/
int width=600;
int height=600;
int R = 200;
float t=0;
boolean saveFrames=false;


void setup() {
  colorMode(HSB, 360, 100, 100, 100);
  size(width, height);
  frameRate(15);
  smooth();
  background(0, 0, 100);
}

void draw() {
  noStroke();
  fill(0, 0, 100, 11);
  rect(0, 0, width, height);

  for (int i=0;i<6;i++) {
    pushMatrix();
    float cx= width/2+R/2*cos(i*PI/3);
    float cy= height/2+R/2*sin(i*PI/3);
    translate(cx, cy);

    float x1 = -R/2*cos(i*PI/3);
    float y1 = -R/2*sin(i*PI/3);
    PVector v = new PVector(x1, y1);

    v.rotate(t);
    x1 = v.x;
    y1 = v.y;
    v.rotate(radians(120));
    float x2 = v.x;
    float y2 = v.y;
    v.rotate(radians(120));
    float x3 = v.x;
    float y3 = v.y;

    stroke(0, 0, 0);
    fill(0, 0, 100);
    triangle(x1, y1, x2, y2, x3, y3);   
    popMatrix();
  }
  t+=0.1;
  t%=(2.1);

  if (saveFrames) {
    save("images/"+str(int(t*10))+".png");
  }
}

void keyPressed() {
  if (key == CODED) {
    if (keyCode == UP) {
      println("Start saving frames");
      saveFrames=true;
    } 
    else if (keyCode == DOWN) {
      println("Stop saving frames");
      saveFrames=false;
    }
  }
}

  1. cosmospie reblogged this from spring-of-mathematics
  2. dly-shu reblogged this from spring-of-mathematics
  3. truenoodle reblogged this from spring-of-mathematics
  4. spring-of-mathematics reblogged this from whichlight
  5. whhhhiskey reblogged this from geometryofdopeness
  6. hollogen reblogged this from chlofun
  7. chlofun reblogged this from absenceofrainbow
  8. beetree reblogged this from hexagonalawarenessproject
  9. magisterlupus reblogged this from hexagonalawarenessproject
  10. heknowkey reblogged this from defff-beats
  11. pepperminthurl reblogged this from xiamthecheshirecatx
  12. xiamthecheshirecatx reblogged this from defff-beats
  13. defff-beats reblogged this from hexagonalawarenessproject
  14. lezleypaige reblogged this from allseeingpyramid
  15. fashionvictimclothing reblogged this from delya
  16. likethisonelikethatone reblogged this from delya
  17. allseeingpyramid reblogged this from hexagonalawarenessproject
  18. delya reblogged this from hexagonalawarenessproject
  19. thisisntmyrealhair reblogged this from hexagonalawarenessproject
  20. hexagonalawarenessproject reblogged this from whichlight
  21. nikky237 reblogged this from geometryofdopeness
  22. thekingdomofmali reblogged this from geometric-aesthetic
  23. three-edged-sword reblogged this from geometric-aesthetic
  24. waynevstheworld reblogged this from geometryofdopeness
  25. geometryofdopeness reblogged this from geometric-aesthetic