how can i replace current inited SpinePlayer skeleton
The Spine Player is not designed to handle on-the-fly changes to the displayed skeleton without disposing of the player.
The easiest solution is to replace the current spine player. Have a look at this example.
Just pass the assets location to the createPlayer
function.
Does this solution fits your needs?
Davide thank you answer, i actually use that solution in my project, people click switch buttom, make player dispose and initialization frequently, in mobiel web side,it make my phone so hot, I wonder if there is a problem with content leakage, can i re-implementation with spine-webgl avoid this performance issue.i want some high performance practice
The dispose function actually disposes everything was initialized by the player. If there was a memory leak, the result would be more likely a page crash.
Can you link or share your project so that I can have a look at your setup? If you don't want to share it publicly, you can send it to contact@esotericsoftware.com.
The spine player sits into the given HTMLElement
and no overflow should happen. If it overflows, maybe there something wrong with your setup.
You shouldn't look at the size of what's inside the webgl canvas since it depends on the devicePixelRatio
.
Unfortunately, you can't achieve that with the spine-player
. You could modify the code and get that result, but it might not be the easier thing to do. If you want to try that, you have to modify spine-webgl
since spine-player
uses it.
This might be a interesting use case for our work in progress spine-widget
. It basically uses a single webgl context to render multiple skeletons. And you can clip the viewport at your desired bounds.
You can give it a try by switching to the ts-webgl-overlay
branch of our repository and learn how to use it launching the webcomponent-tutorial example.
Davide
So I really need to learn spine-webgl, which can help me understand the basic logic of the entire runtime. I am curious about whether spine-play has done performance test on mobile terminals. When drawing animations close to the full screen, the hot phenomenon makes me worry that old mobile phones cannot be well compatible (thank you answer again)
As mentioned yesterday, you can get it by switching to the ts-webgl-overlay
. Then you can build it by yourseld. Its source is in the spine-webgl
folder right now.
But I suggest you to just directly download the library from the page I linked yesterday.