Line
A polyline through local points: width, colour, closed, rounded joints (lasers, ropes, outlines).
Type: LineNode · Category: Graphics & Rendering · Also found as: line, line2d
Properties
Section titled “Properties”| Property | Type | Default | Description |
|---|---|---|---|
width |
number | 4 |
Line thickness (px). Range 0.5 to 100. |
color |
color | #ffffffff |
Line colour. |
closed |
boolean | false |
Join the last point to the first. |
rounded |
boolean | true |
Round joints and caps. |
Plus the common properties every node has.
Lua methods
Section titled “Lua methods”Call them on the node (self.node in its script, or self.node:get_node("path")). Every node also has the Node methods.
LineNode:get_property(path)
Section titled “LineNode:get_property(path)”Reads an Inspector property by its path (vectors and colours as tables); “script.
local value = self.node:get_property("width")pathLineNodeProperty|string
Returns any
LineNode:set_property(path, value, y)
Section titled “LineNode:set_property(path, value, y)”Sets an Inspector property by its path: vectors as {x, y} or x, y; colours as {r, g, b[, a]} 0..1 or “#rrggbb[aa]”; enums by name; “script.
self.node:set_property("width", 1.5)pathLineNodeProperty|stringvalueanyy?number
LineNode:line_set_points(points)
Section titled “LineNode:line_set_points(points)”LineNode: replaces its points (local to the node).
self.node:get_node("Laser"):line_set_points({ {0, 0}, {120, 0} })pointsnumber[][]{ {x, y}, … }
LineNode:line_add_point(x, y)
Section titled “LineNode:line_add_point(x, y)”LineNode: appends a point (local to the node).
self.node:get_node("Path"):line_add_point(64, 32)xnumberynumber
LineNode:line_clear()
Section titled “LineNode:line_clear()”LineNode: removes every point.
self.node:get_node("Path"):line_clear()In a scene file
Section titled “In a scene file”{ "type": "LineNode", "name": "Line", "position": [ 0, 0 ], "properties": { "width": 4, "color": "#ffffffff", "closed": false }}