It sounds like you are experiencing issues with running a Spine 4.0 animation using Pixi on an Android-based Galaxy Tab. Here are a few potential reasons and solutions for the problem:
Version Compatibility: Ensure that the version of the Spine runtime you are using is compatible with the version of the Spine editor you used to create the animation. Mismatches can cause issues. You can check the compatibility and download the correct runtime from the Spine Runtimes.
Performance Issues: Android devices, especially older models, may struggle with complex animations due to hardware limitations. Simplifying the animation or reducing the number of vertices and meshes might help.
JavaScript Execution: If you are using setTimeout
or other JavaScript functions that might interfere with the requestAnimationFrame
loop, it could cause issues. Try to perform all animation-related updates within the Pixi rendering loop.
Asset Loading: Ensure that all assets are correctly loaded before starting the animation. Missing or incorrectly loaded assets can cause the animation to fail.
Testing on Different Devices: Sometimes, specific devices have unique issues. Testing on multiple devices can help identify if the problem is device-specific.
Here is a simple example of how to set up a Spine animation with Pixi:
const app = new PIXI.Application({ width: 800, height: 600 });
document.body.appendChild(app.view);
PIXI.loader
.add('spineCharacter', 'path/to/your/spine/animation.json')
.load((loader, resources) => {
const animation = new PIXI.spine.Spine(resources.spineCharacter.spineData);
animation.x = app.screen.width / 2;
animation.y = app.screen.height;
animation.scale.set(0.5);
app.stage.addChild(animation);
animation.state.setAnimation(0, 'animationName', true);
});
If the problem persists, it might be helpful to provide a minimal example that reproduces the issue, including the assets and code.