Skip to main content
Represents a node in the hierarchy, providing transform properties and access to parent and child nodes.

Fields

position

The local position of the node.
if self.instance then
  local node = self.instance:node('Hips')
  if node then
    node.position = Vector.xy(199, 299)
  end
end

rotation

The local rotation of the node in radians.
if self.instance then
  local node = self.instance:node('Hips')
  if node then
    node.rotation = math.rad(45)
  end
end

scale

The local scale of the node.
if self.instance then
  local node = self.instance:node('Hips')
  if node then
    node.scale = Vector.xy(1.4, 2)
  end
end

worldTransform

The read-only world transform of the node.
if self.instance then
  local node = self.instance:node('Hips')
  if node then
    local wt = node.worldTransform
    print("world xx:", wt.xx, "xy:", wt.xy)
    print("world yx:", wt.yx, "yy:", wt.yy)
    print("world tx:", wt.tx, "ty:", wt.ty)
  end
end

x

The x-coordinate of the local position.
if self.instance then
  local node = self.instance:node('Hips')
  if node then
    node.x = 100
  end
end

y

The y-coordinate of the local position.
if self.instance then
  local node = self.instance:node('Hips')
  if node then
    node.y = 200
  end
end

scaleX

The x component of the local scale.
if self.instance then
  local node = self.instance:node('Hips')
  if node then
    node.scaleX = 2
  end
end

scaleY

The y component of the local scale.
if self.instance then
  local node = self.instance:node('Hips')
  if node then
    node.scaleY = 2
  end
end

paint

If node is a Path, paint trait is available with paint data (Coming soon)

Methods

asPath

asPath() -> PathData?
If node is a Path, returns the node as PathData.
function pointerDown(self: PaintInstance, event: PointerEvent)
  if self.instance then
    local myPath = self.instance:node('MyPath')
    if myPath then
      local path = myPath:asPath()
      if path then
        local cmd: PathCommand = path[1]
        print(cmd.type) -- moveTo
      end
    end
  end
end

asPaint

asPaint() -> Paint?
If node is a ShapePaint (Fill or Stroke), returns node as Paint (Coming soon)