Trail
A fading, tapering ribbon behind a moving node (place it as a child): lifetime, width, colours.
Type: TrailNode · Category: Animation & Effects · Also found as: trail
Properties
Section titled “Properties”| Property | Type | Default | Description |
|---|---|---|---|
lifetime |
number | 0.5 |
Seconds a point of the trail lasts. Range 0.05 to 10. |
width |
number | 12 |
Width at the head (it tapers to the tail; px). Range 0.5 to 200. |
color |
color | #ffffffdc |
Colour at the head. |
endColor |
color | #ffffff00 |
Colour at the tail (fades to it). |
minDistance |
number | 4 |
Distance the parent must move before a new point is recorded (px). Range 0.5 to 100. |
emitting |
boolean | true |
Record new points (off: the trail fades away). |
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.
TrailNode:get_property(path)
Section titled “TrailNode:get_property(path)”Reads an Inspector property by its path (vectors and colours as tables); “script.
local value = self.node:get_property("lifetime")pathTrailNodeProperty|string
Returns any
TrailNode:set_property(path, value, y)
Section titled “TrailNode: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("lifetime", 1.5)pathTrailNodeProperty|stringvalueanyy?number
TrailNode:trail_clear()
Section titled “TrailNode:trail_clear()”TrailNode: drops the recorded ribbon (e.g. after a teleport).
self.node:set_position(0, 0); self.node:get_node("Trail"):trail_clear()In a scene file
Section titled “In a scene file”{ "type": "TrailNode", "name": "Trail", "position": [ 0, 0 ], "properties": { "lifetime": 0.5, "width": 12, "color": "#ffffffdc" }}