I just made a rainbowy web of strings that changes colors depending on mouseX and mouseY. Credit to the person that utilized rotate and translate to move stuff around, it made things a lot simpler to think about.
// William Su
// Section E
// wsu1@andrew.cmu.edu
// Project 04
function setup () {
createCanvas(400, 300);
background(0);
strokeWeight(0.5);
}
function draw () {
for (var x = 0; x <= 50; x += 2) {
var1 = x
var2 = x * 10
b = constrain(var2, 0, (3 * width) / 5);
//bottomleft
stroke(mouseX, 0, 50);
line(0, var2 + height / 2, var2, height);
//topleft
push();
translate(300, 0);
rotate(radians(90));
stroke(mouseY, 0, mouseX);
line(0, var2 + height / 2, var2, height);
pop();
//topright
push();
translate(400, 300);
rotate(radians(180));
stroke(mouseY, mouseX, 50);
line(0, var2 + height / 2, var2, height);
pop();
//bottom right
push();
translate(100,300);
rotate(radians(270));
stroke(mouseX, mouseY, 50);
line(0, var2 + height / 2, var2, height);
pop();
//2ndCurveTopRight
stroke(50,mouseX, mouseY);
line(width * 1.2, var2, var2 /2, 0);
//2ndCurveBottomLeft
push();
translate(400, 300);
rotate(radians(180));
stroke(50,mouseY, mouseX);
line(width * 1.2, var2, var2 /2, 0);
pop();
};
}