最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

CocosCreator骨骼動(dòng)畫之龍骨DragonBones

 更新時(shí)間:2021年04月16日 08:46:06   作者:gamedaybyday  
這篇文章主要介紹了怎么在CocosCreator中使用骨骼動(dòng)畫龍骨DragonBones,對(duì)骨骼動(dòng)畫感興趣的同學(xué),可以試一下

CocosCreator版本2.3.4

龍骨動(dòng)畫

將龍骨動(dòng)畫放到cocos的assets下。我這里龍骨動(dòng)畫是Dragonbones導(dǎo)出的二進(jìn)制動(dòng)畫。

直接拖拽龍骨動(dòng)畫(骨頭圖標(biāo))到舞臺(tái)

設(shè)置骨骼動(dòng)畫的屬性,DragonAltasAsset圖片,Animation動(dòng)作,PlayTime循環(huán)播放等

代碼生成龍骨動(dòng)畫

龍骨資源路徑是assets/resources/dragonbones,loadResDir只需要填dragonbones就行了。

//根據(jù)路徑加載資源
cc.loader.loadResDir("dragonbones",cc.Asset,null,(err, resource)=>{
      console.log("資源:",resource);
      //生成骨骼動(dòng)畫
      let node:cc.Node = new cc.Node();
      let armatureDisplay:dragonBones.ArmatureDisplay = node.addComponent(dragonBones.ArmatureDisplay);
      armatureDisplay.dragonAsset = resource[0];
      armatureDisplay.dragonAtlasAsset = resource[3];
      armatureDisplay.armatureName = "role3";
      armatureDisplay.playAnimation("move",0);
      node.x = 100;
      node.y = 100;
      this.node.addChild(node);
});

替換皮膚

//加載資源
 cc.loader.loadResDir("dragonbones",cc.Asset,null,(err, resource)=>{
     console.log("資源:",resource);
 
    //生成動(dòng)畫1
    let node:cc.Node = new cc.Node();
    let armatureDisplay:dragonBones.ArmatureDisplay = node.addComponent(dragonBones.ArmatureDisplay);
    armatureDisplay.dragonAsset = resource[0];
    armatureDisplay.dragonAtlasAsset = resource[3];
    armatureDisplay.armatureName = "role3";
    armatureDisplay.playAnimation("move",0);
    node.x = 100;
    node.y = 100;
    this.node.addChild(node);
 
    //生成動(dòng)畫2
    let node2:cc.Node = new cc.Node();
    let armatureDisplay2:dragonBones.ArmatureDisplay = node2.addComponent(dragonBones.ArmatureDisplay);
    armatureDisplay2.dragonAsset = resource[4];
    armatureDisplay2.dragonAtlasAsset = resource[7];
    armatureDisplay2.armatureName = "role4";
    armatureDisplay2.playAnimation("move",0);
    node2.x = 150;
    node2.y = 150;
    this.node.addChild(node2);
     
 
    //動(dòng)畫2的皮膚應(yīng)用到動(dòng)畫1上
    let factory = dragonBones.CCFactory.getInstance();
    factory.replaceSkin(armatureDisplay.armature(), (armatureDisplay2.armature() as dragonBones.Armature).armatureData.defaultSkin, true);
});

以上就是CocosCreator骨骼動(dòng)畫之龍骨DragonBones的詳細(xì)內(nèi)容,更多關(guān)于CocosCreator骨骼DragonBones的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

最新評(píng)論

珠海市| 潞西市| 温州市| 咸阳市| 苍山县| 峨边| 三门峡市| 贵南县| 玉田县| 金门县| 东港市| 丰宁| 吉木萨尔县| 凤阳县| 嘉兴市| 青海省| 渭源县| 墨竹工卡县| 错那县| 绿春县| 隆昌县| 景东| 南陵县| 武邑县| 竹山县| 汶上县| 滦南县| 泗洪县| 会同县| 息烽县| 紫金县| 晴隆县| 库尔勒市| 肇州县| 南充市| 宽甸| 包头市| 龙川县| 兴文县| 镇坪县| 青岛市|