• Runtimes
  • Spine-player.js - How to play animation

Related Discussions
...

Hi

  1. I'm trying to play a one time animation with the SpinePlayer on a click event on a web page.
    let player = new spine.SpinePlayer("container-raptor", {
          jsonUrl: "assets/_front.json",
          atlasUrl: "assets/_front.atlas",
          animation: "idle",
          showControls: false,
          premultipliedAlpha: true,
          backgroundColor: "#00000000",
          alpha: true
       });

and I don't know how to
??????.setAnimation(0, 'animation_name', false);

  1. Is there an option to avoid showing the spine logo when the animation is loading?
    Thank you
yalondpsi :

and I don't know how to
??????.setAnimation(0, 'animation_name', false);

The current implementation of SpinePlayer is very simplistic and offers only the following method
public setAnimation (animation: string)
https://github.com/EsotericSoftware/spine-runtimes/blob/3.8/spine-ts/player/src/Player.ts#L1130
This will set a looping animation on the first track. Is this what you need?

yalondpsi :

2. Is there an option to avoid showing the spine logo when the animation is loading?

I'm afraid you would need to adjust the provided code or create your own copy to change the loading screen.

You could either modify the existing logo image used in any LoadingScreen here:
https://github.com/EsotericSoftware/spine-runtimes/blob/3.8/spine-ts/webgl/src/LoadingScreen.ts#L50
Or you could change the SpinePlayer code to not display the loading screen (or display something else instead) here:
https://github.com/EsotericSoftware/spine-runtimes/blob/3.8/spine-ts/player/src/Player.ts#L735

9 天 后

Thank you for the answer.
Sorry for the delay in my reply :-)

Due to the limitations in the spine-player, I guess I will use the webgl player

No problem, thanks for getting back to us.