hqq – secE – project05 – wallpaper

hamza

//hamza qureshi
//hqq@andrew.cmu.edu
//section e
//project 5: wallpaper
function setup(){
    createCanvas(480, 480);
    background(190, 235, 254);
  }

function draw(){
    noStroke();


    lineitup(); //calls the functions for the three main
    plane1();   //components to the pattern
    plane2();
    noLoop(); //makes sure  nothing is redrawn
  }

function lineitup(){                        //lines running through background
    for (var y = 0; y < 480; y += 3){       //defines spacing between lines
      push();
      if (y%2 == 0){
        var d = .25;
      }
      else if (y%2 == 1){
        d = 0.75;                           //allows for the horizontal lines
      }                                    //to change based on whether the
      strokeWeight(0.5);                   //y-value is even or odd
      stroke(255);
      line(0, y, width, y);                //draws horizontal lines
      stroke(160,165,205);
      strokeWeight(d);
      line(y,0,y,height);                 //draws vertical lines
      pop();                              //used push/pop to change strokes
    }
}

function plane1(){
    for (var x = 0; x < 450; x+= 75){              //draws first set of planes
      for (var y = 0; y < 500; y+= 100){           //restricts it to 5 rows and 6 columns
        var r = random(170,255);                   //allows subtle color change between each
        var b = random(200,250);                   //paper plane
        var p = 30+x;
        var q = 15+y;
        fill(r, 180, b);
        triangle(p+15,q+45, p+30,q, p+55,q+5);
        triangle(p+15,q+45, p+20,q, p,q+10);
        fill(r-50, 150, b-50);
        triangle(p+15,q+45, p+20,q, p+28,q+5);
      }
    }
  }

function plane2(){                               //draws second set of planes
    for (var x = 0; x < 450; x += 75){           //restricts it to 6 columns and 4 rows
        for (var y = 0; y < 400; y+= 100){
          var r = random(160,220);               //subtle color  change
          var b = random(120,200);
          var u = 40 + x;
          var v = 60 + y;
          fill(r, 220, b);
          triangle(u,v+30, u+40,v, u-10,v+15);
          triangle(u+5,v+35, u+40,v, u+30,v+35)
          fill(r-50, 180, r-50);
          triangle(u,v+30, u+40,v, u,v+40);
          triangle(u,v+40, u+5,v+35, u+10,v+35);
          }
        }
}

For this assignment, I was inspired by the whimsicality of paper planes and how evocative their folds can be. I decided to take the opportunity to use lines to mimic a subtle fold in the background, while using tones to exemplify the shading in the folds. Next time, I’d love to figure out a way to turn this into a non-static graphic that flies with the mouse.

Leave a Reply