Taisei Manheim – Project 04 – String Art

sketch

//Taisei Manheim
//Section C
//tmanheim@andrew.cmu.edu
//Assignment-04

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

function draw() {
    var x = 0; //used to define color
    background(0);
    strokeWeight(1);
    stroke(255);
    for (var i = 0; i < 400; i+=10){
        stroke(255);
        line(0, height - i, i, 0); //top left curved lines
        
        line(i, i, width, height -i); //top half of bottom right curved lines
        line(i, i, width - i, height); //bottom hald of bottom right curved lines

        //changes lines from white to magenta depending on mouse location
        if (mouseX > width / 2) {
            x = 0;
        }
        if (mouseX <+ width / 2) {
            x = 255;
        }

        //lines that turn magenta
        stroke(255, x, 255);
        line(0, height, i, i); //bottom left
        line(width, 0, i, i); //top right

        //sky blue lines
        stroke(135, 206, 235);
        line(width, height, 0, i); //bottom half
        line(0, 0, width, i); //top half
    }

}

When creating this I tried to create a fairly balanced composition with some areas having a denser amount of lines and some areas having not as many lines. I wanted to have some element of color change in order to change the way you perceive the drawing.

Leave a Reply