Skip to content

[rive_native] Missing State Machine State End Callback #464

@BlockRen

Description

@BlockRen

Description:
It seems that there is no way to get a callback for the end of a state in the state machine in rive_native. In the rive_common version, I can obtain the callback using the following code:

// get animation controller
_riveController = StateMachineController.fromArtboard(
  artBoard,
  "animation_default",
  onStateChange: _onStateChange,
);

// listen the animation state
void _onStateChange(String stateMachineName, String stateName) {
  if (stateName == "ExitState" &&
    stateMachineController?.layerControllers.length == 1) {
    animationEnd?.call(stateName);
    return;
  }
  if (lastAnimationState != stateName) {
    if (lastAnimationState.isNotEmpty) {
      animationEnd?.call(lastAnimationState);
    }
    lastAnimationState = stateName;
  }
  animationBegin?.call(stateName);
}

However, this functionality is missing in rive_native. Is there any alternative way to achieve this in rive_native?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions