Week 5

by Jingyi Tang

Pattern by random ellipses.

  • Show Sketch
/** @peep sketchcode */
void setup() {
  size(500, 500);
  ellipseRecursion(0, 0, width, height);
}
 
void ellipseRecursion(float x, float y, float w, float h) {
 
  fill(random(255));
  noStroke();
  ellipse(x, y, w, h);
 
 
  if ((random(100) < 80) && (w > 10 || h > 10)) {
 
    float bx = 3;
    float by = 3;
 
    w = (w - 3*bx) / 2;
    h = (h - 3*by) / 2;
 
    ellipseRecursion(x + bx, y + by, w, h);
    ellipseRecursion(x + bx + w + bx, y + by, w, h);
    ellipseRecursion(x + bx, y + by + h + by, w, h);
    ellipseRecursion(x + bx + w + bx, y + by + h + by, w, h);
  }
}

And Falling snowflake, single branch for now :)

  • Show Sketch
/** @peep sketchcode */
float y = 0;
 
void setup() {
  size(200, 200);
  background(0);
  stroke(255);
  strokeWeight(1);
}
 
void draw() {
  fill(0, 8);
  rect(0, 0, width, height);
  fill(255);
  line(width/2,y+10,width/2,y+30); //draw single branch
  noFill();
  ellipseMode(CENTER); 
  ellipse(width/2,y+6,6,6);
  ellipse(width/2+8,y+10,5,5);
  ellipse(width/2-8,y+10,5,5);
  line(width/2,y+15,width/2+3,y+10);
  line(width/2,y+15,width/2-3,y+10);
  line(width/2,y+20,width/2+5,y+15);
  line(width/2,y+20,width/2-5,y+15);
  line(width/2,y+27,width/2+8,y+20);
  line(width/2,y+27,width/2-8,y+20);
  y += 0.5;
}

Comments

Nobody has said anything yet.