let a = 0;
function setup() {
c = min(windowWidth, windowHeight);
createCanvas((c * 8.5) / 11, c, SVG);
noFill();
noLoop();
stroke(0);
angleMode(DEGREES);
}
function draw() {
translate(width / 2, height / 2);
for (let i = -10; i <= 10; i += 0.2) {
conchoid(a + i);
conchoid(a + i);
}
a = 9 * sin(50 / 100);
}
function conchoid(a) {
beginShape();
n = width / 25;
for (let i = -70; i < 70; i += 2) {
y = n * (1 / cos(i) + a * cos(i)) * cos(i);
x = n * (1 / cos(i) + a * cos(i)) * sin(i);
curveVertex(x, y);
if (i % 5 === 0) {
push();
translate(x, y);
rotate(-i);
pop();
}
}
endShape();
}
function keyPressed() {
save("drawing.svg");
}