Open clifftm opened 6 years ago
Hi, you can add dragonBones to your html like this: https://github.com/DragonBones/DragonBonesJS/tree/master/Pixi/Demos https://github.com/DragonBones/DragonBonesJS/blob/master/Pixi/Demos/index.html then use dragonBones directly.
I agree that it is hard to use DragonBonesJS out of the box.
I finally found a way to install it like a regular dependency, here is a Typescript project where I did it: https://gitlab.com/Alcalyn/game-draft
Main tricks was to:
npm install dragonbones-runtime@https://github.com/DragonBones/DragonBonesJS
tsconfig.json
to load dragon types:{
"compilerOptions": {
"...": "...",
"target": "es2017",
"module": "commonjs"
},
"include": [
"node_modules/dragonbones-runtime/DragonBones/src/**/*.ts",
"src/**/*.ts",
"test/**/*.ts"
]
}
<script src="./node_modules/dragonbones-runtime/Pixi/5.x/out/dragonBones.min.js"></script>
Hello. I'm baby in webdevelopment, and want to use animation, created in DragonBones Pro inside my website. So i'v downloaded pixi.js, and DragonBones.js from this repository and put them in lib folder together. Then in main.js trying to do that:
After that i can create:
and want to use dragonBone instance, but can't:
the same results if importing that way:
also i tried like this let db = require("./lib/dragonBones.js") console.log(db); // returns empty object {}
i looked in Spine2d.js sources and they do in IIFE PIXI.spine = pixi_spine; to incapsulate to PIXI namespace and use PIXI.spine.Spine(...), but there is no such way in DragonBones.
I tried to install it like you wrote:
2 ways i found for fix, but both are bad in my opinion:
Please help me, how import and use that lib in a proper way. Thanks, and sorry for my bad english.