//Mihika Bansal
//mbansal@andrew.cmu.edu
//Section E
//Project 4
var x1Step = 5;
var y1Step = 5;
function setup() {
createCanvas(400, 300);
}
function draw() {
background (255);
fill(0);
rect(50, 0, 300, 300);
stroke(255, 251, 217);
for(var j = 1; j <= 30; j++){
line(50, 0 + y1Step * j, width / 2 - x1Step * j, 0);
} // curve with flats on left and top in the top left curving downwards
for(var j = 1; j <= 30; j++){
line(50, height - y1Step * j, width / 2 - x1Step * j, height);
} // curve with flat on left and bottom, bottom left, curving upwards
for(var j = 1; j <= 30; j++){
line(width - 50, height / 2 - y1Step * j, width - 50 - x1Step * j, 0);
} // curve with flat on top and right, top right, curving downwards
for(var j = 1; j <= 30; j++){
line(width - 50, height / 2 + y1Step * j, width - 50 - x1Step * j, height);
} // curve with flat on right and bottom, bottom right, curving upwards
stroke("white");
for(var i = 1; i <= 30; i++){
line(width / 2, 0 + y1Step * i, width / 2 + x1Step * i, height / 2);
} //curve starting in middle on top right, curving upwards, flat side is in middle of canvas
for(var x = 1; x <= 30; x++){
line(width / 2, height - y1Step * x, width / 2 + x1Step * x, height / 2);
} // curve starting in the middle on bottom right, curving downwards, flat sides are on the middle of canvas
for(var x = 1; x <= 30; x++){
line(50 + x1Step * x, 0, width / 2, 0 + y1Step * x);
} //curve on top left , with flat part on top and middle, curving downwards
for(var x = 1; x <= 30; x++){
line(50 + x1Step * x, height, width / 2, height - y1Step * x);
} // curve on bottom left, with flat on bottom and middle, curving downwards
stroke (194, 237, 231)
for(var j = 1; j <= 30; j++){
line(width / 2, 0 + y1Step * j, width / 2 - x1Step * j, height / 2);
} // curve in top left, with flat part in middle on both sides, curving upwards
for(var j = 1; j <= 30; j++){
line(width / 2, height / 2 + y1Step * j, width / 2 + x1Step * j, height);
} // curve in bottom left, with flat in middle, curving downwards
for(var j = 1; j <= 30; j++){
line(50 + x1Step * j, height / 2, width / 2, height / 2 + y1Step * j);
} // curve with flat in the middle and bottom, in the bottom right, curve upwards
for(var j = 1; j <= 30; j++){
line(width / 2 + x1Step * j, 0, width / 2, height / 2 - y1Step * j);
} // curve with flats on the top and the middle, in the top right, curve downwards
stroke(252, 204, 212);
for(var j = 1; j <= 30; j++){
line(50, height / 2 - y1Step * j, width / 2 - x1Step * j, height / 2);
} // flat on the left side and the middle, curve upwards, in the top left
for(var j = 1; j <= 30; j++){
line(50, height - y1Step * j, 50 + x1Step * j, height / 2);
} // flat on the left and the middle, in the bottom left, curve downwards
for(var j = 1; j <= 30; j++){
line(width - 50, height / 2 - y1Step * j, width / 2 + x1Step * j, height / 2);
} // flat on the middle and middle, in the top right, curving upwards
for(var j = 1; j <= 30; j++){
line(width - 50, height - y1Step * j, width - 50 - x1Step * j, height / 2);
} // flat on the right and the middle, in the bottom right, curbing downwards
}
I really enjoyed this project. I have made string art before by hand using the actual string and nails and wood, so it was interesting making it through the computer this time.