Project-04: String Art

Graham Murtha

Section A

This is the “complimentary eye of the storm”. I used 4 different variations of a base string code, each with different stroke weights and stroke colors for more variation. The numlines is set to 25.

sketch
// gmurtha Graham Murtha
// Section A

var dx1 = 0;
var dy1 = 0;
var dx2 = 0;
var dy2 = 0;
var numLines =25;

function setup() {
    createCanvas(300, 400);
    background(80,0,80); // dark purple

    for(var a = 0; a <= 360; a += 80){ //a = angle
        translate(width/2,height/2);
        line(0,125,25,-75); // base line 1
        line(25,25,125,0); //base line 2
        dx1 = (25-0)/numLines; //calculates difference between each string
        dy1 = (-75-125)/numLines; //calculates difference between each string
        dx2 = (125-25)/numLines; //calculates difference between each string 
        dy2 = (0-25)/numLines; //calculates difference between each string
        rotate(radians(a));
    }

}

function draw() {
    fill(255,255,200) // bright yellow
        circle(width/2,height/2,25);
    fill(80,0,80); //background color
    circle(width/2,height/2,10);

    translate(width/2,height/2);
    stroke(255,255,255); //white
    strokeWeight(1);
    for(var a = 0; a <= 360; a += 30){ // 12 shape variations fit
        var x1 = 125;
        var y1 = 75;
        var x2 = 75;
        var y2 = 125;
        for (var i = 0; i <= numLines; i ++) { //loops 25 times
            line(x1, y1, x2, y2);
            x1 += dx1;
            y1 += dy1;
            x2 += dx2;
            y2 += dy2;
        }
    rotate(radians(a));
    }

    stroke(255,255,100); //yellow
    strokeWeight(3);
    for(var a = 0; a <= 360; a += 45){ // 8 shape variations fit
        var x1 = 125;
        var y1 = 175;
        var x2 = 175;
        var y2 = 125;
        for (var i = 0; i <= numLines; i ++) {  //loops 25 times
            line(x1, y1, x2, y2);
            x1 += dx1;
            y1 += dy1;
            x2 += dx2;
            y2 += dy2;
        }
    rotate(radians(a));
    }

    stroke(200,0,200); //purple
    strokeWeight(2);
    for(var a = 0; a <= 360; a += 60){ //six shape variations fit
        var x1 = 125;
        var y1 = -125;
        var x2 = 75;
        var y2 = 75;
        for (var i = 0; i <= numLines; i ++) {  //loops 25 times
            line(x1, y1, x2, y2);
            x1 += dx1;
            y1 += dy1;
            x2 += dx2;
            y2 += dy2;
        }
    rotate(radians(a));
    }

    
    stroke(255,150,255); //bright purple
    strokeWeight(1);
    for(var a = 0; a <= 360; a += 90){ //four shape variations fit
        var x1 = 0;
        var y1 = 125;
        var x2 = 125;
        var y2 = 0;
        for (var i = 0; i <= numLines; i ++) {  //loops 25 times
            line(x1, y1, x2, y2);
            x1 += dx1;
            y1 += dy1;
            x2 += dx2;
            y2 += dy2;
        }
    rotate(radians(a));
    }

}

Leave a Reply