animation.getStateInfo

Section: Animator State Machine

What it does

animation.getStateInfo reads StateInfo on an animation object. It takes entityId and layer. layer is optional.

Signature

animation.getStateInfo(entityId, layer?)

Arguments

  • entityId
  • layeroptional

Example · generated

function update(dt) {  animation.create('main', 'position', 30, 'float');  const stateInfo = animation.getStateInfo('main');}

animation.create is there to give the call something to act on; animation.getStateInfo is the line that matters. The code sits in update(dt), which the engine calls every frame: dt is the time since the last one, in seconds.

22 members in animation