在網頁上調用需要加載資源完成後在調用 現在有個問題 在網頁上顯示不出來 也沒有拋出異常 在
simulator下是能顯示出來的
cc.loader.load([".json",
".atlas"],
function () {
var spineBoy = new sp.SkeletonAnimation('.json', '.atlas');
spineBoy.setPosition(cc.visibleRect.width / 2, cc.visibleRect.height / 2);
spineBoy.setAnimation(0, '動畫名字', true);
this.addChild(spineBoy, 4);
this._spineboy = spineBoy;
spineBoy.setEndListener(function (traceIndex) { //設置結束事件監聽器。 動畫停止播放時調用
//cc.log("%d end.", traceIndex);
});
spineBoy.setCompleteListener(function (traceIndex, loopCount) { //動畫結束事調用-- loopCount 循環的次數 traceIndex動畫的索引
//cc.log("%d complete: %d", traceIndex, loopCount);
});
spineBoy.setEventListener(function (traceIndex, event) {
cc.log(traceIndex + " event: %s, %d, %f, %s", event.data.name, event.intValue, event.floatValue, event.stringValue);
});
}, this);
cocos js Spine sp.SkeletonAnimation
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.