dchikows – Section C – Project – 04 – String-Art

sketch

// David Chikowski
// Section C
// dchikows@andrew.cmu.edu
// Project-04 


function setup() {
    createCanvas(400,300);
    background(0,0,255);


    //top left line
    x1 = 0;
    y1 = height;
    x2 = 0;
    y2 = 0;
   
   //bottom right line 
    x3 = width
    y3 = height
    x4 = 0
    y4 = height

    //middle left line
    x5 = height
    y5 = width
    x6 = 0
    y6 = 0

    //middle right line
    x7 = height
    y7 = width
    x8 = 0
    y8 = 0

    //for loop for all lines 
    for (loop = 0 ; loop < 20 ; loop += 1) {

        //top left line
        stroke(255,0,0);
        line(x1, y1, x2, y2); 
        y1 -= height/10; 
        x2 += width/10; 

        //bottom right line 
        line(x3, y3, x4, y4);
        y3 -= height/10;
        x4 += width/10;

        //middle left line
        line(x5 -200, y5, x6, y6); //translates curve 200 points 
        y5 -= height/10;
        x6 += width/10;

        //middle right line
        line(x7 - 100, y7 + 150, x8, y8); //translates points 100 left, 150 down
        y7 -= height/10;
        x8 += width/10;




        
}


    
    }

I found this to be an interesting project to use for loops on. I believe it will be very useful in the future to use for loops for coding material similar to this since it can save a to of time.

Leave a Reply