Skip to content

Round Corners

Shape operation that replaces sharp line-segment corners with smooth circular arcs. Works on polygonal shapes and primitive outlines.

Category: Shape Ops Menu path: Shape Ops > Round Corners

Ports

PortTypeDirectionDescription
shape_inshapeinputSource shape
outshapeoutputShape with rounded corners

Parameters

ParamTypeDefaultDescription
radiusscalar10Corner arc radius in comp pixels. Clamped to half of the shorter adjacent segment length, so very large values degenerate into maximum-roundness (arcs passing through segment midpoints) rather than overlapping neighboring corners
selectAttributestring""Optional per-vertex attribute name used to filter which corners round. Empty (default) rounds every eligible corner. When set, only corners whose scalar attribute value is >= selectThreshold are rounded. Missing or non-scalar attribute → treated as 0.0 (so a typo'd name rounds nothing, matching PointDelete's convention)
selectThresholdscalar0.5Threshold compared against the per-vertex attribute. Only used when selectAttribute is non-empty

Expose Channels

When enabled (E button on node header), adds input ports that override params via edge connections:

PortTypeOverrides
radius_inscalarradius

Useful for driving the corner radius from a Time ramp, a Math expression, or another scalar source.

How It Works

For each interior vertex where two straight line segments meet, Round Corners:

  1. Measures the two adjacent segment directions.
  2. Inset the vertex back by radius along each tangent — producing two new points.
  3. Connects the new points with a cubic bezier arc, using control-handle length r × (4/3) × tan(α/4) where α is the exterior angle (the industry-standard circular-arc bezier approximation).
  4. Substitutes the original vertex with these two new inset points + arc in the output path.

Curved segments (already bezier) pass through unchanged. Collinear joints (dot product > 0.9999) are skipped — no rounding needed. Open-path endpoints aren't rounded (no outgoing segment to pair with).

The radius is clamped per-corner to min(incoming_length, outgoing_length) / 2, so the inset never goes past a segment midpoint. This means asking for a very large radius just produces maximally-rounded corners; it won't introduce self-intersections.

Per-point attributes on the original shape are duplicated onto both inset points (the inset points inherit from the original corner vertex). The index attribute is rewritten as a clean 0..N sequence matching the new point count.

Usage Examples

Basic: Rounded rectangle

Rectangle → RoundCorners(radius: 20) → DrawShape. The rectangle's four corners become arcs.

Basic: Rounded polygon

Polygon(sides: 6) → RoundCorners → DrawShape. Each corner of the hexagon softens.

Creative: Stroke offset

Run the shape through RoundCorners before DrawShape's stroke to avoid harsh miter joins at low stroke widths.

Creative: Progressive rounding with keyframes

Animate radius from 0 → max over time. The corners smoothly soften into arcs. Since radius is clamped internally, there's no "flip-out" artifact when the animated value exceeds the corner's max.

Selective rounding: only outer star spikes

Polygon (sides: 10, alternating inset for a star) → ShapeAttributes (Custom target, attribute select, value 1 on odd vertices, 0 on even) → RoundCorners (selectAttribute: select, selectThreshold: 0.5) → DrawShape. Only the outer spikes round; the inner concave corners stay sharp.

Animated reveal: corners round one at a time

ShapeAttributes (Custom attribute keyed off a Time-driven counter) → RoundCorners (selectAttribute set). Drive the per-vertex selection mask from a keyframed scalar to roll rounding around the path.

Tips

  • Most primitives (Rectangle, Polygon, Line) already have a cornerRadius param built in — Round Corners is most useful on custom shapes (EditableShape, imported SVG, or the output of shape-op chains like ShapeAttributes).
  • Combine with ResampleShape upstream to force straight-line approximation on curved inputs before rounding — gives uniform rounding on any shape.
  • Path-level attributes (strokeWidth, opacity, color on path.attributes) are preserved untouched. Only point-level attributes are duplicated into new inset points.
  • Very small radii (< 1 px) are clamped to zero to avoid numerical artifacts.
  • Rectangle / Polygon — have built-in cornerRadius param that achieves the same effect cheaper at the primitive stage
  • ResampleShape — force polylinear approximation upstream to round a curved shape
  • ShapeDeform — per-vertex deformation; Round Corners is the structural cousin that changes topology