mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[ts] Fix for rotation timelines in AnimationState
This commit is contained in:
parent
abc75a50e8
commit
3c254deb31
@ -1447,6 +1447,8 @@ var spine;
|
|||||||
return mix;
|
return mix;
|
||||||
};
|
};
|
||||||
AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
|
AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
|
||||||
|
if (firstFrame)
|
||||||
|
timelinesRotation[i] = 0;
|
||||||
if (alpha == 1) {
|
if (alpha == 1) {
|
||||||
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
|
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
|
||||||
return;
|
return;
|
||||||
@ -1475,12 +1477,7 @@ var spine;
|
|||||||
var r1 = setupPose ? bone.data.rotation : bone.rotation;
|
var r1 = setupPose ? bone.data.rotation : bone.rotation;
|
||||||
var total = 0, diff = r2 - r1;
|
var total = 0, diff = r2 - r1;
|
||||||
if (diff == 0) {
|
if (diff == 0) {
|
||||||
if (firstFrame) {
|
total = timelinesRotation[i];
|
||||||
timelinesRotation[i] = 0;
|
|
||||||
total = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
total = timelinesRotation[i];
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
|
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
|
||||||
@ -1570,6 +1567,7 @@ var spine;
|
|||||||
this.queue.interrupt(from);
|
this.queue.interrupt(from);
|
||||||
current.mixingFrom = from;
|
current.mixingFrom = from;
|
||||||
current.mixTime = 0;
|
current.mixTime = 0;
|
||||||
|
from.timelinesRotation.length = 0;
|
||||||
if (from.mixingFrom != null)
|
if (from.mixingFrom != null)
|
||||||
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -1447,6 +1447,8 @@ var spine;
|
|||||||
return mix;
|
return mix;
|
||||||
};
|
};
|
||||||
AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
|
AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
|
||||||
|
if (firstFrame)
|
||||||
|
timelinesRotation[i] = 0;
|
||||||
if (alpha == 1) {
|
if (alpha == 1) {
|
||||||
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
|
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
|
||||||
return;
|
return;
|
||||||
@ -1475,12 +1477,7 @@ var spine;
|
|||||||
var r1 = setupPose ? bone.data.rotation : bone.rotation;
|
var r1 = setupPose ? bone.data.rotation : bone.rotation;
|
||||||
var total = 0, diff = r2 - r1;
|
var total = 0, diff = r2 - r1;
|
||||||
if (diff == 0) {
|
if (diff == 0) {
|
||||||
if (firstFrame) {
|
total = timelinesRotation[i];
|
||||||
timelinesRotation[i] = 0;
|
|
||||||
total = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
total = timelinesRotation[i];
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
|
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
|
||||||
@ -1570,6 +1567,7 @@ var spine;
|
|||||||
this.queue.interrupt(from);
|
this.queue.interrupt(from);
|
||||||
current.mixingFrom = from;
|
current.mixingFrom = from;
|
||||||
current.mixTime = 0;
|
current.mixTime = 0;
|
||||||
|
from.timelinesRotation.length = 0;
|
||||||
if (from.mixingFrom != null)
|
if (from.mixingFrom != null)
|
||||||
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -1100,6 +1100,8 @@ var spine;
|
|||||||
return mix;
|
return mix;
|
||||||
};
|
};
|
||||||
AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
|
AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
|
||||||
|
if (firstFrame)
|
||||||
|
timelinesRotation[i] = 0;
|
||||||
if (alpha == 1) {
|
if (alpha == 1) {
|
||||||
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
|
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
|
||||||
return;
|
return;
|
||||||
@ -1128,12 +1130,7 @@ var spine;
|
|||||||
var r1 = setupPose ? bone.data.rotation : bone.rotation;
|
var r1 = setupPose ? bone.data.rotation : bone.rotation;
|
||||||
var total = 0, diff = r2 - r1;
|
var total = 0, diff = r2 - r1;
|
||||||
if (diff == 0) {
|
if (diff == 0) {
|
||||||
if (firstFrame) {
|
total = timelinesRotation[i];
|
||||||
timelinesRotation[i] = 0;
|
|
||||||
total = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
total = timelinesRotation[i];
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
|
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
|
||||||
@ -1223,6 +1220,7 @@ var spine;
|
|||||||
this.queue.interrupt(from);
|
this.queue.interrupt(from);
|
||||||
current.mixingFrom = from;
|
current.mixingFrom = from;
|
||||||
current.mixTime = 0;
|
current.mixTime = 0;
|
||||||
|
from.timelinesRotation.length = 0;
|
||||||
if (from.mixingFrom != null)
|
if (from.mixingFrom != null)
|
||||||
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -1100,6 +1100,8 @@ var spine;
|
|||||||
return mix;
|
return mix;
|
||||||
};
|
};
|
||||||
AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
|
AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
|
||||||
|
if (firstFrame)
|
||||||
|
timelinesRotation[i] = 0;
|
||||||
if (alpha == 1) {
|
if (alpha == 1) {
|
||||||
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
|
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
|
||||||
return;
|
return;
|
||||||
@ -1128,12 +1130,7 @@ var spine;
|
|||||||
var r1 = setupPose ? bone.data.rotation : bone.rotation;
|
var r1 = setupPose ? bone.data.rotation : bone.rotation;
|
||||||
var total = 0, diff = r2 - r1;
|
var total = 0, diff = r2 - r1;
|
||||||
if (diff == 0) {
|
if (diff == 0) {
|
||||||
if (firstFrame) {
|
total = timelinesRotation[i];
|
||||||
timelinesRotation[i] = 0;
|
|
||||||
total = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
total = timelinesRotation[i];
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
|
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
|
||||||
@ -1223,6 +1220,7 @@ var spine;
|
|||||||
this.queue.interrupt(from);
|
this.queue.interrupt(from);
|
||||||
current.mixingFrom = from;
|
current.mixingFrom = from;
|
||||||
current.mixTime = 0;
|
current.mixTime = 0;
|
||||||
|
from.timelinesRotation.length = 0;
|
||||||
if (from.mixingFrom != null)
|
if (from.mixingFrom != null)
|
||||||
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -1100,6 +1100,8 @@ var spine;
|
|||||||
return mix;
|
return mix;
|
||||||
};
|
};
|
||||||
AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
|
AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
|
||||||
|
if (firstFrame)
|
||||||
|
timelinesRotation[i] = 0;
|
||||||
if (alpha == 1) {
|
if (alpha == 1) {
|
||||||
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
|
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
|
||||||
return;
|
return;
|
||||||
@ -1128,12 +1130,7 @@ var spine;
|
|||||||
var r1 = setupPose ? bone.data.rotation : bone.rotation;
|
var r1 = setupPose ? bone.data.rotation : bone.rotation;
|
||||||
var total = 0, diff = r2 - r1;
|
var total = 0, diff = r2 - r1;
|
||||||
if (diff == 0) {
|
if (diff == 0) {
|
||||||
if (firstFrame) {
|
total = timelinesRotation[i];
|
||||||
timelinesRotation[i] = 0;
|
|
||||||
total = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
total = timelinesRotation[i];
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
|
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
|
||||||
@ -1223,6 +1220,7 @@ var spine;
|
|||||||
this.queue.interrupt(from);
|
this.queue.interrupt(from);
|
||||||
current.mixingFrom = from;
|
current.mixingFrom = from;
|
||||||
current.mixTime = 0;
|
current.mixTime = 0;
|
||||||
|
from.timelinesRotation.length = 0;
|
||||||
if (from.mixingFrom != null)
|
if (from.mixingFrom != null)
|
||||||
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -1100,6 +1100,8 @@ var spine;
|
|||||||
return mix;
|
return mix;
|
||||||
};
|
};
|
||||||
AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
|
AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
|
||||||
|
if (firstFrame)
|
||||||
|
timelinesRotation[i] = 0;
|
||||||
if (alpha == 1) {
|
if (alpha == 1) {
|
||||||
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
|
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
|
||||||
return;
|
return;
|
||||||
@ -1128,12 +1130,7 @@ var spine;
|
|||||||
var r1 = setupPose ? bone.data.rotation : bone.rotation;
|
var r1 = setupPose ? bone.data.rotation : bone.rotation;
|
||||||
var total = 0, diff = r2 - r1;
|
var total = 0, diff = r2 - r1;
|
||||||
if (diff == 0) {
|
if (diff == 0) {
|
||||||
if (firstFrame) {
|
total = timelinesRotation[i];
|
||||||
timelinesRotation[i] = 0;
|
|
||||||
total = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
total = timelinesRotation[i];
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
|
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
|
||||||
@ -1223,6 +1220,7 @@ var spine;
|
|||||||
this.queue.interrupt(from);
|
this.queue.interrupt(from);
|
||||||
current.mixingFrom = from;
|
current.mixingFrom = from;
|
||||||
current.mixTime = 0;
|
current.mixTime = 0;
|
||||||
|
from.timelinesRotation.length = 0;
|
||||||
if (from.mixingFrom != null)
|
if (from.mixingFrom != null)
|
||||||
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -211,6 +211,9 @@ module spine {
|
|||||||
|
|
||||||
applyRotateTimeline (timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, setupPose: boolean,
|
applyRotateTimeline (timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, setupPose: boolean,
|
||||||
timelinesRotation: Array<number>, i: number, firstFrame: boolean) {
|
timelinesRotation: Array<number>, i: number, firstFrame: boolean) {
|
||||||
|
|
||||||
|
if (firstFrame) timelinesRotation[i] = 0;
|
||||||
|
|
||||||
if (alpha == 1) {
|
if (alpha == 1) {
|
||||||
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
|
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
|
||||||
return;
|
return;
|
||||||
@ -245,11 +248,7 @@ module spine {
|
|||||||
let r1 = setupPose ? bone.data.rotation : bone.rotation;
|
let r1 = setupPose ? bone.data.rotation : bone.rotation;
|
||||||
let total = 0, diff = r2 - r1;
|
let total = 0, diff = r2 - r1;
|
||||||
if (diff == 0) {
|
if (diff == 0) {
|
||||||
if (firstFrame) {
|
total = timelinesRotation[i];
|
||||||
timelinesRotation[i] = 0;
|
|
||||||
total = 0;
|
|
||||||
} else
|
|
||||||
total = timelinesRotation[i];
|
|
||||||
} else {
|
} else {
|
||||||
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
|
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
|
||||||
let lastTotal = 0, lastDiff = 0;
|
let lastTotal = 0, lastDiff = 0;
|
||||||
@ -347,6 +346,8 @@ module spine {
|
|||||||
current.mixingFrom = from;
|
current.mixingFrom = from;
|
||||||
current.mixTime = 0;
|
current.mixTime = 0;
|
||||||
|
|
||||||
|
from.timelinesRotation.length = 0;
|
||||||
|
|
||||||
// If not completely mixed in, set mixAlpha so mixing out happens from current mix to zero.
|
// 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);
|
if (from.mixingFrom != null) current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user