EsotericSoftware / spine-runtimes

2D skeletal animation runtimes for Spine.
http://esotericsoftware.com/
Other
4.41k stars 2.91k forks source link

[haxe] Mix transition error occurred #2665

Closed rainyt closed 1 week ago

rainyt commented 2 weeks ago
image

@davidetan This is another issue, if the loops between animations are all true, transition errors will occur. Thank you again for your investigation.

background.color = 0x333333;

        var atlas = new TextureAtlas(Assets.getText("assets/orginStick.atlas"), new StarlingTextureLoader("assets/orginStick.atlas"));
        var skeletondata = SkeletonData.from(loadBinary ? Assets.getBytes("assets/orginStick.skel") : Assets.getText("assets/orginStick.json"), atlas);
        var animationStateData = new AnimationStateData(skeletondata);
        animationStateData.defaultMix = 0.25;

        var skeletonSprite = new SkeletonSprite(skeletondata, animationStateData);
        var bounds = skeletonSprite.skeleton.getBounds();
        skeletonSprite.scale = Starling.current.stage.stageWidth / bounds.width * 0.5;
        skeletonSprite.x = Starling.current.stage.stageWidth / 2;
        skeletonSprite.y = Starling.current.stage.stageHeight * 0.9;
        skeletonSprite.scale = 0.5;

        // skeletonSprite.state.setAnimationByName(0, "skill1", true);

        skeletonSprite.state.setAnimationByName(0, "skill2", true).onComplete.add((t)->{
            skeletonSprite.state.setAnimationByName(0, "idle", true);
        });

        addChild(skeletonSprite);
        juggler.add(skeletonSprite);
rainyt commented 2 weeks ago

Based on my observation, this displacement error occurs when there is no animation change at frame 0 and the end of the animation

davidetan commented 1 week ago

Based on my observation, this displacement error occurs when there is no animation change at frame 0 and the end of the animation

I'm sorry, but I cannot reproduce the issue with the code above. This is what I see: https://github.com/user-attachments/assets/7c126ba6-c337-46fe-95d6-78aac00446db

Feel free to re-open the issue adding additional information to reproduce the situation in the screenshot.