//Min Young Jeong
//Section A 9:30am
//mjeong1@andrew.cmu.edu
//Project-04
function setup() {
createCanvas(400,300);
}
function draw() {
background(225);
strokeWeight(0.3);
var r = mouseX; //controls r vallue of color based on mouseX
var g = mouseY; //controls g vallue of color based on mouseY
for (i = 0; i < 100; i++) {
var x1 = 0;
var x2 = i * mouseX/40;
//x2 incrementally increases based on mouseX
var y1 = i * mouseY/30;
//y1 incrementally increases based on mouseY
var y2 = height;
stroke(r,g,100);
line(x1,y1,x2,y2); //lower left
line(width-x1,height-y1,width-x2,height-y2);//upper right
line(width-x1,height-y1,x2,y2); //lower right
line(x1,0,x2,height);//left "right triangle" geometry
line(width-x1,height,width-x2,0);//right "right triangle" geometry
}
}
For this assignment, I drew inspiration from wave. I created five different geometry using strings and made them intersection at some point to give some characteristic of the wave. Also, I wanted to create an interactive string art. Position of mouse controls distance and color of the strings.