[ts] Fix for rotation timelines in AnimationState

This commit is contained in:
badlogic 2016-11-29 13:06:08 +01:00
parent abc75a50e8
commit 3c254deb31
13 changed files with 41 additions and 52 deletions

View File

@ -1447,6 +1447,8 @@ var spine;
return mix;
};
AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
if (firstFrame)
timelinesRotation[i] = 0;
if (alpha == 1) {
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
return;
@ -1475,12 +1477,7 @@ var spine;
var r1 = setupPose ? bone.data.rotation : bone.rotation;
var total = 0, diff = r2 - r1;
if (diff == 0) {
if (firstFrame) {
timelinesRotation[i] = 0;
total = 0;
}
else
total = timelinesRotation[i];
total = timelinesRotation[i];
}
else {
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
@ -1570,6 +1567,7 @@ var spine;
this.queue.interrupt(from);
current.mixingFrom = from;
current.mixTime = 0;
from.timelinesRotation.length = 0;
if (from.mixingFrom != null)
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
}

File diff suppressed because one or more lines are too long

View File

@ -1447,6 +1447,8 @@ var spine;
return mix;
};
AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
if (firstFrame)
timelinesRotation[i] = 0;
if (alpha == 1) {
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
return;
@ -1475,12 +1477,7 @@ var spine;
var r1 = setupPose ? bone.data.rotation : bone.rotation;
var total = 0, diff = r2 - r1;
if (diff == 0) {
if (firstFrame) {
timelinesRotation[i] = 0;
total = 0;
}
else
total = timelinesRotation[i];
total = timelinesRotation[i];
}
else {
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
@ -1570,6 +1567,7 @@ var spine;
this.queue.interrupt(from);
current.mixingFrom = from;
current.mixTime = 0;
from.timelinesRotation.length = 0;
if (from.mixingFrom != null)
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
}

File diff suppressed because one or more lines are too long

View File

@ -1100,6 +1100,8 @@ var spine;
return mix;
};
AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
if (firstFrame)
timelinesRotation[i] = 0;
if (alpha == 1) {
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
return;
@ -1128,12 +1130,7 @@ var spine;
var r1 = setupPose ? bone.data.rotation : bone.rotation;
var total = 0, diff = r2 - r1;
if (diff == 0) {
if (firstFrame) {
timelinesRotation[i] = 0;
total = 0;
}
else
total = timelinesRotation[i];
total = timelinesRotation[i];
}
else {
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
@ -1223,6 +1220,7 @@ var spine;
this.queue.interrupt(from);
current.mixingFrom = from;
current.mixTime = 0;
from.timelinesRotation.length = 0;
if (from.mixingFrom != null)
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
}

File diff suppressed because one or more lines are too long

View File

@ -1100,6 +1100,8 @@ var spine;
return mix;
};
AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
if (firstFrame)
timelinesRotation[i] = 0;
if (alpha == 1) {
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
return;
@ -1128,12 +1130,7 @@ var spine;
var r1 = setupPose ? bone.data.rotation : bone.rotation;
var total = 0, diff = r2 - r1;
if (diff == 0) {
if (firstFrame) {
timelinesRotation[i] = 0;
total = 0;
}
else
total = timelinesRotation[i];
total = timelinesRotation[i];
}
else {
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
@ -1223,6 +1220,7 @@ var spine;
this.queue.interrupt(from);
current.mixingFrom = from;
current.mixTime = 0;
from.timelinesRotation.length = 0;
if (from.mixingFrom != null)
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
}

File diff suppressed because one or more lines are too long

View File

@ -1100,6 +1100,8 @@ var spine;
return mix;
};
AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
if (firstFrame)
timelinesRotation[i] = 0;
if (alpha == 1) {
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
return;
@ -1128,12 +1130,7 @@ var spine;
var r1 = setupPose ? bone.data.rotation : bone.rotation;
var total = 0, diff = r2 - r1;
if (diff == 0) {
if (firstFrame) {
timelinesRotation[i] = 0;
total = 0;
}
else
total = timelinesRotation[i];
total = timelinesRotation[i];
}
else {
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
@ -1223,6 +1220,7 @@ var spine;
this.queue.interrupt(from);
current.mixingFrom = from;
current.mixTime = 0;
from.timelinesRotation.length = 0;
if (from.mixingFrom != null)
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
}

File diff suppressed because one or more lines are too long

View File

@ -1100,6 +1100,8 @@ var spine;
return mix;
};
AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
if (firstFrame)
timelinesRotation[i] = 0;
if (alpha == 1) {
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
return;
@ -1128,12 +1130,7 @@ var spine;
var r1 = setupPose ? bone.data.rotation : bone.rotation;
var total = 0, diff = r2 - r1;
if (diff == 0) {
if (firstFrame) {
timelinesRotation[i] = 0;
total = 0;
}
else
total = timelinesRotation[i];
total = timelinesRotation[i];
}
else {
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
@ -1223,6 +1220,7 @@ var spine;
this.queue.interrupt(from);
current.mixingFrom = from;
current.mixTime = 0;
from.timelinesRotation.length = 0;
if (from.mixingFrom != null)
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
}

File diff suppressed because one or more lines are too long

View File

@ -80,8 +80,8 @@ module spine {
next = next.mixingFrom;
}
continue;
}
} else {
}
} else {
// Clear the track when there is no next entry, the track end time is reached, and there is no mixingFrom.
if (current.trackLast >= current.trackEnd && current.mixingFrom == null) {
tracks[i] = null;
@ -111,9 +111,9 @@ module spine {
}
from.animationLast = from.nextAnimationLast;
from.trackLast = from.nextTrackLast;
from.trackLast = from.nextTrackLast;
from.trackTime += delta * from.timeScale;
entry.mixTime += delta * from.timeScale;
entry.mixTime += delta * from.timeScale;
}
apply (skeleton: Skeleton) {
@ -129,7 +129,7 @@ module spine {
// Apply mixing from entries first.
let mix = current.alpha;
if (current.mixingFrom != null)
if (current.mixingFrom != null)
mix *= this.applyMixingFrom(current, skeleton);
else if (current.trackTime >= current.trackEnd)
mix = 0;
@ -211,6 +211,9 @@ module spine {
applyRotateTimeline (timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, setupPose: boolean,
timelinesRotation: Array<number>, i: number, firstFrame: boolean) {
if (firstFrame) timelinesRotation[i] = 0;
if (alpha == 1) {
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
return;
@ -245,11 +248,7 @@ module spine {
let r1 = setupPose ? bone.data.rotation : bone.rotation;
let total = 0, diff = r2 - r1;
if (diff == 0) {
if (firstFrame) {
timelinesRotation[i] = 0;
total = 0;
} else
total = timelinesRotation[i];
total = timelinesRotation[i];
} else {
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
let lastTotal = 0, lastDiff = 0;
@ -347,6 +346,8 @@ module spine {
current.mixingFrom = from;
current.mixTime = 0;
from.timelinesRotation.length = 0;
// If not completely mixed in, set mixAlpha so mixing out happens from current mix to zero.
if (from.mixingFrom != null) current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
}