Coder Social home page Coder Social logo

schmidtsonian / dragonbonesjs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 06wj/dragonbonesjs

0.0 2.0 0.0 5.08 MB

DragonBones Library JavaScript Version

Home Page: http://06wj.github.io/DragonBonesJS/demo/index.html

License: MIT License

JavaScript 86.61% HTML 0.07% TypeScript 13.32%

dragonbonesjs's Introduction

DragonBonesJS

DragonBones Library JavaScript Version

Info

This is DragonBones Library JavaScript Version. Update to 4.0 version.

It now support pixi.js factory and dom factory. you can add your own render factory like this factory;

Official DragonBones use typescript and only support egret. I transform it and now can easily support multi render library.

Demo

Usage

  • dragonbones-alone.js is dragonbones without factory.

  • dragonbones-dom.js is dragonbones width dom factory.

  • dragonbones-pixi.js is dragonbones width pixi factory.

  • quick start:

    //create DomFactory
    var dragonbonesFactory = new dragonBones.DomFactory();
    
    //or create PixiFactory
    var dragonbonesFactory = new dragonBones.PixiFactory();
    
    /**
     * add texture data and skeleton data
     * textureImg is a load completed Image
     * textureData is texture json data
     * skeletonData is skeleton json data
     */
    dragonbonesFactory.addTextureAtlas(new dragonBones.TextureAtlas(textureImg, textureData));
    dragonbonesFactory.addDragonBonesData(dragonBones.DataParser.parseDragonBonesData(skeletonData));
    
    //create armature
    var armature = dragonbonesFactory.buildArmature(skeletonData.armature[0].name);
    
    //play
    armature.animation.gotoAndPlay('walk');
    
    //add armature to clock
    dragonBones.WorldClock.clock.add(armature);
    
    //you need to run dragonBones.WorldClock like this to run the armature
    var t = new Date().getTime();
    function tick(){
        var now = new Date().getTime();
        dragonBones.WorldClock.clock.advanceTime((now - t)*0.001);
        t = now;
        requestAnimationFrame(tick);
    }
    tick();

see official tutorial for more info.

Compile and build

Built by gulp:

  • run npm install -g gulp to install gulp.
  • run npm install to install all dependencies.
  • run gulp to build source.
  • run gulp watch to watch and auto build source.

License

MIT License

dragonbonesjs's People

Contributors

06wj avatar

Watchers

Esteban avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.