//Base code for 6th grade snowflake exercise - fall 2015 - ZJ Wood
//Instructions: fill in the drawCorner routine to make the snowflake more interesting
//in general your coordinates for the various shapes should be in the 0-50 range
//try using ellipse(x, y, width, height)
//or triangle(x0, y0, x1, y1, x2, y2);
//or line(x0, y0, x1, y1);
//or rect(x, y, width, height);
//whatever you draw in will be mirrored symmetrically to make a complete snowFlake


void drawCorner() {
  strokeWeight(3);
  fill(255);
  stroke(255);
  line(0, 0, 40, 40);
  ellipse(40, 40, 20, 20);

  //TODO: add other shapes here!!!
  
  
  
  
}


boolean animate;
boolean many;
boolean done;
int ty;

void setup() {
  size(800, 800);
  smooth();
  done = false;
  if (done) {
    animate = true;
    many = true;
  } else {
    animate = false;
    many = false;
  }
  ty = 0;
}

void draw() {
  background(12, 34, 56);

  if (!done) {
    drawSnowFlake(400, 400, 1);
  } else {
    text("Happy Winter!", 40, 40);
    for (int j=0; j < 3; j++) {
      for (int i=0; i < 20; i++) {
        drawSnowFlake(j*15+i*50, ty-j*50, .2);
      }
    }
  }

  if (animate) {
    ty += 1;
  } else {
    noLoop();
  }
}

void drawSnowFlake(int tx, int ty, float scaleS) {
  pushMatrix();
  translate(tx, ty);
  scale(scaleS);
  if (done) {
    rotate(radians(ty));
  }
  drawCorner();
  pushMatrix();
  scale(1, -1);
  drawCorner();
  popMatrix();
  pushMatrix();
  scale(-1, 1);
  drawCorner();
  popMatrix();
  pushMatrix();
  scale(-1, -1);
  drawCorner();
  popMatrix();
  popMatrix();
}