Project-04

line art frank

var numLines = 30

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


function draw() {

//top rock thing
    eastern(150,0,0,0, 0,0,0,50, 20)        //left top 
    eastern(150,0,300,0, 300,0,300,50, 20)      //left bottom
    eastern(0,50,0,100, 0,100,150,100, 20)      //right top
    eastern(300,50,300,100, 300,100,150,100, 20)        //right bottom
//middle rock thing

    eastern(150,100,-150,150, -150,150,150,200, 20) //left
    eastern(150,100,450,150, 450,150,150,200, 20)

//bottom rock thin
    eastern(0,200,150,200, 0,300,0,200, 20) //top left
    eastern(0,300,0,400, 0,400,150,400, 20) // bottom left
    eastern(150,200,300,200, 300,200,300,300, 20)           // top right
    eastern(150,400,300,400, 300,400,300,300, 20)           // bottom right


//middle traingle thing
eastern(0,300,300,300, 150,0,150,200, 4)
eastern(300,300,0,300, 150,0,150,200, 4)
eastern(300,300,0,300, 150,0,150,0, 3)
eastern(0,400,300,400, 300,0,0,0, 2)

}

function eastern(X1, Y1, X2, Y2, X3, Y3, X4, Y4, numLines) {

line(X1, Y1, X2, Y2) 
line(X3, Y3, X4, Y4)

    var dx1 = (X2 - X1)/numLines
    var dy1 = (Y2 - Y1)/numLines
    var dx2 = (X4 - X3)/numLines
    var dy2 = (Y4 - Y3)/numLines


    for ( var i = 0; i <= numLines; i ++) {
        line(X1, Y1, X3, Y3);
        X1 += dx1
        Y1 += dy1
        X3 += dx2
        Y3 += dy2
    }


}


Leave a Reply