ablackbu-project04-String-Art

*move mouse between red and blue

sketch

var A = 5

function setup() {
    createCanvas(400, 300);
    strokeWeight(2);
}

function draw() {
    background(200);
    for (var i = 1; i < 50; i ++) { //draw 50 diagonal lines
      stroke(25,173,210)
      line(A*i, 0, 15*i, 150); //top blue lines
      line(15*i, 150, A*i, 300); //bottom blue lines
      stroke(0)
      line(15*i, 0, A*i, 150); //top black lines
      line(A*i, 150, 15*i, 300); //bottom black lines
    
    }
    if (mouseX > width/2){ //in mouse goesto blue, lines are less slanted
        A = 10
    }else{A = 5} //if red the lines are origionaly slanted

    //draws that 50% opaque box's
    push()
    strokeWeight(0)
    fill(255,0,0,50)
    rect(0,0,width/2,height)
    
    fill(0,0,255,50)
    rect(width/2,0,width/2,height)
    pop()
}

I thought this project was very interesting. Unlike previous weeks, this project was more about learning to use the program, in this example with “for” statements. I wanted to make a very intricate web of lines and I wanted to make them move. I made it so the web looks far more concentrated when you drag your mouse from one side to the other.

Leave a Reply