function setup() {
createCanvas(400, 300);
background(255);
}
var x1 = 0;
var y1 = 0;
var x2 = 0;
var y2 = 300;
var lim = 101;
var quality = 1;
function draw() {
background(255);
//change the number of lines (the quality of the curves)
lim += quality;
if (lim == 100) {
quality = -quality;
} else if (lim == 150) {
quality = -quality;
}
//draw 8 curves
for (c = 1; c <= 8; c++) {
//draw "lim" number of lines in each curve
for (i=0; i<=lim; i++) {
x1 = (width/lim) * i;
x2 = (width/lim) * (lim - i);
y1 = x2;
y2 = 50 * c;
//make the curves different shades of gray
stroke( (255/9) * c );
line(x1,y1,x2,y2);
}
}
}
String art is really hard, I literally could not figure out how my curves were going to look. I ended up choosing this one because it was visually appealing and seemed interesting.