Project-04-String-Art

sketch

var dx1;
var dy1;
var dx2;
var dy2;
var numLines = 50;

function setup() {
    createCanvas(400, 300);
    background(255, 243, 79);
}

function draw() {
//reference function
    for(var i = 0; i < 200; i ++){

        var x1 = 0;
        var x2 = i*width/25;
        var y1 = i*height/50;
        var y2 = height;

        strokeWeight (0.5); //set thickness of the line

        stroke(13, 66, 22); // right green center of the butterfly 
        line(200+x1,y1,x2+100, y2);

        stroke(13, 66, 22); // left green center of the butterfly
        line(400-(200+x1),y1,400-(x2+100), y2);


        stroke(138, 233, 255); // right blue center of the butterfly 
        line(200+x1,y1,x2+100, y2+50);

        stroke(138, 233, 255); // left green center of the butterfly
        line(400-(200+x1),y1,400-(x2+100), y2+50);



        stroke(209, 102, 255);
        line(350+x1,y1,x2+100, y2);

        stroke(209, 102, 255);
        line(400-(350+x1),y1,400-(x2+100),y2);

        stroke("magenta");
        line(x1,y1,x2,y2);

        stroke("magenta");
        line(x1,300-y1,x2,300-y2);

        stroke("magenta");
        line(400-x1,y1,400-x2,y2);

        stroke("magenta");
        line(400-x1,300-y1,400-x2,300-y2);

        var x1 = 0;
        var x2 = i*width/25;
        var y1 = i*height/70;
        var y2 = height;

        stroke("orange");
        line(x1,y2,x2,y1);

        stroke("orange");
        line(400-x1,y2,400-x2,y1);

    }
    noLoop();
}

Leave a Reply