Skip to main content

states

interaction · 2 properties · Other

Named looks this node can be in. Every key beside current and duration is a state, and each holds a table per component of the properties that state sets: [nodes.states.hover.shape3d] color = "#ff8800". node.go("hover") patches them over what the node already has, so a state says only what differs.

In a scene, states is the node key that applies it. A script reaches the same properties through node.states.get() and node.states.set(table).

Properties

propertytypedefaultdescription
currentstringThe state this node is in; empty is the pose the scene gave it
durationfloat0Seconds a transition takes; zero snaps At least 0.

Script functions

Methods of node.states, the handle a node carrying this component exposes. Each is also a free function on its module, taking the node as its first argument. Every handle also has get(), set(table), has() and remove().

From node:

methodwhat it does
go()Put the node in one of its states: the state's table is patched over the components it names, and on_state_changed(from, to) follows. A node already in that state is left alone.
state()The state the node is in, or "" for the pose the scene gave it.