Shirley Chen – Project – 05 – Wallpaper

sketch

// Shirley Chen
// Section B
// junfanc@andrew.cmu.edu
// Project-05



function setup() {
  createCanvas(600, 450);
  noStroke();
}
 
function draw() {
  background(255, 230, 178);
  noLoop();
  
//Draw the background dots pattern
  for (var y = 30; y < 450; y += 50) {
    for (var x = 30; x < 600; x += 50) {
      fill(137, 188, 157);
      ellipse(x, y, 4, 4);
    }
  }

//Draw the background orangle line pattern
  for (var y = 50; y < 450; y += 120) {
    for (var x = 50; x < 600; x += 120) {
      strokeWeight(4);
      stroke(252, 155, 85);
      line(x, y, x+4, y+2);
    }
  }
  
//Draw the background blue line pattern
  for (var y = 10; y < 450; y += 60) {
    for (var x = 20; x < 600; x += 200) {
      strokeWeight(2);
      stroke(129, 182, 211);
      line(x+5, y, x, y+7);
    }
  }

//Draw grid for the smiling watermelon
  for (var y = 0; y < 450; y += 80) {
    for (var x = 0; x < 600; x += 200) {
      noStroke();
      push();
      translate(x, y);
      drawMellon();
      pop();
    }
  }

//Draw grid for the screaming watermelon
  for (var y = 0; y < 450; y += 100){
    for (var x = 100; x < 600; x += 200){
      push();
      translate(x, y);
      drawTiltedMellon();
      pop();
    }
  }
}



function drawMellon(){
//Draw the skin of the watermelon
    fill(86, 135, 109);
    arc(50, 50, 60, 60, 0.2*PI, 0.45*PI);
//Draw the fruit of the watermellon
    fill(226, 133, 143);
    arc(50, 50, 50, 50, 0.2*PI, 0.45*PI);
//Drawing the face for the smiling watermellon
    stroke(6);
    strokeWeight(2);
    line(52, 58, 54, 62);
    line(56, 55, 60, 59);
    noFill();
    strokeWeight(1);
    arc(50, 50, 40, 40, 0.3*PI, 0.4*PI)


}

function drawTiltedMellon(){
//Draw the skin of the watermelon
    fill(86, 135, 109);
    arc(50, 50, 80, 80, 0.5*PI, 0.75*PI);
//Draw the fruit of the watermelon
    fill(226, 133, 143);
    arc(50, 50, 70, 70, 0.5*PI, 0.75*PI);
//Drawing the face for the screaming watermelon
    stroke(6);
    strokeWeight(2);
    line(40, 56, 43, 60);
    line(39, 62, 43, 60);
    line(50, 58, 46, 60);
    line(50, 62, 46, 60);
    fill(216, 55, 49);
    strokeWeight(1);
    ellipse(45, 70, 5, 10);
    noFill();
    strokeWeight(1);
    arc(45, 50, 40, 40, 0.3*PI, 0.4*PI)
    arc(50, 40, 50, 80, 0.5*PI, 0.65*PI)
}

For this wallpaper project, I created two variation of watermelon, smiling watermelon and screaming watermelon. I used the “for” loop command to create two sets of grid to define the position of the watermelon. And I add two kinds of faces on the watermelon. For the background, I also used “for” loop to add dot and line pattern with different color and stroke weight. In general, this project is very fun to work with and helps me get more practice on the “for” loop command.

Leave a Reply