Merge remote-tracking branch 'origin/3.6-beta' into 3.6-beta

This commit is contained in:
Nathan Sweet 2017-04-10 22:08:53 +09:00
commit dab4c27da7
24 changed files with 6121 additions and 145 deletions

View File

@ -28,14 +28,12 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/ *****************************************************************************/
package spine.animation { package spine.animation {
import spine.MathUtils;
import spine.Bone; import spine.Bone;
import spine.Pool;
import flash.utils.Dictionary;
import spine.Event; import spine.Event;
import spine.MathUtils;
import spine.Pool;
import spine.Skeleton; import spine.Skeleton;
import flash.utils.Dictionary;
public class AnimationState { public class AnimationState {
internal static var emptyAnimation : Animation = new Animation("<empty>", new Vector.<Timeline>(), 0); internal static var emptyAnimation : Animation = new Animation("<empty>", new Vector.<Timeline>(), 0);
@ -365,21 +363,19 @@ package spine.animation {
var mixingFrom : TrackEntry = from.mixingFrom; var mixingFrom : TrackEntry = from.mixingFrom;
if (mixingFrom != null && from.mixDuration > 0) { if (mixingFrom != null && from.mixDuration > 0) {
// A mix was interrupted, mix from the closest animation. if (multipleMixing) {
if (!multipleMixing && from.mixTime / from.mixDuration < 0.5 && mixingFrom.animation != AnimationState.emptyAnimation) { current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
current.mixingFrom = mixingFrom; } else {
mixingFrom.mixingFrom = from; // A mix was interrupted, mix from the closest animation.
mixingFrom.mixTime = from.mixDuration - from.mixTime; if (from.mixTime / from.mixDuration < 0.5 && mixingFrom.animation != AnimationState.emptyAnimation) {
mixingFrom.mixDuration = from.mixDuration; current.mixingFrom = mixingFrom;
from.mixingFrom = null; mixingFrom.mixingFrom = from;
from = mixingFrom; mixingFrom.mixTime = from.mixDuration - from.mixTime;
} mixingFrom.mixDuration = from.mixDuration;
from.mixingFrom = null;
from = mixingFrom;
}
// The interrupted mix will mix out from its current percentage to zero.
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
// End the other animation after it is applied one last time.
if (!multipleMixing) {
from.mixAlpha = 0; from.mixAlpha = 0;
from.mixTime = 0; from.mixTime = 0;
from.mixDuration = 0; from.mixDuration = 0;
@ -551,9 +547,7 @@ package spine.animation {
if (multipleMixing) return; if (multipleMixing) return;
// Set timelinesLast for mixingFrom entries, from highest track to lowest that has mixingFrom. // Set timelinesLast for mixingFrom entries, from highest track to lowest that has mixingFrom.
for (var key2 : String in propertyIDs) { propertyIDs = this.propertyIDs = new Dictionary();
delete propertyIDs[key2];
}
var lowestMixingFrom : int = n; var lowestMixingFrom : int = n;
for (i = 0; i < n; i++) { // Find lowest track with a mixingFrom entry. for (i = 0; i < n; i++) { // Find lowest track with a mixingFrom entry.
entry = tracks[i]; entry = tracks[i];
@ -568,8 +562,7 @@ package spine.animation {
// Store properties for non-mixingFrom entry but don't set timelinesLast, which is only used for mixingFrom entries. // Store properties for non-mixingFrom entry but don't set timelinesLast, which is only used for mixingFrom entries.
var timelines : Vector.<Timeline> = entry.animation.timelines; var timelines : Vector.<Timeline> = entry.animation.timelines;
for (var ii : int = 0, nn : int = entry.animation.timelines.length; ii < nn; ii++) for (var ii : int = 0, nn : int = entry.animation.timelines.length; ii < nn; ii++)
var id : String = timelines[ii].getPropertyId().toString(); propertyIDs[timelines[ii].getPropertyId().toString()] = true;
propertyIDs[id] = id;
entry = entry.mixingFrom; entry = entry.mixingFrom;
while (entry != null) { while (entry != null) {
@ -591,8 +584,7 @@ package spine.animation {
var usage : Vector.<Boolean> = entry.timelinesFirst; var usage : Vector.<Boolean> = entry.timelinesFirst;
usage.length = n; usage.length = n;
for (var i : int = 0; i < n; i++) { for (var i : int = 0; i < n; i++) {
var id : String = timelines[i].getPropertyId().toString(); propertyIDs[timelines[i].getPropertyId().toString()] = true;
propertyIDs[id] = id;
usage[i] = true; usage[i] = true;
} }
} }
@ -611,7 +603,7 @@ package spine.animation {
for (var i : int = 0; i < n; i++) { for (var i : int = 0; i < n; i++) {
var id : String = timelines[i].getPropertyId().toString(); var id : String = timelines[i].getPropertyId().toString();
usage[i] = !propertyIDs.hasOwnProperty(id); usage[i] = !propertyIDs.hasOwnProperty(id);
propertyIDs[id] = id; propertyIDs[id] = true;
} }
} }

View File

@ -591,17 +591,18 @@ void _spAnimationState_setCurrent (spAnimationState* self, int index, spTrackEnt
mixingFrom = from->mixingFrom; mixingFrom = from->mixingFrom;
if (mixingFrom != 0 && from->mixDuration > 0) { if (mixingFrom != 0 && from->mixDuration > 0) {
if (self->multipleMixing && from->mixTime / from->mixDuration < 0.5 && mixingFrom->animation != SP_EMPTY_ANIMATION) { if (self->multipleMixing) {
current->mixingFrom = mixingFrom; current->mixAlpha *= MIN(from->mixTime / from->mixDuration, 1);
mixingFrom->mixingFrom = from; } else {
mixingFrom->mixTime = from->mixDuration - from->mixTime; if (from->mixTime / from->mixDuration < 0.5 && mixingFrom->animation != SP_EMPTY_ANIMATION) {
mixingFrom->mixDuration = from->mixDuration; current->mixingFrom = mixingFrom;
from->mixingFrom = 0; mixingFrom->mixingFrom = from;
from = mixingFrom; mixingFrom->mixTime = from->mixDuration - from->mixTime;
} mixingFrom->mixDuration = from->mixDuration;
from->mixingFrom = 0;
from = mixingFrom;
}
current->mixAlpha *= MIN(from->mixTime / from->mixDuration, 1);
if (!self->multipleMixing) {
from->mixAlpha = 0; from->mixAlpha = 0;
from->mixTime = 0; from->mixTime = 0;
from->mixDuration = 0; from->mixDuration = 0;

View File

@ -371,7 +371,7 @@ function AnimationState:applyMixingFrom (entry, skeleton)
for i,timeline in ipairs(timelines) do for i,timeline in ipairs(timelines) do
local setupPose = timelinesFirst[i] local setupPose = timelinesFirst[i]
local alpha = 1; local alpha = 1;
if (timelinesLast ~= nil and setupPose and not timlinesLast[i]) then if (timelinesLast ~= nil and setupPose and not timelinesLast[i]) then
alpha = alphaBase alpha = alphaBase
else else
alpha = alphaMix alpha = alphaMix
@ -396,7 +396,10 @@ function AnimationState:applyMixingFrom (entry, skeleton)
end end
function AnimationState:applyRotateTimeline (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) function AnimationState:applyRotateTimeline (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame)
if firstFrame then timelinesRotation[i] = 0 end if firstFrame then
timelinesRotation[i] = 0
timelinesRotation[i+1] = 0
end
if alpha == 1 then if alpha == 1 then
timeline:apply(skeleton, 0, time, nil, 1, setupPose, false) timeline:apply(skeleton, 0, time, nil, 1, setupPose, false)
@ -554,18 +557,18 @@ function AnimationState:setCurrent (index, current, interrupt)
local mixingFrom = from.mixingFrom local mixingFrom = from.mixingFrom
if (mixingFrom ~= nil and from.mixDuration > 0) then if (mixingFrom ~= nil and from.mixDuration > 0) then
if (not self.multipleMixing and from.mixTime / from.mixDuration < 0.5 and mixingFrom.animation ~= EMPTY_ANIMATION) then if (self.multipleMixing) then
current.mixingFrom = mixingFrom current.mixAlpha = current.mixAlpha * math_min(from.mixTime / from.mixDuration, 1)
mixingFrom.mixingFrom = from else
mixingFrom.mixTime = from.mixDuration - from.mixTime if (from.mixTime / from.mixDuration < 0.5 and mixingFrom.animation ~= EMPTY_ANIMATION) then
mixingFrom.mixDuration = from.mixDuration current.mixingFrom = mixingFrom
from.mixingFrom = nil mixingFrom.mixingFrom = from
from = mixingFrom mixingFrom.mixTime = from.mixDuration - from.mixTime
end mixingFrom.mixDuration = from.mixDuration
from.mixingFrom = nil
from = mixingFrom
end
current.mixAlpha = current.mixAlpha * math_min(from.mixTime / from.mixDuration, 1)
if (not self.multipleMixing) then
from.mixAlpha = 0; from.mixAlpha = 0;
from.mixTime = 0; from.mixTime = 0;
from.mixDuration = 0; from.mixDuration = 0;

View File

@ -3,7 +3,7 @@
<AS3LibraryFolder>lib</AS3LibraryFolder> <AS3LibraryFolder>lib</AS3LibraryFolder>
<AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/player/{playerVersion}/playerglobal.swc</AS3Classpath> <AS3Classpath generateProblems="true" sdkBased="true" type="lib" useAsSharedCode="false">frameworks/libs/player/{playerVersion}/playerglobal.swc</AS3Classpath>
<AS3Classpath generateProblems="true" sdkBased="false" type="source" useAsSharedCode="false">src</AS3Classpath> <AS3Classpath generateProblems="true" sdkBased="false" type="source" useAsSharedCode="false">src</AS3Classpath>
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/spine-as3.swc</AS3Classpath>
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/spine-starling.swc</AS3Classpath> <AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/spine-starling.swc</AS3Classpath>
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/starling-2.0.1.swc</AS3Classpath> <AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/starling-2.0.1.swc</AS3Classpath>
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/spine-as3.swc</AS3Classpath>
</AS3Classpath> </AS3Classpath>

View File

@ -1522,7 +1522,7 @@ var spine;
if (from == null) if (from == null)
return; return;
this.updateMixingFrom(from, delta); this.updateMixingFrom(from, delta);
if (entry.mixTime >= entry.mixDuration && from.mixingFrom != null && entry.mixTime > 0) { if (entry.mixTime >= entry.mixDuration && from.mixingFrom == null && entry.mixTime > 0) {
entry.mixingFrom = null; entry.mixingFrom = null;
this.queue.end(from); this.queue.end(from);
return; return;
@ -1748,16 +1748,18 @@ var spine;
current.mixTime = 0; current.mixTime = 0;
var mixingFrom = from.mixingFrom; var mixingFrom = from.mixingFrom;
if (mixingFrom != null && from.mixDuration > 0) { if (mixingFrom != null && from.mixDuration > 0) {
if (!this.multipleMixing && from.mixTime / from.mixDuration < 0.5 && mixingFrom.animation != AnimationState.emptyAnimation) { if (this.multipleMixing) {
current.mixingFrom = mixingFrom; current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
mixingFrom.mixingFrom = from;
mixingFrom.mixTime = from.mixDuration - from.mixTime;
mixingFrom.mixDuration = from.mixDuration;
from.mixingFrom = null;
from = mixingFrom;
} }
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1); else {
if (!this.multipleMixing) { if (from.mixTime / from.mixDuration < 0.5 && mixingFrom.animation != AnimationState.emptyAnimation) {
current.mixingFrom = mixingFrom;
mixingFrom.mixingFrom = from;
mixingFrom.mixTime = from.mixDuration - from.mixTime;
mixingFrom.mixDuration = from.mixDuration;
from.mixingFrom = null;
from = mixingFrom;
}
from.mixAlpha = 0; from.mixAlpha = 0;
from.mixTime = 0; from.mixTime = 0;
from.mixDuration = 0; from.mixDuration = 0;

File diff suppressed because one or more lines are too long

View File

@ -1522,7 +1522,7 @@ var spine;
if (from == null) if (from == null)
return; return;
this.updateMixingFrom(from, delta); this.updateMixingFrom(from, delta);
if (entry.mixTime >= entry.mixDuration && from.mixingFrom != null && entry.mixTime > 0) { if (entry.mixTime >= entry.mixDuration && from.mixingFrom == null && entry.mixTime > 0) {
entry.mixingFrom = null; entry.mixingFrom = null;
this.queue.end(from); this.queue.end(from);
return; return;
@ -1748,16 +1748,18 @@ var spine;
current.mixTime = 0; current.mixTime = 0;
var mixingFrom = from.mixingFrom; var mixingFrom = from.mixingFrom;
if (mixingFrom != null && from.mixDuration > 0) { if (mixingFrom != null && from.mixDuration > 0) {
if (!this.multipleMixing && from.mixTime / from.mixDuration < 0.5 && mixingFrom.animation != AnimationState.emptyAnimation) { if (this.multipleMixing) {
current.mixingFrom = mixingFrom; current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
mixingFrom.mixingFrom = from;
mixingFrom.mixTime = from.mixDuration - from.mixTime;
mixingFrom.mixDuration = from.mixDuration;
from.mixingFrom = null;
from = mixingFrom;
} }
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1); else {
if (!this.multipleMixing) { if (from.mixTime / from.mixDuration < 0.5 && mixingFrom.animation != AnimationState.emptyAnimation) {
current.mixingFrom = mixingFrom;
mixingFrom.mixingFrom = from;
mixingFrom.mixTime = from.mixDuration - from.mixTime;
mixingFrom.mixDuration = from.mixDuration;
from.mixingFrom = null;
from = mixingFrom;
}
from.mixAlpha = 0; from.mixAlpha = 0;
from.mixTime = 0; from.mixTime = 0;
from.mixDuration = 0; from.mixDuration = 0;

File diff suppressed because one or more lines are too long

View File

@ -1098,7 +1098,7 @@ var spine;
if (from == null) if (from == null)
return; return;
this.updateMixingFrom(from, delta); this.updateMixingFrom(from, delta);
if (entry.mixTime >= entry.mixDuration && from.mixingFrom != null && entry.mixTime > 0) { if (entry.mixTime >= entry.mixDuration && from.mixingFrom == null && entry.mixTime > 0) {
entry.mixingFrom = null; entry.mixingFrom = null;
this.queue.end(from); this.queue.end(from);
return; return;
@ -1324,16 +1324,18 @@ var spine;
current.mixTime = 0; current.mixTime = 0;
var mixingFrom = from.mixingFrom; var mixingFrom = from.mixingFrom;
if (mixingFrom != null && from.mixDuration > 0) { if (mixingFrom != null && from.mixDuration > 0) {
if (!this.multipleMixing && from.mixTime / from.mixDuration < 0.5 && mixingFrom.animation != AnimationState.emptyAnimation) { if (this.multipleMixing) {
current.mixingFrom = mixingFrom; current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
mixingFrom.mixingFrom = from;
mixingFrom.mixTime = from.mixDuration - from.mixTime;
mixingFrom.mixDuration = from.mixDuration;
from.mixingFrom = null;
from = mixingFrom;
} }
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1); else {
if (!this.multipleMixing) { if (from.mixTime / from.mixDuration < 0.5 && mixingFrom.animation != AnimationState.emptyAnimation) {
current.mixingFrom = mixingFrom;
mixingFrom.mixingFrom = from;
mixingFrom.mixTime = from.mixDuration - from.mixTime;
mixingFrom.mixDuration = from.mixDuration;
from.mixingFrom = null;
from = mixingFrom;
}
from.mixAlpha = 0; from.mixAlpha = 0;
from.mixTime = 0; from.mixTime = 0;
from.mixDuration = 0; from.mixDuration = 0;

File diff suppressed because one or more lines are too long

View File

@ -1098,7 +1098,7 @@ var spine;
if (from == null) if (from == null)
return; return;
this.updateMixingFrom(from, delta); this.updateMixingFrom(from, delta);
if (entry.mixTime >= entry.mixDuration && from.mixingFrom != null && entry.mixTime > 0) { if (entry.mixTime >= entry.mixDuration && from.mixingFrom == null && entry.mixTime > 0) {
entry.mixingFrom = null; entry.mixingFrom = null;
this.queue.end(from); this.queue.end(from);
return; return;
@ -1324,16 +1324,18 @@ var spine;
current.mixTime = 0; current.mixTime = 0;
var mixingFrom = from.mixingFrom; var mixingFrom = from.mixingFrom;
if (mixingFrom != null && from.mixDuration > 0) { if (mixingFrom != null && from.mixDuration > 0) {
if (!this.multipleMixing && from.mixTime / from.mixDuration < 0.5 && mixingFrom.animation != AnimationState.emptyAnimation) { if (this.multipleMixing) {
current.mixingFrom = mixingFrom; current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
mixingFrom.mixingFrom = from;
mixingFrom.mixTime = from.mixDuration - from.mixTime;
mixingFrom.mixDuration = from.mixDuration;
from.mixingFrom = null;
from = mixingFrom;
} }
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1); else {
if (!this.multipleMixing) { if (from.mixTime / from.mixDuration < 0.5 && mixingFrom.animation != AnimationState.emptyAnimation) {
current.mixingFrom = mixingFrom;
mixingFrom.mixingFrom = from;
mixingFrom.mixTime = from.mixDuration - from.mixTime;
mixingFrom.mixDuration = from.mixDuration;
from.mixingFrom = null;
from = mixingFrom;
}
from.mixAlpha = 0; from.mixAlpha = 0;
from.mixTime = 0; from.mixTime = 0;
from.mixDuration = 0; from.mixDuration = 0;

File diff suppressed because one or more lines are too long

View File

@ -1098,7 +1098,7 @@ var spine;
if (from == null) if (from == null)
return; return;
this.updateMixingFrom(from, delta); this.updateMixingFrom(from, delta);
if (entry.mixTime >= entry.mixDuration && from.mixingFrom != null && entry.mixTime > 0) { if (entry.mixTime >= entry.mixDuration && from.mixingFrom == null && entry.mixTime > 0) {
entry.mixingFrom = null; entry.mixingFrom = null;
this.queue.end(from); this.queue.end(from);
return; return;
@ -1324,16 +1324,18 @@ var spine;
current.mixTime = 0; current.mixTime = 0;
var mixingFrom = from.mixingFrom; var mixingFrom = from.mixingFrom;
if (mixingFrom != null && from.mixDuration > 0) { if (mixingFrom != null && from.mixDuration > 0) {
if (!this.multipleMixing && from.mixTime / from.mixDuration < 0.5 && mixingFrom.animation != AnimationState.emptyAnimation) { if (this.multipleMixing) {
current.mixingFrom = mixingFrom; current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
mixingFrom.mixingFrom = from;
mixingFrom.mixTime = from.mixDuration - from.mixTime;
mixingFrom.mixDuration = from.mixDuration;
from.mixingFrom = null;
from = mixingFrom;
} }
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1); else {
if (!this.multipleMixing) { if (from.mixTime / from.mixDuration < 0.5 && mixingFrom.animation != AnimationState.emptyAnimation) {
current.mixingFrom = mixingFrom;
mixingFrom.mixingFrom = from;
mixingFrom.mixTime = from.mixDuration - from.mixTime;
mixingFrom.mixDuration = from.mixDuration;
from.mixingFrom = null;
from = mixingFrom;
}
from.mixAlpha = 0; from.mixAlpha = 0;
from.mixTime = 0; from.mixTime = 0;
from.mixDuration = 0; from.mixDuration = 0;

File diff suppressed because one or more lines are too long

View File

@ -1098,7 +1098,7 @@ var spine;
if (from == null) if (from == null)
return; return;
this.updateMixingFrom(from, delta); this.updateMixingFrom(from, delta);
if (entry.mixTime >= entry.mixDuration && from.mixingFrom != null && entry.mixTime > 0) { if (entry.mixTime >= entry.mixDuration && from.mixingFrom == null && entry.mixTime > 0) {
entry.mixingFrom = null; entry.mixingFrom = null;
this.queue.end(from); this.queue.end(from);
return; return;
@ -1324,16 +1324,18 @@ var spine;
current.mixTime = 0; current.mixTime = 0;
var mixingFrom = from.mixingFrom; var mixingFrom = from.mixingFrom;
if (mixingFrom != null && from.mixDuration > 0) { if (mixingFrom != null && from.mixDuration > 0) {
if (!this.multipleMixing && from.mixTime / from.mixDuration < 0.5 && mixingFrom.animation != AnimationState.emptyAnimation) { if (this.multipleMixing) {
current.mixingFrom = mixingFrom; current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
mixingFrom.mixingFrom = from;
mixingFrom.mixTime = from.mixDuration - from.mixTime;
mixingFrom.mixDuration = from.mixDuration;
from.mixingFrom = null;
from = mixingFrom;
} }
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1); else {
if (!this.multipleMixing) { if (from.mixTime / from.mixDuration < 0.5 && mixingFrom.animation != AnimationState.emptyAnimation) {
current.mixingFrom = mixingFrom;
mixingFrom.mixingFrom = from;
mixingFrom.mixTime = from.mixDuration - from.mixTime;
mixingFrom.mixDuration = from.mixDuration;
from.mixingFrom = null;
from = mixingFrom;
}
from.mixAlpha = 0; from.mixAlpha = 0;
from.mixTime = 0; from.mixTime = 0;
from.mixDuration = 0; from.mixDuration = 0;

File diff suppressed because one or more lines are too long

View File

@ -105,7 +105,7 @@ module spine {
this.updateMixingFrom(from, delta); this.updateMixingFrom(from, delta);
if (entry.mixTime >= entry.mixDuration && from.mixingFrom != null && entry.mixTime > 0) { if (entry.mixTime >= entry.mixDuration && from.mixingFrom == null && entry.mixTime > 0) {
entry.mixingFrom = null; entry.mixingFrom = null;
this.queue.end(from); this.queue.end(from);
return; return;
@ -354,21 +354,21 @@ module spine {
let mixingFrom = from.mixingFrom; let mixingFrom = from.mixingFrom;
if (mixingFrom != null && from.mixDuration > 0) { if (mixingFrom != null && from.mixDuration > 0) {
// A mix was interrupted, mix from the closest animation. if (this.multipleMixing) {
if (!this.multipleMixing && from.mixTime / from.mixDuration < 0.5 && mixingFrom.animation != AnimationState.emptyAnimation) { // The interrupted mix will mix out from its current percentage to zero.
current.mixingFrom = mixingFrom; current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
mixingFrom.mixingFrom = from; } else {
mixingFrom.mixTime = from.mixDuration - from.mixTime; // A mix was interrupted, mix from the closest animation.
mixingFrom.mixDuration = from.mixDuration; if (from.mixTime / from.mixDuration < 0.5 && mixingFrom.animation != AnimationState.emptyAnimation) {
from.mixingFrom = null; current.mixingFrom = mixingFrom;
from = mixingFrom; mixingFrom.mixingFrom = from;
} mixingFrom.mixTime = from.mixDuration - from.mixTime;
mixingFrom.mixDuration = from.mixDuration;
from.mixingFrom = null;
from = mixingFrom;
}
// The interrupted mix will mix out from its current percentage to zero. // End the other animation after it is applied one last time.
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
// End the other animation after it is applied one last time.
if (!this.multipleMixing) {
from.mixAlpha = 0; from.mixAlpha = 0;
from.mixTime = 0; from.mixTime = 0;
from.mixDuration = 0; from.mixDuration = 0;

View File

@ -0,0 +1,195 @@
spineboy ikfeet.png
size: 1024,1024
format: RGBA8888
filter: Linear,Linear
repeat: none
eye_indifferent
rotate: false
xy: 550, 694
size: 93, 89
orig: 93, 89
offset: 0, 0
index: -1
eye_surprised
rotate: false
xy: 834, 856
size: 93, 89
orig: 93, 89
offset: 0, 0
index: -1
front_bracer
rotate: false
xy: 678, 774
size: 58, 80
orig: 58, 80
offset: 0, 0
index: -1
front_fist_closed
rotate: true
xy: 466, 593
size: 75, 82
orig: 75, 82
offset: 0, 0
index: -1
front_fist_open
rotate: false
xy: 550, 605
size: 86, 87
orig: 86, 87
offset: 0, 0
index: -1
front_foot
rotate: false
xy: 550, 785
size: 126, 69
orig: 126, 69
offset: 0, 0
index: -1
front_foot_bend1
rotate: true
xy: 375, 492
size: 128, 70
orig: 128, 70
offset: 0, 0
index: -1
front_foot_bend2
rotate: true
xy: 275, 330
size: 108, 93
orig: 108, 93
offset: 0, 0
index: -1
front_shin
rotate: false
xy: 466, 670
size: 82, 184
orig: 82, 184
offset: 0, 0
index: -1
front_thigh
rotate: false
xy: 214, 208
size: 48, 112
orig: 48, 112
offset: 0, 0
index: -1
front_upper_arm
rotate: false
xy: 214, 109
size: 54, 97
orig: 54, 97
offset: 0, 0
index: -1
goggles
rotate: false
xy: 466, 856
size: 261, 166
orig: 261, 166
offset: 0, 0
index: -1
gun
rotate: false
xy: 2, 117
size: 210, 203
orig: 210, 203
offset: 0, 0
index: -1
head
rotate: false
xy: 2, 322
size: 271, 298
orig: 271, 298
offset: 0, 0
index: -1
mouth_grind
rotate: false
xy: 929, 896
size: 93, 59
orig: 93, 59
offset: 0, 0
index: -1
mouth_oooo
rotate: false
xy: 929, 835
size: 93, 59
orig: 93, 59
offset: 0, 0
index: -1
mouth_smile
rotate: false
xy: 447, 532
size: 93, 59
orig: 93, 59
offset: 0, 0
index: -1
muzzle
rotate: false
xy: 2, 622
size: 462, 400
orig: 462, 400
offset: 0, 0
index: -1
neck
rotate: false
xy: 796, 819
size: 36, 41
orig: 36, 41
offset: 0, 0
index: -1
rear_bracer
rotate: false
xy: 738, 788
size: 56, 72
orig: 56, 72
offset: 0, 0
index: -1
rear_foot
rotate: true
xy: 2, 2
size: 113, 60
orig: 113, 60
offset: 0, 0
index: -1
rear_foot_bend1
rotate: false
xy: 64, 49
size: 117, 66
orig: 117, 66
offset: 0, 0
index: -1
rear_foot_bend2
rotate: false
xy: 729, 862
size: 103, 83
orig: 103, 83
offset: 0, 0
index: -1
rear_shin
rotate: true
xy: 729, 947
size: 75, 178
orig: 75, 178
offset: 0, 0
index: -1
rear_thigh
rotate: true
xy: 909, 957
size: 65, 104
orig: 65, 104
offset: 0, 0
index: -1
rear_upper_arm
rotate: true
xy: 447, 483
size: 47, 87
orig: 47, 87
offset: 0, 0
index: -1
torso
rotate: false
xy: 275, 440
size: 98, 180
orig: 98, 180
offset: 0, 0
index: -1

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 584 KiB

View File

@ -12,6 +12,10 @@
</body> </body>
<script> <script>
var FILE = "spineboy ikfeet";
var NUM_SKELETONS = 1;
var SCALE = 0.6;
var canvas, gl, renderer, input, assetManager; var canvas, gl, renderer, input, assetManager;
var skeletons = []; var skeletons = [];
var timeKeeper; var timeKeeper;
@ -28,9 +32,11 @@ function init() {
assetManager = new spine.webgl.AssetManager(gl, "assets/"); assetManager = new spine.webgl.AssetManager(gl, "assets/");
var textureLoader = function(img) { return new spine.webgl.GLTexture(gl, img); }; var textureLoader = function(img) { return new spine.webgl.GLTexture(gl, img); };
input = new spine.webgl.Input(canvas); input = new spine.webgl.Input(canvas);
assetManager.loadTexture("spineboy.png");
assetManager.loadText("spineboy.atlas"); assetManager.loadTexture(FILE + ".png");
assetManager.loadText("spineboy.json"); assetManager.loadText(FILE + ".atlas");
assetManager.loadText(FILE + ".json");
timeKeeper = new spine.TimeKeeper(); timeKeeper = new spine.TimeKeeper();
requestAnimationFrame(load); requestAnimationFrame(load);
} }
@ -38,19 +44,31 @@ function init() {
function load() { function load() {
timeKeeper.update(); timeKeeper.update();
if (assetManager.isLoadingComplete()) { if (assetManager.isLoadingComplete()) {
var atlas = new spine.TextureAtlas(assetManager.get("spineboy.atlas"), function(path) { var atlas = new spine.TextureAtlas(assetManager.get(FILE + ".atlas"), function(path) {
return assetManager.get(path); return assetManager.get(path);
}); });
var atlasLoader = new spine.AtlasAttachmentLoader(atlas); var atlasLoader = new spine.AtlasAttachmentLoader(atlas);
var skeletonJson = new spine.SkeletonJson(atlasLoader); var skeletonJson = new spine.SkeletonJson(atlasLoader);
skeletonJson.scale = 0.01; skeletonJson.scale = SCALE;
var skeletonData = skeletonJson.readSkeletonData(JSON.parse(assetManager.get("spineboy.json"))); var skeletonData = skeletonJson.readSkeletonData(JSON.parse(assetManager.get(FILE + ".json")));
for (var i = 0; i < 1000; i++) { for (var i = 0; i < NUM_SKELETONS; i++) {
skeleton = new spine.Skeleton(skeletonData); skeleton = new spine.Skeleton(skeletonData);
var stateData = new spine.AnimationStateData(skeleton.data); var stateData = new spine.AnimationStateData(skeleton.data);
state = new spine.AnimationState(stateData); state = new spine.AnimationState(stateData);
state.setAnimation(0, "walk", true);
var mixDuration = 0.8;
var stableDuration = 2;
stateData.defaultMix = mixDuration;
state.multipleMixing = false;
state.setAnimation(0, "idle", true);
state.addAnimation(0, "run", true, stableDuration);
state.addAnimation(0, "idle", true, mixDuration * 0.35);
state.addAnimation(0, "run", true, stableDuration);
state.addAnimation(0, "idle", true, mixDuration * 0.75);
state.addAnimation(0, "run", true, stableDuration);
state.addAnimation(0, "idle", true, mixDuration * 2);
state.apply(skeleton); state.apply(skeleton);
skeleton.x = Math.random() * 200 - Math.random() * 200; skeleton.x = Math.random() * 200 - Math.random() * 200;
skeleton.y = Math.random() * 200 - Math.random() * 200; skeleton.y = Math.random() * 200 - Math.random() * 200;