For what it's worth, SVG does also directly support circular or elliptical arcs, as an alternative to a parametric-cubic approximation. Though there are plenty of contexts where sticking to Bézier curves is preferable, e.g. in drawing software where the resulting curve should be user editable afterward.
Indeed, my goal was definitely to keep things editable and to explain how to do it when you don't have access to an Arc command. And also because, I have to admit, it was just fun to do :)
You’re right, it’s not completely explicit, in our particular case it's just the value set with the `Maximum length` slider. Although, I edited to notebook to develop a bit more.
Does that help, David?
This is so awesome.
A very important piece of the calculation is
const boxWidth = svgWidth;
const convertToSvgCoord = (valueRadius) => (valueRadius / boxWidth) * viewBoxWidth;
However, I am working outside of Observable and my svg is constructed with only viewBox; therefore I can't obtain the ratio of radius to svgWidth.Is there a way to account for such scenarios in the code.
Thank you in advance.
Sorry for the delay, I guess you could get the element dimensions by using element.getBoundingClientRect() and use these to compute the appropriate ratio.
Let me know if that helps!