On this page
API method

ui.line

Draws a line and returns its runtime handle.

Syntax

Atlas Script
ui.line(x1, y1, x2, y2, color?, thickness?, id?)

Parameters

x1
Normalized horizontal coordinate of the line start.
y1
Normalized vertical coordinate of the line start.
x2
Normalized horizontal coordinate of the line end.
y2
Normalized vertical coordinate of the line end.
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.
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 line and returns its runtime handle. Color is optional (default white), thickness defaults to 2 pixels, and an optional seventh 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.