mstropka-Project-04

sketch

//Max Stropkay
//Section E
//mstropka@andrew.cmu.edu
//Project-04


function setup() {
    createCanvas(400, 300);

}
function draw() {
  background(255);
  //draw ten lines from upper left corner
  //line spacing controled by mouseX and mouseY
  for(var i = 0; i < 10; i ++){
    line(0, 0, i*mouseX, mouseY);
  }
  //draw ten lines from upper right
  for(var i = 0; i < 10; i ++){
    line(400, 300 , i*mouseX, mouseY);
  }
  //draw ten lines from lower right
  for(var i = 0; i < 10; i ++){
    line(400, 0, i*mouseX, mouseY);
  }
  //draw ten lines from lower right
  for(var i = 0; i < 10; i ++){
    line(0, 300 , i*mouseX, mouseY);
  }


}

For this project, I tried doing something simple because I am still not 100% comfortable with loops. So I made a couple loops that generate lines that touch at the x and y values of the mouse.

Leave a Reply