Concentric
ri = r0 − i · spacing
Nested rounded rectangles look right when their corners share a centre. Build a stack, compare radius strategies, inspect the live geometry, and export code that matches the canvas.
rinner = router − spacingOnly true while the radius stays above the minimum and inside the layer bounds. The playground flags every exception.
Drag to move. Drag the r handles to change the outer radius. Scroll to zoom.
Each preset loads a real configuration into the canvas. Change anything afterwards.
Walk the stack. The canvas highlights the layer and the text uses the live numbers.
The outer shape sets the reference corner centre. Inner layers are judged against it.
Tip: hover any layer on the canvas to inspect it.
Four stacks with the same width, height, layer count, spacing and outer radius. Only the radius rule changes.
ri = r0 − i · spacing
Same radius on every layer; inner corners drift.
Every layer uses the fixed radius setting.
Radius scales with each layer width.
Comparison uses circular corners so the radius relationship is easy to see. Smooth mode is not included here.
Computed geometry for each nested layer.
| # | Inset | Size | Radius | Corner centre | Status | Drift |
|---|
The generated code uses the same computed radii as the canvas.
SwiftUI uses native RoundedRectangle and includes a verified ConcentricRectangle alternative for iOS 26+.
Loading geometry...
For a uniform inset s and circular corners, the inner radius is r − s and the corner centre stays at (r, r). This holds while the radius stays above the minimum and below half the layer shorter side.
If the mode formula would go below the minimum, the floor is applied after the fact and the corner centre moves. The inspector reports the drift in pixels instead of pretending the corner is still concentric.
The Minimum geometry mode uses half the layer shorter side, producing pill-shaped corners. Because a uniform inset shrinks the layer and the radius by the same amount, its corner centres stay aligned until the minimum floor or a layer bound interferes.
Smooth mode replaces each circular arc with a cubic Bézier corner. It is visually smoother, but it is not mathematically identical to a circular concentric corner, a true superellipse, or Apple continuous corner curve.
SwiftUI uses native RoundedRectangle and includes a verified ConcentricRectangle alternative for iOS 26+/macOS 26+. Compose draws the computed path because it has no concentric-corner primitive. CSS border-radius cannot express the cubic smooth path, so the CSS smooth export is labelled approximate; the SVG export is exact to the engine path.
The geometry engine is unit-tested in Node. The page runs without a framework or new runtime dependency. Exports are generated in the browser from the same geometry object used by the canvas.