Kristine Kim – Project – 04- String Art

sketch

//Kristine Kim
//section D
//younsook@andrew.cmu.edu
//Project-04-String-Art

var bright = 0;

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

function draw() {
  //background is fading from black to white and 
  //when it turns white, it goes back to black and fad  
    
   background(bright);
    bright = bright + 1;
    if (bright == 255){
        bright = 0
     }
    
//all the colors are controlled by mouseX and mouseY
   
   for(var i = 0; i<= 400; i+= 15){
// the top right corner web
        stroke(26, 9, mouseX);
        line(i, 0, 400, i);
// the bottome left corner web
        stroke(mouseX, 9, 217);
        line(0, i, i - 5, height);
//the bigger web that covers half of the canvas diagonally
        stroke(0, mouseX, 217);
        line(400, -i, i + 5, height);
//the  right 
        stroke(100, mouseY, 200);
        line(mouseX, mouseY, 400, i);

        stroke(100, mouseY, 200);
        line(0, i, mouseX, mouseY);
    }
     
//moueseX and mouseY controlling the vertical lines
    for(var i = 0; i < 400; i += 18){  
        strokeWeight(1.5);
        stroke(255);

        line(mouseX, i * 3, width / 2, i - 10);
        stroke(247, 255, 140);
        line(mouseX, i * 3, mouseY + 50, i - 10);
        stroke(247, 255, 140);
        line(mouseX, i * 3, mouseY - 50, i - 10);
   }
}

This project was both very fun and challenging. I played around with different functions and codes that we learned in the previous weeks, such as fading background, mouseX mouseY, etc.

Leave a Reply