UNPKG

pixi-dragonbones-runtime

Version:
3 lines (2 loc) 3.57 kB
"use strict";var e=require("../core/BaseObject.cjs");require("../core/DragonBones.cjs");class i extends e.BaseObject{constructor(){super(...arguments),this.cachedFrames=[],this.boneTimelines={},this.slotTimelines={},this.constraintTimelines={},this.animationTimelines={},this.boneCachedFrameIndices={},this.slotCachedFrameIndices={},this.actionTimeline=null,this.zOrderTimeline=null}static toString(){return"[class dragonBones.AnimationData]"}_onClear(){for(let e in this.boneTimelines){for(const i of this.boneTimelines[e])i.returnToPool();delete this.boneTimelines[e]}for(let e in this.slotTimelines){for(const i of this.slotTimelines[e])i.returnToPool();delete this.slotTimelines[e]}for(let e in this.constraintTimelines){for(const i of this.constraintTimelines[e])i.returnToPool();delete this.constraintTimelines[e]}for(let e in this.animationTimelines){for(const i of this.animationTimelines[e])i.returnToPool();delete this.animationTimelines[e]}for(let e in this.boneCachedFrameIndices)delete this.boneCachedFrameIndices[e];for(let e in this.slotCachedFrameIndices)delete this.slotCachedFrameIndices[e];null!==this.actionTimeline&&this.actionTimeline.returnToPool(),null!==this.zOrderTimeline&&this.zOrderTimeline.returnToPool(),this.frameIntOffset=0,this.frameFloatOffset=0,this.frameOffset=0,this.blendType=0,this.frameCount=0,this.playTimes=0,this.duration=0,this.scale=1,this.fadeInTime=0,this.cacheFrameRate=0,this.name="",this.cachedFrames.length=0,this.actionTimeline=null,this.zOrderTimeline=null,this.parent=null}cacheFrames(e){if(this.cacheFrameRate>0)return;this.cacheFrameRate=Math.max(Math.ceil(e*this.scale),1);const i=Math.ceil(this.cacheFrameRate*this.duration)+1;this.cachedFrames.length=i;for(let e=0,i=this.cacheFrames.length;e<i;++e)this.cachedFrames[e]=!1;for(const e of this.parent.sortedBones){const t=new Array(i);for(let e=0,i=t.length;e<i;++e)t[e]=-1;this.boneCachedFrameIndices[e.name]=t}for(const e of this.parent.sortedSlots){const t=new Array(i);for(let e=0,i=t.length;e<i;++e)t[e]=-1;this.slotCachedFrameIndices[e.name]=t}}addBoneTimeline(e,i){const t=e in this.boneTimelines?this.boneTimelines[e]:this.boneTimelines[e]=[];t.indexOf(i)<0&&t.push(i)}addSlotTimeline(e,i){const t=e in this.slotTimelines?this.slotTimelines[e]:this.slotTimelines[e]=[];t.indexOf(i)<0&&t.push(i)}addConstraintTimeline(e,i){const t=e in this.constraintTimelines?this.constraintTimelines[e]:this.constraintTimelines[e]=[];t.indexOf(i)<0&&t.push(i)}addAnimationTimeline(e,i){const t=e in this.animationTimelines?this.animationTimelines[e]:this.animationTimelines[e]=[];t.indexOf(i)<0&&t.push(i)}getBoneTimelines(e){return e in this.boneTimelines?this.boneTimelines[e]:null}getSlotTimelines(e){return e in this.slotTimelines?this.slotTimelines[e]:null}getConstraintTimelines(e){return e in this.constraintTimelines?this.constraintTimelines[e]:null}getAnimationTimelines(e){return e in this.animationTimelines?this.animationTimelines[e]:null}getBoneCachedFrameIndices(e){return e in this.boneCachedFrameIndices?this.boneCachedFrameIndices[e]:null}getSlotCachedFrameIndices(e){return e in this.slotCachedFrameIndices?this.slotCachedFrameIndices[e]:null}}class t extends e.BaseObject{static toString(){return"[class dragonBones.TimelineData]"}_onClear(){this.type=10,this.offset=0,this.frameIndicesOffset=-1}}exports.AnimationData=i,exports.AnimationTimelineData=class extends t{static toString(){return"[class dragonBones.AnimationTimelineData]"}_onClear(){super._onClear(),this.x=0,this.y=0}},exports.TimelineData=t; //# sourceMappingURL=AnimationData.cjs.map