Project-05-Wallpaper

sketch

//Jae Son, Section C, hyunjaes@andrew.cmu.edu,Project-05-Wallpaper

function setup() {
    createCanvas(600, 400);
    background(220);
}

function draw() {
  background(247,242,210); //beige background
  
  //columns of yellow square that have 2 squares
  for(y = 100; y <= 300 ; y += 200){
    for(x=0; x <= 600 ; x += 200){
      push();
      yellowbox(x,y);
      pop();
    }
  }
  
  //columns of yellow square that have 3 squares
  for (y = 0 ; y <= 400; y+=200){
    for (x=100; x < 600 ; x +=200) {
      push();
      yellowbox(x,y);
      pop();
    }
  }

  //green line that is rotated 7*PI/4
  for (y = 80; y >= -165; y -= 75){
    for (x = 142; x <= 568; x +=142){
      push();
      greenline(x,y);
      pop();
    }
  }
  
  //green line that is rotated PI/4
  for (x = -142; x <= 284; x +=142){
    push();
    greenline2(x,340);
    pop();
  }
  
  //columns of yellow square that have 2 squares
  for (y = 95; y <= 295; y += 200){
    for (x = -12; x <= 588; x +=200){
      push();
      heart(x,y);
      pop();
      }
    }
 
  //columns of heart shapes that have 3 heart shapes
  for (y = -5; y <= 395; y +=200 ){
    for(x=88; x<=488; x +=200){
      push();
      heart(x,y);
      pop();
    }
  }
  
}
  

//yellow sqaure  
function yellowbox(x,y) {
  noStroke();
  rectMode(CENTER);
  translate(x,y);
  rotate(PI/4);
  fill(248,228,87);
  rect(0,0,90,90);
}

//green line 
function greenline(x,y){
  noStroke();
  rectMode(CENTER);
  rotate(PI/4);
  translate(x,y);
  fill(180,223,90);
  rect(0,0,16,680);
}

//green line
function greenline2(x,y){
  noStroke();
  rectMode(CENTER);
  rotate(7*PI/4);
  translate(x,y);
  fill(180,223,90);
  rect(0,0,16,750);
}

//heart shape
function heart(x,y){
  noStroke();
  translate(x,y);
  fill(237,132,103);
  ellipse(0,0,34,34);
  ellipse(25,0,34,34);
  triangle(-14,10,12,37,38.5,10);
}

sketch I draw on ipad before coding

Leave a Reply