set/add animation enables skeleton playing state.

This commit is contained in:
Davide Tantillo 2025-12-11 11:29:02 +01:00
parent 829c3c3e6a
commit e06739647e

View File

@ -419,15 +419,23 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase {
*/ */
public setAnimation (track: number, animation: string, loop = false) { public setAnimation (track: number, animation: string, loop = false) {
const trackEntry = this.state?.setAnimation(track, animation, loop); const { state } = this;
if (!trackEntry) return; if (!state) return;
const trackEntry = state.setAnimation(track, animation, loop);
trackEntry.listener = this.makeTrackListener(track, animation); trackEntry.listener = this.makeTrackListener(track, animation);
this.isPlaying = true;
} }
public addAnimation (track: number, animation: string, loop = false, delay = 0) { public addAnimation (track: number, animation: string, loop = false, delay = 0) {
const trackEntry = this.state?.addAnimation(track, animation, loop, delay); const { state } = this;
if (!trackEntry) return; if (!state) return;
const trackEntry = state.addAnimation(track, animation, loop, delay);
trackEntry.listener = this.makeTrackListener(track, animation); trackEntry.listener = this.makeTrackListener(track, animation);
this.isPlaying = true;
} }
public setEmptyAnimation (track: number, mixDuration = 0) { public setEmptyAnimation (track: number, mixDuration = 0) {