On this page
API method

ui.rect

Draws a rectangle and returns its runtime handle.

Syntax

Atlas Script
ui.rect(x, y, width, height, color?, thickness?, filled?, id?)

Parameters

x
Horizontal component or X coordinate for the requested operation.
y
Vertical component or Y coordinate for the requested operation.
width
Width of the requested rectangle or drawing operation.
height
Height of the requested rectangle or drawing operation.
color Optional
Atlas RGB color value used by the requested visual or feedback operation.
thickness Optional
Line or outline thickness in the current overlay coordinate units.
filled Optional
Optional boolean that fills the requested shape when true; false draws only its outline.
id Optional
Optional identifier used by this API to keep the selected touch point or drawing stable across calls. See Remarks for the method-specific accepted range or format.

Return value

Returns a value to keep in a var variable.

Remarks

Draws a rectangle and returns its runtime handle. Color is optional (default white), thickness defaults to 2 pixels, and filled defaults false; an optional eighth ID string creates a replaceable stable handle. Coordinates are passed as normalized frame fractions and are not VM-clamped.

Examples

Draw normalized video shapes.atlas
event on_frame() {
    ui.rect(0.30, 0.30, 0.40, 0.40, rgb.cyan, 2, false);
    ui.line(0.50, 0.30, 0.50, 0.70, rgb.yellow, 2);
    ui.circle(0.50, 0.50, 0.10, rgb.lime, 2, false);
}
Reference details are generated from the Atlas Script schema in this documentation source snapshot. Confirm release-specific behavior in the Atlas for Windows build you use.