!function(){function t(t){this.type=t.type;this.keyframeOpt=t;this.changeFrame(t)}function e(){}inherits(t,QyTimeline);window.QyKeyframe=t;t.prototype.changeFrame=function(t){this.loop=null!=t.loop?t.loop:!0;this.startPosition=null!=t.startPosition?t.startPosition:0;if("multiImages"==this.type){this.setupMultiImages(t.frames);this.xStart=0;this.yStart=0}else if("largeImage"==this.type&&void 0!==t.total){this.setupLargeImage(t);this.xStart=0;this.yStart=0}else{if("string"==typeof t)t=this.frames&&this.frames[t];else if(t.frames){this.frames=t.frames;t=t.frames[t.defaultFrame]}this.delay=null!=t.delay?60*t.delay:200;this.xNum=t.xNum||1;this.xStart=null!=t.xStart?t.xStart:0;this.xEnd=null!=t.xEnd?t.xEnd:this.xNum-1;this.yStart=null!=t.yStart?t.yStart:0;this.yEnd=t.yEnd?t.yEnd:this.yStart;this.xLen=this.xEnd-this.xStart+1;this.yLen=this.yEnd-this.yStart+1,this.setupStepDefs()}this.target=this;QyTimeline.call(this,{delay:0,loop:this.loop,startPosition:this.startPosition});t.sprite&&this.setSprite(t.sprite)};t.prototype.showOneMultiImgsFrame=function(t){var e=t.extraArg[0],s=this.frames[e];this.sprite.setTexture(PIXI.Texture.fromImage(s.url));return this};t.prototype.showOneLargeImgFrame=function(t){var e=t.extraArg[0],s=t.extraArg[1],i=this.frame,r=this.size,a=i.hFrameOffset+e,h=i.vFrameOffset+s,n=i.hPixelOffset+r.width*a+e*i.hSplit,o=i.vPixelOffset+r.height*h+s*i.vSplit;this.setPixiFrame(n,o,r.width,r.height);return this};t.prototype.setupMultiImages=function(t){this.frames=t;var s=t.length,i=0;this.stepDefs_=new Array(s+1);for(var r=0;s>r;r++){this.stepDefs_[r]=[i,this.showOneMultiImgsFrame,[r]];i+=100*t[r].delay}this.stepDefs_[s]=[i,e];this.stepMax_=i+1;return this};t.prototype.setupLargeImage=function(t){this.frame=t;var s=t.total,i=100*t.delay,r=t.xNum;this.stepDefs_=new Array(s+1);for(var a=0;s>a;a++)this.stepDefs_[a]=[a*i,this.showOneLargeImgFrame,[a%r,Math.floor(a/r)]];this.stepDefs_[s]=[s*i,e];this.stepMax_=s*i+1;return this};t.prototype.setupStepDefs=function(){var t=this.xStart,s=this.xLen,i=this.yStart,r=this.yLen,a=this.delay,h=s*r,n=0;this.stepDefs_=new Array(h+1);for(var o=0;r>o;o++)for(var p=0;s>p;p++){n=o*s+p;this.stepDefs_[n]=[n*a,this.showFrame,[t+p,i+o]]}this.stepDefs_[h]=[h*a,e];this.stepMax_=h*a+1;return this};t.prototype.showFrame=function(t){var e=t.extraArg,s=e[0],i=e[1],r=this.size;this.setPixiFrame(s*r.width,i*r.height,r.width,r.height);return this};t.prototype.setPixiFrame=function(t,e,s,i){var r=this.sprite,a=t+":"+e;r.pixiFrames||(r.pixiFrames={});if(!r.pixiFrames[a]){var h={x:t*qyengine.gRenderer.resolution,y:e*qyengine.gRenderer.resolution,width:s*qyengine.gRenderer.resolution,height:i*qyengine.gRenderer.resolution};r.pixiFrames[a]=new PIXI.Texture(r.texture.baseTexture,h);r.setSize(s,i)}r.setTexture(r.pixiFrames[a])};t.prototype.setSprite=function(t){this.sprite=t;this.size=t.getSize();return this};var s=!1;t.prototype.getDirector=function(){return current_scene.isPaused_&&s?null:qyengine.getDirector()};t.prototype.setSpeed=function(t,e){var s;if("multiImages"===this.type){var i;if(e){t+=100;i=JSON.parse(JSON.stringify(this.frames||[]))}else{i=this.keyframeOpt&&this.keyframeOpt.frames;i=JSON.parse(JSON.stringify(i||[]))}i&&i.length&&i.forEach(function(e){e.delay/=t/100});s={loop:this.loop,frames:i,startPosition:this.startPosition}}else if("largeImage"===this.type){var r;if(e){t+=100;r=JSON.parse(JSON.stringify(this.frame||{}))}else{r=this.keyframeOpt;r=JSON.parse(JSON.stringify(r||{}))}r.delay/=t/100;s=r}else{s=this;if(e){t+=100;this.delay=this.delay/100/t*100}else this.delay=this.keyframeOpt&&this.keyframeOpt.delay/100/t*100}this.stop();this.changeFrame(s);this.start()}}();