Nodes

Everything on the canvas is a node.

Try it

title: "Node hierarchy"
description: "A frame containing shapes — children inherit parent transforms"
nodes:
  - type: FRAME, name: "Container", x: 150, y: 150, w: 200, h: 200, fill: "#ECF0F1", cornerRadius: 8
  - type: ELLIPSE, name: "Circle", x: 50, y: 50, w: 60, h: 60, fill: "#E74C3C", parent: "Container"
  - type: RECT, name: "Square", x: 120, y: 100, w: 50, h: 50, fill: "#3498DB", parent: "Container"
  - type: STAR, name: "Star", x: 60, y: 140, w: 50, h: 50, fill: "#F39C12", points: 5, parent: "Container"
tools_visible: [select, vector-edit]
ui_visible: [properties, layers]

What is a node

A node is any object in the scene — a rectangle, a circle, a star, a frame, a freeform vector path. Nodes form a tree: children are positioned relative to their parent.

Node types

TypeDescriptionCreate with
RECTRectangle with optional corner radiusRectangle tool
ELLIPSEEllipse with arc system and 6 geometry modesEllipse tool
STARStar with configurable points and inner radiusStar tool
POLYGONRegular polygon with adjustable vertex countPolygon tool
VECTORFreeform vector path drawn with Pen toolPen tool
MIRRORED_VECTORVector with Cn/Dn/bilateral symmetryPen tool + symmetry
FRAMEClipping container with background fillFrame tool
GROUPContainer without clippingGroup selection

Properties common to all nodes

PropertyTypeDefaultDescription
xnumber0Horizontal position (local space)
ynumber0Vertical position (local space)
widthnumber100Width
heightnumber100Height
rotationangle0Rotation in degrees
opacityratio1Opacity (0 = invisible, 1 = fully visible)
fillspaint[][]Array of fill paints
strokespaint[][]Array of stroke paints
blendModeblendMode"normal"Compositing blend mode
tagsstring[][]User-defined labels

Node API

Accessing in formulas

Reference any node by name:

Ball.x // read Ball's x position
Ball.width // read Ball's width
parent.rotation // read parent's rotation
this.opacity // read this node's opacity

Methods

MethodDescription
node.destroy()Remove the node from the scene
node.is(typeOrTag)Check type ("RECT") or tag ("brick")
node.setTags(tags)Set the node's tags array

Special references

ReferenceResolves to
thisThe node that owns the current formula/event
parentThe parent node in the scene tree
Tag.nameArray of all nodes with that tag

Node lifecycle

  1. Created — added to the scene tree, appears on canvas
  2. Active — properties can be set, formulas evaluate, events fire
  3. Destroyednode.destroy() called, marked with _destroyed flag
  4. Cleaned up — removed from scene tree, tags unregistered, formulas/events cleared

Destroyed nodes are cleaned up in the play loop's cleanupDestroyed pass. Destruction is deferred — the node still exists for the remainder of the current frame.

The scene tree

Nodes form a tree. The document root contains top-level nodes. Frames and groups contain children.

Document
├── Background (RECT)
├── Player (FRAME)
│ ├── Body (RECT)
│ ├── Head (ELLIPSE)
│ └── Hat (STAR)
├── Platform (RECT)
└── Ball (ELLIPSE)

Children inherit parent transforms. Move the Player frame — Body, Head, and Hat move with it. Rotate the frame — children rotate. Scale — children scale.

Coordinate spaces

SpaceOriginUsed by
LocalParent's originNode properties (x, y)
WorldCanvas origin (0, 0)Physics, mouse position
ScreenViewport top-leftCamera, hit testing

A node's x and y are in local space — relative to its parent. The Mat class transforms between spaces.


PropertiesFormulas APIShapes reference

← НазадPhysics APIДальше →Keyboard Shortcuts