add playAnimationByName() api
This commit is contained in:
parent
3845f1c1a7
commit
8d029c682f
2 changed files with 7 additions and 1 deletions
|
@ -118,6 +118,12 @@ export class Agent {
|
||||||
this.animState.play();
|
this.animState.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
playAnimationByName(name: String) {
|
||||||
|
let index = this.data.animInfo.findIndex((n) => n.name == name);
|
||||||
|
if(index !== -1)
|
||||||
|
this.playAnimation(index);
|
||||||
|
}
|
||||||
|
|
||||||
animationFinished() {
|
animationFinished() {
|
||||||
this.animState = null;
|
this.animState = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ input.addEventListener("change", async () => {
|
||||||
|
|
||||||
agent.show();
|
agent.show();
|
||||||
|
|
||||||
agent.playAnimation(0);
|
agent.playAnimationByName("Show");
|
||||||
console.log("parsed character");
|
console.log("parsed character");
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue