cocos creator spine애니메이션이 진행되는정도에따라 이벤트 리스너를 이용해 다른 액션을 줄수있음.
var Test = cc.Class({
properties:{
spineObj : sp.Skeleton,
}
ShowSpineAnimation: function(){
this.spineObj.noe.active = true;
// Run Animation
this.spineObj.SetAnimation(0,"run",false);
}
});
다음 애니메이션이 종료될때 Foo() function을 부르고싶을때가 있다.
리스너를 추가해서 하면됨!
리스너를 추가하는 방법은 다음과같다.
var Test = cc.Class({
properties:{
spineObj : sp.Skeleton,
},
start:function(){
this.spineObj.setStartListener((track,loopCount)=>{
// 애니메이션이 시작했을때 soo() 함수 called
this.soo();
});
this.spineObj.setCompleteListener((track, loopCount)=>{
// 애니메이션이 종료되면 foo() 함수를 called
this.foo();
});
},
soo: function(){
cc.log("Animation Started???");
},
foo: function(){
cc.log("Animation Ended????");
},
ShowSpainAnimation: function(){
this.spineObj.noe.active = true;
// Run Animation
this.spineObj.SetAnimation(0,"run",false);
},
});
자세한 API는 공식 Reference에 적혀있음.
https://docs.cocos2d-x.org/api-ref/creator/en/en/classes/Skeleton.html
Skeleton · GitBook
The skeleton of Spine (Skeleton has a reference to a SkeletonData and stores the state for skeleton instance, which consists of the current pose's bone SRT, slot colors, and which slot attachments are visible. Multiple skeletons can use the same SkeletonDa
docs.cocos2d-x.org
Cocos Creator 코코스 크리에이터 resource Load 문제 (0) | 2024.02.20 |
---|---|
cocos creator [js] Error (0) | 2021.07.22 |
cocos creator Action (0) | 2021.05.26 |
cocos creator unexpected element <queries> found in AndroidManifest.xml (0) | 2021.05.17 |
SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727) (0) | 2021.05.07 |
cocos Failed to notify project evaluation listener. java.lang.exceptionInInitializerError (0) | 2021.05.07 |