lionel0201

Hello all, I am using the following code to test out spine web player on my react project
var spineParent = new SpinePlayer("player-container", {
jsonUrl: "http://esotericsoftware.com/files/examples/4.0/spineboy/export/spineboy-pro.json",
atlasUrl: "http://esotericsoftware.com/files/examples/4.0/spineboy/export/spineboy.atlas",
animation: 'jump',
premultipliedAlpha: true,
backgroundColor: '#cccccc',
viewport: {
debugRender: true,
},
showControls: true,
});


export default function SpineViewer() {
return (
<>
<div id="player-container" style="width: 640px; height: 480px;"></div>;
</>
);
}
However, I am getting a error of Player.ts:227 Uncaught Error: SpinePlayer parent not found: player-container
at new SpinePlayer. I am using npm to install all the packages. Any help is greatly appreciated :grinteeth:
lionel0201
  • Posts: 1

Nate

I'm not familiar with React, but when you call new SpinePlayer, it looks for the element with the specified ID, player-container. You'll need your DIV in the document before you call new SpinePlayer.
User avatar
Nate

Nate
  • Posts: 12219


Return to Runtimes