Claire Yoon-Project 05 -Wallpaper

sketch

/* Claire Yoon
   claireyo@andrew.cmu.edu
   Section E
   Wall Paper */
    var pu;
    var pi;

    function setup() {
      createCanvas(640, 600);
      background(140,171,190);
      //gradient for lines
      pu = color(164, 168, 209);
      pi = color(187, 160, 178);
      setGradient(pu, pi);
    }
    function draw() {
      //vertical loop for pattern y
      for(var y = 20; y <= height; y += 50){
        //horizontal loop for pattern x
        for(var x = 20; x <= width; x += 50){
          //call pattern
          pattern (x,y);
        }
      }
      noLoop()
    }
    function pattern(x, y) {
      fill(209,242,255);
      strokeWeight(0);
      rect(x, y, 20, 20);

      noFill();
      stroke(194, 85, 100);
      strokeWeight(1.5);
      line(0, y - 15, width, y - 15);
      line(x - 15, 0, x - 15, height);
    }
    function setGradient(pu,pi) {
      //gradient for the background
      noFill();
      strokeWeight(1.5);
      for (var c = 0; c < height; c++ ) {
      var blend = map(c, 0, height, 0, 1)
      var m = lerpColor(pu, pi, blend);
      stroke(m);
      line(0, c, width, c);
    }
  }




//187,160,178
// stroke(164, 191, 235);
// strokeWeight(1);

It was fun to experiment with different shapes and lines and I got inspiration from the scaling on the turtle’s shell and further gave dimension by adding a gradient.

Leave a Reply