官方实力项目中的 example/lib/animation_state_events.dart里面
controller.animationState
.setAnimationByName(0, "walk", true)
.setListener((type, trackEntry, event) {
print("Walk animation event $type");
});
controller.animationState.addAnimationByName(0, "jump", false, 2);
controller.animationState
.addAnimationByName(0, "run", true, 0)
.setListener((type, trackEntry, event) {
print("Run animation event $type");
});
controller.animationState.setListener((type, trackEntry, event) {
if (type == EventType.event) {
print(
"User event: { name: ${event?.getData().getName()}, intValue: ${event?.getIntValue()}, floatValue: intValue: ${event?.getFloatValue()}, stringValue: ${event?.getStringValue()} }");
}
});
只有最后一个方法回调会走,前面两个方法的回调都不会触发,如何只针对某一个动画来监听事件呢
flutter_spine
Is simply, controller.animationState.setListener this method can listen to the event, the above two methods to monitor events
抱歉,这可能是脊柱颤动中的一个错误。 我在这里提出了一个问题:
EsotericSoftware/spine-runtimes2349
Apologies, this is likely a bug in spine-flutter. I've opened an issue for it here:
3 mois plus tard
遇到了同样的问题,目前好像还没有解决