On this page
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.
colorOptional- Atlas RGB color value used by the requested visual or feedback operation.
thicknessOptional- Line or outline thickness in the current overlay coordinate units.
filledOptional- Optional boolean that fills the requested shape when true; false draws only its outline.
idOptional- 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);
}