CocosCreator version 2.3.4 Dragon bone animationPut the keel animation under Cocos assets. The dragon bone animation here is the binary animation exported by Dragonbones. Drag the keel animation (bone icon) directly to the stage Set the properties of skeletal animation, DragonAtlasAsset images, Animation actions, PlayTime loop playback, etc. Code generated keel animationThe dragon bone resource path is assets/resources/dragonbones, and loadResDir only needs to fill in dragonbones. //Load resources according to the path cc.loader.loadResDir("dragonbones",cc.Asset,null,(err, resource)=>{ console.log("resource:",resource); //Generate skeletal animation 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); }); Replace skin//Load resourcescc.loader.loadResDir("dragonbones",cc.Asset,null,(err, resource)=>{ console.log("resource:",resource); //Generate animation 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); //Generate animation 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); //Apply the skin of animation 2 to animation 1 let factory = dragonBones.CCFactory.getInstance(); factory.replaceSkin(armatureDisplay.armature(), (armatureDisplay2.armature() as dragonBones.Armature).armatureData.defaultSkin, true); }); The above is the detailed content of CocosCreator skeletal animation DragonBones. For more information about CocosCreator skeletal DragonBones, please pay attention to other related articles on 123WORDPRESS.COM! You may also be interested in:
|
<<: Linux virtual memory settings tutorial and practice
>>: MySQL prepare principle detailed explanation
It is very simple to build a kong cluster under t...
This article shares with you the graphic tutorial...
1. Replication Principle The master server writes...
Table of contents 1. Write in front 2. Overlay to...
CEP - Complex Event Processing. The payment has n...
You can manage and deploy Docker containers in a ...
Preface Let me explain here first. Many people on...
DOCTYPE Doctype is used to tell the browser which...
The new project has basically come to an end. It ...
Preface When it comes to database transactions, a...
This article shares the specific code of js to ac...
Table of contents 1. Introduction to FastDFS 1. I...
Preface You should often see this kind of special...
In JavaScript, use the removeAttribute() method o...
Triggers can cause other SQL code to run before o...