xiushihuatie
I don't know the size of your project, but it shouldn't be very hard to migrate to spine-pixi
.
I'm definitely not an expert on pixi-spine
. I guess the blurriness is due to min/mag filters.
Try to access the pixi base texture and change them (the combination below shold give the sharpest solution):
const baseText: PIXI.BaseTexture = resource.spineAtlas.pages[0].baseTexture;
baseText.scaleMode = PIXI.SCALE_MODES.NEAREST;
baseText.mipmap = PIXI.MIPMAP_MODES.OFF;
Regarding following a bone, I don't see an easy way of doing that. spine-pixi
hides some of our APIs and I'm not familiar with theirs.
I don't see a way to inject logic before the rendering, neither an easy way to get the position of a bone apart from deriving it from a pixi transformation matrix.
With the code below I was able to move the dragon skeleton with respect to the nnn
bone of the card,
const resource1 = await PIXI.Assets.load("/buzhuo/animation.json");
const spine3 = new Spine(resource1.spineData);
const spine4 = new Spine(resource.spineData);
app.stage.addChild(spine3);
spine3.position.set(app.renderer.width * 0.4, spine3.height + 100);
spine3.state.setAnimation(0, "get3", true);
// spine3.skeleton.findSlot('petcontainer').currentMesh.addChild(spine4)
// spine4.position.set(app.renderer.width * 0.1, 400);
const boneToFollow = spine3.skeleton.findBone('nnn');
spine4.state.setAnimation(0, "idle", true);
app.stage.addChild(spine4);
const offsetX = 400;
const offsetY = 330;
const point = new PIXI.Point();
PIXI.Ticker.shared.add(() => {
point.set(boneToFollow.data.x, boneToFollow.data.y)
boneToFollow.matrix.apply(point, point);
spine4.position.x = point.x + offsetX;
spine4.position.y = point.y + offsetY;
})
I have no idea if that's the right way of doing it in pixi-spine
though.