Romi Jin – Project-04-String-Art-Section B

sketch

 /*
Romi Jin
Section B
rsjin@andrew.cmu.edu
Project-04
*/

// spacing variables
var space1 = 5; 
var space2 = .01;

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

function draw() {

// middle mouse strokes
    stroke(180);
    strokeWeight(0.1);
    line(mouseX, height, 0, mouseY);


// bottom left
    for (var y = 0; y < width; y += space1) {
        stroke(245,195,194);
        strokeWeight(0.1);
        line(y, height, 0, y);
    }

// top right
    for (var z = 0; z < width; z += space1) {
        stroke(253,185,200);
        strokeWeight(0.1);
        line(z, 0, width, z);
    }

// top left
    for (var a = 0; a < 10; a +=space2) {
        stroke(254,127,156);
        strokeWeight(0.1);
        push();
        var x = lerp(width, 0, a);
        var y = 0;
        var x2 = 0;
        var y2 = lerp(0, height, a);
        line(x, y, x2, y2);
        pop();
    }

// bottom right
    for (var b = 0; b < 10; b += space2) {
        stroke(253,171,159);
        strokeWeight(0.1);
        push();
        var x = width;
        var y = lerp(0, height, b);
        var x2 = lerp(width, 0, b);
        var y2 = height;
        line(x, y, x2, y2);
        pop();
    }



}

I wanted to make a several pink curves at each corner and interactive strokes in the middle (if you move your mouse over the image, it will draw gray lines in the center of the four curves).

Leave a Reply