mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[ts] Fixed setAnimation naming for string/ref arguments
This commit is contained in:
parent
787af5c8f8
commit
aa5282b398
@ -358,13 +358,13 @@ module spine {
|
|||||||
this.queue.start(current);
|
this.queue.start(current);
|
||||||
}
|
}
|
||||||
|
|
||||||
setAnimationByName (trackIndex: number, animationName: string, loop: boolean) {
|
setAnimation (trackIndex: number, animationName: string, loop: boolean) {
|
||||||
let animation = this.data.skeletonData.findAnimation(animationName);
|
let animation = this.data.skeletonData.findAnimation(animationName);
|
||||||
if (animation == null) throw new Error("Animation not found: " + animationName);
|
if (animation == null) throw new Error("Animation not found: " + animationName);
|
||||||
return this.setAnimation(trackIndex, animation, loop);
|
return this.setAnimation(trackIndex, animation, loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
setAnimation (trackIndex: number, animation: Animation, loop: boolean) {
|
setAnimationWith (trackIndex: number, animation: Animation, loop: boolean) {
|
||||||
if (animation == null) throw new Error("animation cannot be null.");
|
if (animation == null) throw new Error("animation cannot be null.");
|
||||||
let current = this.expandToIndex(trackIndex);
|
let current = this.expandToIndex(trackIndex);
|
||||||
if (current != null) {
|
if (current != null) {
|
||||||
|
|||||||
@ -143,7 +143,7 @@ module spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var animationState = this.state = new spine.AnimationState(new spine.AnimationStateData(skeleton.data));
|
var animationState = this.state = new spine.AnimationState(new spine.AnimationStateData(skeleton.data));
|
||||||
animationState.setAnimationByName(0, config.animation, true);
|
animationState.setAnimation(0, config.animation, true);
|
||||||
if (config.success) config.success(this);
|
if (config.success) config.success(this);
|
||||||
this.loaded = true;
|
this.loaded = true;
|
||||||
requestAnimationFrame(() => { this.render(); });
|
requestAnimationFrame(() => { this.render(); });
|
||||||
@ -246,7 +246,7 @@ module spine {
|
|||||||
setAnimation (animationName: string) {
|
setAnimation (animationName: string) {
|
||||||
if (!this.loaded) throw new Error("Widget isn't loaded yet");
|
if (!this.loaded) throw new Error("Widget isn't loaded yet");
|
||||||
this.skeleton.setToSetupPose();
|
this.skeleton.setToSetupPose();
|
||||||
this.state.setAnimationByName(0, animationName, this.config.loop);
|
this.state.setAnimation(0, animationName, this.config.loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user