Rectangle
Generates a rectangular shape with optional rounded corners.
Category: Shapes Menu path: Shapes > Rectangle
Ports
| Port | Type | Direction | Description |
|---|---|---|---|
out | shape | output | Rectangle shape data |
Parameters
| Param | Type | Default | Description |
|---|---|---|---|
width | scalar | 200 | Width in pixels |
height | scalar | 200 | Height in pixels |
cornerRadius | scalar | 0 | Corner rounding radius in pixels (0 = sharp corners) |
Expose Channels
When enabled (E button on node header), adds input ports that override params via edge connections:
| Port | Type | Overrides |
|---|---|---|
width_in | scalar | width |
height_in | scalar | height |
cornerRadius_in | scalar | cornerRadius |
How It Works
Generates a closed rectangular path centered at the origin in local space. When cornerRadius is greater than zero, the corners are replaced with circular arcs. The shape is pure geometry data (no GPU allocation) and must be rasterized via DrawShape to produce a visible image.
Usage Examples
Basic: Draw a rectangle
Rectangle -> Transform2D -> DrawShape -> Output. Set width and height to define size. Use Transform2D to position it in the composition.
Rounded UI element
Set cornerRadius to 20-40 for a pill-like or card shape. Combine with DrawShape's fill and stroke for panel-style graphics.
Procedural sizing
Connect a Math or Time node to width_in / height_in expose channels for animated or expression-driven dimensions.
Tips
- Press R to activate the Rectangle shelf tool, which lets you click-drag in the viewport to draw a rectangle. This auto-creates the full Rectangle -> T2D -> DrawShape -> Output chain.
- Shapes are centered at the origin. Use Transform2D for all positioning and scaling.
- All params are keyframeable for animation.
- Corner radius is clamped to half the shorter side (a 200x100 rectangle caps at 50).
Related Nodes
- Circle -- single-radius circular shape
- Polygon -- regular polygon with configurable sides
- Transform2D -- positions and scales the shape in the composition
- DrawShape -- rasterizes shapes to pixels with fill/stroke