Hi! Im using the spine-player in a react app and when i load an animation it plays in a infinite loop, but in my case i need to play the animation with an user action, (ex when he clicks a button) and play it only once. How can i do that? I cant find info about loop, the only thing that came into my mind was start the player in pause(), change to play() when user clicks and then calculate the animation duration and change again to pause(), there is a better solution to this? Thanks!
my code example:
const renderPlayer = () => {
playerRef.current = new SpinePlayer(characterName, {
jsonUrl: jsonPath,
atlasUrl: atlasPath,
alpha: true,
backgroundColor: '#00000000',
preserveDrawingBuffer: true,
showLoading: false,
showControls: false,
animation: animationName,
success: function (player) {
player.speed = animationSpeed
},
error: function (reason) {
console.log('spine animation load error', reason)
},
viewport: {
// debugRender: true,
padLeft: '0%',
padRight: '0%',
padTop: '0%',
padBottom: '0%'
}
})
}