PROJECT 04 – STRING ART

sketch
var dx1;
var dy1; 
var dx2;
var dy2;
var numLines = 40;

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

    line(400, 150, 400,  300)

    dx1 = (0 - 0)/numLines;
    dy1 = (200 - 0)/numLines;
    dx2 = (300 - 200)/numLines;
    dy2 = (50 - 400)/numLines;
}

//setting variables
function draw() {
    var x1 = 0;
    var y1 = 0;
    var x2 = 400;
    var y2 = 300;
    var x3 = 0;
    var y3 = 0;
    var x4 = -100;
    var y4 = height;
    var x5 = width;
    var y5 = height;

//blue and pink gradient
    for (var i = 0; i <= numLines; i += 1) {
        stroke(225-i*10, 125-i*10, 225  );
        line(x1, y1, x2, y2);
        x1 += dx1;
        y1 += dy1;
        x2 += dx2;
        y2 += dy2;
    }

//orange and green gradient
    for (var j = 0; j <= 60; j ++) {
        stroke(100+j*10, 200, 140);
        line(x4, height, width, y4);
        x4 += width/20;
        y4 -= height/20;
    }

//green on bottom left
    for (var k = 0; k <= 30; k ++) {
        stroke(25, 255, 255-k*10);
        line(0, y3, x3, height);
        x3 += width/20;
        y3 += height/20;
    }

//pink top left
    for (var z = 0; z <= 20; z ++) {
        stroke(100+z*10, 0, 140);
        line(x5, 0, width, y5);
        x5 -= width/20;
        y5 -= height/20;
    }

}

For this project, I really wanted to test out how curvatures can warp lines into creating new dimensions. I also tried to emphasize the depth by using gradients.

Leave a Reply