You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
import "./lib/pixi.js" //ver pixi.js - v4.8.1
import "./lib/dragonBones.js" //ver 5.6.300
After that i can create:
let cvs= document.getElementById("canvasId");
let app = new PIXI.Application({view: canvasId});
and want to use dragonBone instance, but can't:
console.log(dragonBones); // dragonBones is not defined
console.log(DragonBones); // DragonBones not defined
console.log(dragonBones.DragonBones); // dragonBones not defined
console.log(new dragonBones()); // dragonBones not defined
console.log(new DragonBones()); // DragonBones is not defined
console.log(PIXI.dragonBones.DragonBones); // not defined
the same results if importing that way:
import {dragonBones} from "./lib/dragonBones.js" //ver 5.6.300
import {dragonBones as DragonBones} from "./lib/dragonBones.js" //ver 5.6.300
import * as dragonBones from "./lib/dragonBones.js" //ver 5.6.300
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:
npm install -g dragonbones-runtime
dbr pixijs@4.6.2
and put that files to lib, but again can't import use it
2 ways i found for fix, but both are bad in my opinion:
add exports.dragonBones = dragonBones; at the end of dragonBones.js
or npm i dragonbones-pixi from (https://www.npmjs.com/package/dragonbones-pixi) I don't know if the publisher is official dragonbone developer, but an export is already exists in the end of the file.
Also the files are different for about 1500+ rows of code (14227 vs 15850).
Please help me, how import and use that lib in a proper way. Thanks, and sorry for my bad english.
The text was updated successfully, but these errors were encountered:
clifftm
changed the title
Proper import dragonbones
Proper import dragonbones.js
Jun 13, 2018
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:
and put that files to lib, but again can't import use it
2 ways i found for fix, but both are bad in my opinion:
Also the files are different for about 1500+ rows of code (14227 vs 15850).
Please help me, how import and use that lib in a proper way. Thanks, and sorry for my bad english.
The text was updated successfully, but these errors were encountered: