HW #2


HW #2, Fan Lan, MLA 3rd-year, 09-01-19




void setup() {
  // set up a window
  size(1200, 580); // first is width, second is height
  // set background color
  background(255, 208, 126);
  noStroke(); // takes away outline to shapes in my window
  smooth();

  //draw sky
  fill (254, 238, 160);
  quad(0, 85, 1200, 103, 1200, 255,0, 188);
  fill (252, 252, 215);
  quad(0, 188, 1200, 255, 1200, 300,0, 360);

  //draw lawn
  fill (131, 252, 194);
  quad(0, 360, 1200, 300,  1200, 580, 0, 680);
  fill (219, 253, 138);
  quad(0, 480, 1200, 500,  1200, 580, 0, 680);

  //draw mountain
  fill (148, 167, 101);
  triangle(0, 360, 350, 108, 450, 338);
  fill (148, 167, 101);
  triangle(770, 321, 900, 128, 1100, 305);
  fill (184, 214, 112);
  triangle(250, 349, 429, 150, 500, 336);
  fill (184, 214, 112);
  triangle(890, 315, 1000, 158, 1200, 300);

  //draw river, borrow from J David Eisenberg's tutorial on processing.org
  int[] coords = {
  590, 332, 640, 390, 520, 450, 600, 550, 500, 690,
  650, 690, 690, 550, 610, 450, 700, 390, 660, 328,
  };

  fill (35, 223, 235);
  noStroke();
  beginShape();
  curveVertex(590, 332); // the first control point
  curveVertex(590, 332); // is also the start point of curve
  curveVertex(640, 390);
  curveVertex(520, 450);
  curveVertex(600, 550);
  curveVertex(500, 690);
  curveVertex(650, 690);
  curveVertex(690, 550);
  curveVertex(610, 450);
  curveVertex(700, 390);
  curveVertex(660, 328); // the last point of curve
  curveVertex(660, 328); // is also the last control point
  endShape();

  // Use the array to keep the code shorter;
  fill(0, 0, 0);
  noStroke();
  for (int i = 0; i < coords.length; i += 2) {
  ellipse(coords[i], coords[i + 1], 0, 0);
  }

  //draw road
  fill (245, 245, 245);
  quad(0, 440, 1200, 440,  1200, 500, 0, 480);
 
  //draw tree
  // draw trunk1
  fill(161, 113, 64);
  rect(200, 380, 12, 55);
  // draw canopy1
  fill (99, 117, 54);
  ellipse(200+6, 380, 50, 50);
 
  // draw trunk2
  fill(161, 113, 64);
  rect(270, 380, 12, 55);
  // draw canopy2
  fill (99, 117, 54);
  ellipse(270+6, 380, 50, 50);
 
  // draw trunk3
  fill(161, 113, 64);
  rect(340, 380, 12, 55);
  // draw canopy3
  fill (99, 117, 54);
  ellipse(340+6, 380, 50, 50);

  // draw trunk4
  fill(161, 113, 64);
  rect(860, 380, 12, 55);
  // draw canopy4
  fill (99, 117, 54);
  ellipse(860+6, 380, 50, 50);
 
   // draw trunk5
  fill(161, 113, 64);
  rect(930, 380, 12, 55);
  // draw canopy5
  fill (99, 117, 54);
  ellipse(930+6, 380, 50, 50);
 
  // draw trunk6
  fill(161, 113, 64);
  rect(1000, 380, 12, 55);
  // draw canopy6
  fill (99, 117, 54);
  ellipse(1000+6, 380, 50, 50);
 
  // draw sun
  fill (255, 234, 0);
  ellipse(615, 300, 40, 40);

  //write something in window
  fill(0, 102, 153);
  textSize(24);
  text("Hello Landscape!", 530, 190);
}


Comments

Popular posts from this blog

HW#3 - a

FP#1