Add minor fixes on Skeleton extension (#568)

This commit is contained in:
Lizard-13
2018-07-31 05:24:39 -03:00
committed by Florian Rival
parent 35e3015d66
commit 2ed9b058be
2 changed files with 4 additions and 2 deletions

View File

@@ -183,7 +183,7 @@ gdjs.sk.Armature.prototype.setRenderers = function(){
}
}
if(this.isRoot){
if(this.isRoot && this.debugRenderer){
this.renderer.addDebugRenderer(this.debugRenderer);
}
};

View File

@@ -155,7 +155,7 @@ gdjs.sk.Animation.prototype.update = function(delta){
this.finished = true;
}
var frame = this.getFrameAtTime(this.time);
var frame = this.finished ? this.shared.duration : this.getFrameAtTime(this.time);
for(var i=0; i<this.boneAnimators.length; i++){
this.boneAnimators[i].setFrame(frame);
@@ -937,6 +937,8 @@ gdjs.sk.BlendBoneAnimator.prototype.blend = function(first, second, duration){
var x1 = second ? second.shared.channelX.getKey(0) : 0.0;
var y1 = second ? second.shared.channelY.getKey(0) : 0.0;
var rot1 = second ? second.shared.channelRot.getKey(0) : 0.0;
if(rot1 <= 0 && Math.abs(rot1 - rot0) > Math.abs(rot1 + 360 - rot0)) rot1 += 360;
if(rot1 >= 0 && Math.abs(rot1 - rot0) > Math.abs(rot1 - 360 - rot0)) rot1 -= 360;
var sx1 = second ? second.shared.channelSclX.getKey(0) : 1.0;
var sy1 = second ? second.shared.channelSclY.getKey(0) : 1.0;
this.channelX.blend(x0, x1, duration);