Title courtesy of Greg Martin
For this challenge, I'll define an arc of size \$k\$ as a single piece of a sine wave with a length of \$k\$ units and an height of \$\frac{k}{4}\$ units:
And I'll define a swoosh of order \$1\$ and \$2\$ as a single arc of size 1, and recursively define a swoosh of order \$k\$ as a swoosh of order \$k-1\$ followed by a flipped swoosh of order \$k-2\$, with an arc the same length as the previous two swooshes laid end-to-end.
For example, here are the swooshes of order 3, 4, 5, and 6:
You might notice that the length of a swoosh of order \$n\$ is the \$n\$th fibonacci number, hence the name.
Reference implementation:
let ctx = c.getContext('2d') const scale = 30; let drawArc = (length, offset = 0, amp = 1) => { ctx.moveTo(offset * scale, c.height / 2) for (i = 0; i <= scale * length; i++) { ctx.lineTo(i + offset * scale, -Math.sin(Math.PI * i / (scale * length)) * amp * length * scale / 4 + c.height / 2) } ctx.stroke() } fib = n => fib[n] ||= n <= 2 ? 1 : fib(n - 1) + fib(n - 2) let swoosh = (order, offset = 0, amp = 1) => { if (order <= 2) { drawArc(1, offset, amp); } else { swoosh(order - 1, offset, amp) swoosh(order - 2, offset + fib(order - 1), -amp) drawArc(fib(order), offset, amp) } } swoosh(8) <canvas width=1000 height=500 id=c></canvas> Your challenge is to, given an integer \$n\$, draw a fibonacci swoosh of order \$n\$ as defined above, either outputting to an image file or drawing on the screen. You may use 0-indexing or 1-indexing. It's fine if the size of your answer's output is limited by screen/canvas size, but your answer should be able to handle at least \$n=6\$, and each arc should be at least 10 pixels wide onscreen. Each arc should be recognisable as a sine curve.
This is code-golf, shortest wins!
Testcases
Here's a higher-resolution image for n=6:















