//Grace Wanying Hou
//15-104 Section D
//ghou@andrew.cmu.edu
//Assignment 04
// increases
var inc = 15;
var xint = 15;
// positions
var x1 = 1;
var y1 = 499;
var x2 = 499;
var y2 = 1;
//colours
var lr;
var lg;
var lb;
function setup(){
createCanvas(500,500);
background(0);
}
function draw() {
var m = mouseX/25; // colour gets "redrawn" and changes with mouse
for(var i = 0; i < m; i += 1) {
strokeWeight(1);
lr = i*mouseX/2-500;
lg = i*mouseY/2;
lb = i*-mouseY/2+600;
stroke(lr,lg,lb); //white
line(x1, inc * i, inc * i, y1); //bottom left
line(inc * i, y1, x2, y1 - inc * i); //bottom right
line(x2 - inc * i, y2, x2, y1 - inc * i); //top right
line(x2 - inc * i, y2, x1, inc * i); //top left
}
}
I wanted to create something interactive or something that changes. I always found string art really cool especially the optical illusions. This piece was a little challenging to put together because of the amount of variables it required it gets a little bit confusing