Good afternoon!
The Spine.createOptions() method you're looking for is a static method that should be available in the @esotericsoftware/spine-pixi-v8 package. However, if you cannot find it in version ~4.2.0, it's possible that this method was added in a later version.
For the current recommended approach, you can directly pass SpineFromOptions to the Spine constructor, which is suitable for inheritance:
// Create a Spine container by passing SpineFromOptions directly to the constructor
const spineboy = new Spine({
skeleton: "spineboyData",
atlas: "spineboyAtlas",
scale: 1,
autoUpdate: true
});
// Add the Spine container to the stage
app.stage.addChild(spineboy);
For inheritance, you can extend the Spine class like this:
class MyCustomSpine extends Spine {
constructor(options) {
super(options);
// Your custom initialization code here
}
// Add your custom methods
customMethod() {
// Your custom logic
}
}
// Use your custom class
const customSpineboy = new MyCustomSpine({
skeleton: "spineboyData",
atlas: "spineboyAtlas"
});
app.stage.addChild(customSpineboy);
The constructor accepts SpineFromOptions which includes:
skeleton: the asset name for the skeleton .skel or .json file
atlas: the asset name for the atlas file
scale (optional): scaling value
darkTint (optional): whether to use dark tint renderer
autoUpdate (optional): whether to auto-update animation (default: true)
boundsProvider (optional): custom bounds provider
allowMissingRegions (optional): allow missing atlas regions (default: false)
Note: The from() static method has been deprecated and will be removed in version 4.4, so using the constructor directly is the recommended approach going forward.
If you need the createOptions() functionality specifically, consider updating to the latest version of @esotericsoftware/spine-pixi-v8 or check the GitHub repository for the exact version where this method was introduced.