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