- 수정됨
How to add listeners (web)
Hello,
I have read the API references, know the basic functionalities of events, and have found an old blog post about it (which was for C#). But I'm new - couldn't really follow, did not really understand it as much as I wished, just a general idea. How would you e.g. add another animation to a track as soon as the current has completed playing?
var track = player.animationState.setAnimation(...)
Now I'm confused how to add the listener and what to do next.
track.addListener(?player.animationStateListener?)
Have a great day.
You don't necessarily need a listener, you can queue up multiple animations like this:
let animState = player.animationState;
animState.setAnimation(...)
animState.addAnimation(...)
animState.addAnimation(...)
Alternatively, you can add the listener like this:
track.addListener({
complete: (track) => { ... }
});
Thank you very much, Mario!