zoukankan      html  css  js  c++  java
  • 龙骨的创建与销毁

    龙骨

    同一个项目可以包含多个骨架,比如 人开车,人和车都可以是单独的骨架

    创建&&运用

      //读取一个骨骼数据,并创建实例显示到舞台
            var skeletonData = RES.getRes("skeleton_json");
            var textureData = RES.getRes("skeleton_tex_json");
            var texture = RES.getRes("skeleton_tex_png");
    	//创建骨骼管理器
            var factory = new dragonBones.EgretFactory();
           //插入骨骼控制配置
    	   factory.addDragonBonesData(dragonBones.DataParser.parseDragonBonesData(skeletonData));
    	   //插入纹理集
            factory.addTextureAtlasData(factory.parseTextureAtlasData(textureData, texture));
    	//读取骨架
            this.armature = factory.buildArmature("Robot");
    		//读取显示对象
            this.armatureDisplay = this.armature.getDisplay();
    		//骨骼计时器开始工作
            dragonBones.WorldClock.clock.add(this.armature);
            this.container.addChild(this.armatureDisplay);
            this.armatureDisplay.x = 0;
            this.armatureDisplay.y = 0;
            this.actionFlag = 0;
            //启动骨骼动画播放
            this.armature.animation.gotoAndPlay(this.actionArray[this.actionFlag]);
    
    		egret.startTick(this.onTicker, this);
    
        private onTicker(timeStamp:number) {
    
            if(!this._time) {
                this._time = timeStamp;
            }
    
            var now = timeStamp;
            var pass = now - this._time;
            this._time = now;
    
            dragonBones.WorldClock.clock.advanceTime(pass / 1000);
    
            return false;
        }
    

    参考 运用骨骼动画

    销毁

    this.armature.animation.stop();
            this.armature.dispose();
            this.removeChild(this.armature.display);
            egret.Ticker.getInstance().unregister(
                函数
            );
            dragonBones.WorldClock.clock.remove(this.armature);
            this.armature = null;
    
    
  • 相关阅读:
    Linux 定时任务
    VIM快速使用
    ulimit 命令
    PG语句
    linux下的PGSQL安装步骤
    linux下安装mysql 5.5和5.6.32
    linux下安装达梦数据库(DM8)x86版本
    redis配置
    sql server 2008安装
    linux下安装部署oracle
  • 原文地址:https://www.cnblogs.com/wyy5552/p/8833476.html
Copyright © 2011-2022 走看看