Miranda-Luong-Project-04-String-Art

sketch

/* Miranda Luong
Section E
mluong@andrew.cmu.edu
Project-04-String-Art
*/

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

    //upper left curve
    for (var a = 150; a > 0; a -= 5){
        stroke(230);
        line (150,50+a,a,0)
    }
    //lower right curve
    for (var b = 150; b < height; b += 5){
        stroke(230);
        line (150,b-50,b,height);
    }

    push();
    translate(150,200)
    angleMode(DEGREES);
    rotate(360);

    //white bottom right curve
    for (var a = 150; a > 0; a -= 5){
        stroke(255);
        line (150,50+a,a,0)
    }
    pop();

    //white upper left curve
    for (var a = 150; a > 0; a -= 5){
        stroke(255);
        push();
        translate(150,200)
        angleMode(DEGREES);
        rotate(180);
        line (150,50+a,a,0);
        pop();
    }

    //background lines
    for (var c = 0; c < 300; c += 5){
        stroke(0);
        line (c, a, c, height);
    }
}

I found this assignment to be really challenging. For loops are definitely not easy to grasp. You would think you could easily manipulate positioning by just adding to x and y coordinates but it gets messy really fast.

Leave a Reply