fromArtboard static method
Instance a StateMachineController from an artboard
with the given
stateMachineName
. Returns the StateMachineController or null if no
StateMachine with stateMachineName
is found.
Implementation
static StateMachineController? fromArtboard(
Artboard artboard,
String stateMachineName, {
core.OnStateChange? onStateChange,
}) {
for (final animation in artboard.animations) {
if (animation is StateMachine && animation.name == stateMachineName) {
final controller =
StateMachineController(animation, onStateChange: onStateChange);
if (artboard is RuntimeArtboard) {
artboard.addNestedEventListener(controller);
}
return controller;
}
}
return null;
}