To draw a rectangle with vaiant radii we need to use s combination od the SVG path commands:
Drawing arcs using the
This example draws an arc from the point 50,50 to the point 100,100 (specified last in the A command).
The radius of the arc is set by the two first parameters set on the A command. The first parameter is rx (radius in x-direction) and the second is ry (radius in y-direction). Setting rx and ry to the same value will result in a circular arc. Setting rx and ry to different values will result in an elliptical arc. In the example above rx was set to 30 and ry to 50.
The third parameter set on the A command is the x-axis-rotation. This sets the rotation of the arc's x-axis compared to the normal x-axis. In the above example the x-axis-rotation is set to 0. Most of the time you will not need to change this parameter.
The fourth and fifth parameters are the large-arc-flag and sweep-flag parameters. The large-arc-flag determines whether to draw the smaller or bigger arc satisfying the start point, end point and rx and ry
Now it is time to combine the four previous path commands to draw a rounded corners rectangle:
As the colored segments showing, the rectangle has been drawn segment by segment. Here are the drawing steps:
The code is hosted on Google Colab here. You can try it dirctly.