Xiaoyu Kang – Project 04 – String Art

sketch

//Xiaoyu Kang
//xkang@andrew.cmu.edu
//Section B
//Project-04

var color = 10;
function setup() {
    createCanvas(400,300);
}

function draw() {
	background("black");
	for (var i = 0; i < width; i += 12){
	//curve set 1
        stroke(255,200 + i, mouseX);
        strokeWeight(1);
        line(i + mouseX,0, 0,300);
        line(i - mouseX,0,400,300);
    //curve set 2
        stroke(255,100 + i,200);
        strokeWeight(1);
        line(0,0,i + mouseX,400);
        line(400,0,i - mouseX,400);
    }
    for (var i = 0; i < width; i += 15){
    //curve set 3
        stroke(10,mouseX,255);
        strokeWeight(1);
        line(0 - i, height - mouseX, width + 1, i + mouseY);
        line(0 - i, height - mouseX, width + i, i - mouseY);
    //curve set 4
        stroke(10,mouseY,255);
        strokeWeight(1);
        line(width + i, height - mouseX, 0 - 1, i + mouseY);
        line(width + i, height - mouseX, 0 - 1, i - mouseY);
    }

}

For this project, I attempted weave different sets of strings together to create a complete image. I tried to link the string art’s color and position with the position of the mouse. So as the mouse moves, the strings’ position will be influenced by the mouse and will change color.

Leave a Reply