Project 04: String Art

sketch
//Julianna Bolivar
//jbolivar
//Section D
//Program: String Art


var dx1;
var dy1;
var dx2;
var dy2;

var dx3;
var dy3;
var dx4;
var dy4; 

var dx5;
var dy5;
var dx6;
var dy6; 



var numLines = 50;

function setup() {
    createCanvas(300, 400);
    background(244, 235, 232);
    //hot pink
    stroke(222, 49, 99);
    //right most lines
    line(300, 300, 350, 300); 
    dx1 = (250)/numLines;
    dy1 = (290)/numLines;
    dx2 = (100)/numLines;
    dy2 = (290)/numLines;
    //left most lines
    dx3 = (150)/numLines;
    dy3 = (320)/numLines;
    dx4 = (90)/numLines;
    dy4 = (90)/numLines;
    //overlapping lines
    dx5 = (150)/numLines;
    dy5 = (320)/numLines;
    dx6 = (90)/numLines;
    dy6 = (90)/numLines;
}

function draw() {
    //right most lines
    var x1 = 50;
    var y1 = 10;
    var x2 = 200;
    var y2 = 200;
    //left most lines
    var x3 = 0;
    var y3 = 200;
    var x4 = 220;
    var y4 = 350;
    //overlapping lines
    var x5 = 40;
    var y5 = 200;
    var x6 = 220;
    var y6 = 350;

    for (var i = 0; i <= numLines; i += 1) {
        line(x1, y1, x2, y2);
        line(x3, y3, x4, y4);
        line(x5, y5, x6, y6);

        x1 += dx1;
        y1 += dy1;
        x2 += dx2;
        y2 += dy2;

        x3 -= dx3;
        y3 -= dy3;
        x4 += dx4;
        y4 += dy4;

        x5 -= dx5;
        y5 -= dy5;
        x6 += dx6;
        y6 += dy6;   
    }

    noLoop();
}


Mine is quite simple, I wanted to have an interaction or at least have a variety of colors but I couldn’t get it to work in time. I knew I wanted the strings to work vertically, and the overlapping strings was a mistake I ended up liking.

Leave a Reply