var hstep=20;//horizontal
var dstepX=10;//diagonal x
var dstepY=15;//diagonal y
function setup() {
createCanvas(640, 480);
}
function draw() {
background("lightpink");
stroke("white");
line(0,height/2,width,height/2);
var dxTL=310;//x of top left diagonal
var dyTL=1.5*dxTL-240;//y of top left diagonal
var x1=0;//x for top left
var dxBL=310;//x for bottom left diagonal
var dyBL=-1.5*dxBL+720;//y for bottom left diagonal
var x2=0;//x for bottom left
var dxTR=480;//x for top right diagonal
var dyTR=-1.5*dxTR+720;//y for top right diagonal
var x3=320;//x for top right
var dxBR=480;//x for bottom right diagonal
var dyBR=1.5*dxBR-240;//y for bottom right diagonal
var x4=320;//x for bottom right
var dxMTL=320;
var dyMTL=-1.5*dxMTL+720;
var dxMTR=480;
var dyMTR=1.5*dxMTR-240;
var dxMBL=320;
var dyMBL=1.5*dxMBL-240;
var dxMBR=480;
var dyMBR=-1.5*dxMBR+720;
var x=0;
var x5=640;
for (i=0; i<17; i++) {
stroke("white");
strokeWeight(1);
line(x1,height/2,dxTL,dyTL);//top left
x1=x1+hstep;
dxTL+=-dstepX;
dyTL+=-dstepY;
line(x2,height/2,dxBL,dyBL);//bottom left
x2=x2+hstep;
dxBL+=-dstepX;
dyBL+=dstepY;
line(x3,height/2,dxTR,dyTR);//top right
x3=x3+hstep;
dxTR+=-dstepX;
dyTR+=dstepY;
line(x4,height/2,dxBR,dyBR);//bottom right
x4=x4+hstep;
dxBR+=-dstepX;
dyBR+=-dstepY;
line(dxMTR,dyMTR,dxMTL,dyMTL);
dxMTL+=-dstepX;
dyMTL+=dstepY;
dxMTR+=-dstepX;
dyMTR+=-dstepY;
line(dxMBL,dyMBL,dxMBR,dyMBR);
dxMBL+=-dstepX;
dyMBL+=-dstepY;
dxMBR+=-dstepX;
dyMBR+=dstepY;
line(x5,0,x5,479);
x5=x5-hstep;
line(x,0,x,480);
x=x+hstep;
}
noLoop();
println();
}
For this project, I used straight lines and their tangents to form curves. The overall shape contains six modules.