可以获取到每一帧的图片吗? #34
-
通过onUpdate可以获取每一帧,那么如何获取当前帧的图片呢? 还有一个问题,如何获取当前动画已经播放一遍了?没找到动画播放每一次的事件。 |
Beta Was this translation helpful? Give feedback.
Answered by
GuoLei1990
Nov 26, 2022
Replies: 0 comments 2 replies
-
第一个问题参考:https://oasisengine.cn/#/examples/latest/screenshot const animator = defaultSceneRoot.getComponent(Animator);
const state = animator.findAnimatorState("walk");
state.addStateMachineScript(
class extends StateMachineScript {
onStateEnter(animator: Animator,animatorState: AnimatorState,layerIndex: number): void {
console.log("onStateEnter: ", animatorState);
}
onStateUpdate(animator: Animator, animatorState: AnimatorState,layerIndex: number): void {
console.log("onStateUpdate: ", animatorState);
}
onStateExit(animator: Animator,animatorState: AnimatorState,layerIndex: number): void {
console.log("onStateExit: ", animatorState);
}
}
); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
luzhuang
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
第一个问题参考:https://oasisengine.cn/#/examples/latest/screenshot
第二个问题你可能想用
onStateExit
回调,参考: https://oasisengine.cn/#/examples/latest/animation-stateMachineScript