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.
*****************************************************************************/
package spine.animation {
import spine.MathUtils;
import spine.Bone;
import spine.Pool;
import flash.utils.Dictionary;
import spine.Event;
import spine.MathUtils;
import spine.Pool;
import spine.Skeleton;
import flash.utils.Dictionary;
public class AnimationState {
internal static var emptyAnimation : Animation = new Animation("<empty>", new Vector.<Timeline>(), 0);
@ -365,24 +363,22 @@ package spine.animation {
var mixingFrom : TrackEntry = from.mixingFrom;
if (mixingFrom != null && from.mixDuration > 0) {
// A mix was interrupted, mix from the closest animation.
if (!multipleMixing && 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;
}
// 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) {
if (multipleMixing) {
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
} else {
// A mix was interrupted, mix from the closest animation.
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.mixTime = 0;
from.mixDuration = 0;
from.mixDuration = 0;
}
}
@ -551,9 +547,7 @@ package spine.animation {
if (multipleMixing) return;
// Set timelinesLast for mixingFrom entries, from highest track to lowest that has mixingFrom.
for (var key2 : String in propertyIDs) {
delete propertyIDs[key2];
}
propertyIDs = this.propertyIDs = new Dictionary();
var lowestMixingFrom : int = n;
for (i = 0; i < n; i++) { // Find lowest track with a mixingFrom entry.
entry = tracks[i];
@ -567,9 +561,8 @@ package spine.animation {
// 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;
for (var ii : int = 0, nn : int = entry.animation.timelines.length; ii < nn; ii++)
var id : String = timelines[ii].getPropertyId().toString();
propertyIDs[id] = id;
for (var ii : int = 0, nn : int = entry.animation.timelines.length; ii < nn; ii++)
propertyIDs[timelines[ii].getPropertyId().toString()] = true;
entry = entry.mixingFrom;
while (entry != null) {
@ -590,9 +583,8 @@ package spine.animation {
var n : int = timelines.length;
var usage : Vector.<Boolean> = entry.timelinesFirst;
usage.length = n;
for (var i : int = 0; i < n; i++) {
var id : String = timelines[i].getPropertyId().toString();
propertyIDs[id] = id;
for (var i : int = 0; i < n; i++) {
propertyIDs[timelines[i].getPropertyId().toString()] = true;
usage[i] = true;
}
}
@ -611,7 +603,7 @@ package spine.animation {
for (var i : int = 0; i < n; i++) {
var id : String = timelines[i].getPropertyId().toString();
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;
if (mixingFrom != 0 && from->mixDuration > 0) {
if (self->multipleMixing && from->mixTime / from->mixDuration < 0.5 && mixingFrom->animation != SP_EMPTY_ANIMATION) {
current->mixingFrom = mixingFrom;
mixingFrom->mixingFrom = from;
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) {
if (self->multipleMixing) {
current->mixAlpha *= MIN(from->mixTime / from->mixDuration, 1);
} else {
if (from->mixTime / from->mixDuration < 0.5 && mixingFrom->animation != SP_EMPTY_ANIMATION) {
current->mixingFrom = mixingFrom;
mixingFrom->mixingFrom = from;
mixingFrom->mixTime = from->mixDuration - from->mixTime;
mixingFrom->mixDuration = from->mixDuration;
from->mixingFrom = 0;
from = mixingFrom;
}
from->mixAlpha = 0;
from->mixTime = 0;
from->mixDuration = 0;

View File

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

View File

@ -3,7 +3,7 @@
<AS3LibraryFolder>lib</AS3LibraryFolder>
<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="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/starling-2.0.1.swc</AS3Classpath>
<AS3Classpath generateProblems="true" sdkBased="false" type="lib" useAsSharedCode="false">lib/spine-as3.swc</AS3Classpath>
</AS3Classpath>

View File

@ -1522,7 +1522,7 @@ var spine;
if (from == null)
return;
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;
this.queue.end(from);
return;
@ -1748,16 +1748,18 @@ var spine;
current.mixTime = 0;
var mixingFrom = from.mixingFrom;
if (mixingFrom != null && from.mixDuration > 0) {
if (!this.multipleMixing && 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;
if (this.multipleMixing) {
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
}
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
if (!this.multipleMixing) {
else {
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.mixTime = 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)
return;
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;
this.queue.end(from);
return;
@ -1748,16 +1748,18 @@ var spine;
current.mixTime = 0;
var mixingFrom = from.mixingFrom;
if (mixingFrom != null && from.mixDuration > 0) {
if (!this.multipleMixing && 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;
if (this.multipleMixing) {
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
}
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
if (!this.multipleMixing) {
else {
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.mixTime = 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)
return;
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;
this.queue.end(from);
return;
@ -1324,16 +1324,18 @@ var spine;
current.mixTime = 0;
var mixingFrom = from.mixingFrom;
if (mixingFrom != null && from.mixDuration > 0) {
if (!this.multipleMixing && 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;
if (this.multipleMixing) {
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
}
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
if (!this.multipleMixing) {
else {
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.mixTime = 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)
return;
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;
this.queue.end(from);
return;
@ -1324,16 +1324,18 @@ var spine;
current.mixTime = 0;
var mixingFrom = from.mixingFrom;
if (mixingFrom != null && from.mixDuration > 0) {
if (!this.multipleMixing && 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;
if (this.multipleMixing) {
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
}
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
if (!this.multipleMixing) {
else {
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.mixTime = 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)
return;
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;
this.queue.end(from);
return;
@ -1324,16 +1324,18 @@ var spine;
current.mixTime = 0;
var mixingFrom = from.mixingFrom;
if (mixingFrom != null && from.mixDuration > 0) {
if (!this.multipleMixing && 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;
if (this.multipleMixing) {
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
}
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
if (!this.multipleMixing) {
else {
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.mixTime = 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)
return;
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;
this.queue.end(from);
return;
@ -1324,16 +1324,18 @@ var spine;
current.mixTime = 0;
var mixingFrom = from.mixingFrom;
if (mixingFrom != null && from.mixDuration > 0) {
if (!this.multipleMixing && 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;
if (this.multipleMixing) {
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
}
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
if (!this.multipleMixing) {
else {
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.mixTime = 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);
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;
this.queue.end(from);
return;
@ -354,21 +354,21 @@ module spine {
let mixingFrom = from.mixingFrom;
if (mixingFrom != null && from.mixDuration > 0) {
// A mix was interrupted, mix from the closest animation.
if (!this.multipleMixing && 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;
}
if (this.multipleMixing) {
// The interrupted mix will mix out from its current percentage to zero.
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
} else {
// A mix was interrupted, mix from the closest animation.
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;
}
// 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 (!this.multipleMixing) {
// End the other animation after it is applied one last time.
from.mixAlpha = 0;
from.mixTime = 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>
<script>
var FILE = "spineboy ikfeet";
var NUM_SKELETONS = 1;
var SCALE = 0.6;
var canvas, gl, renderer, input, assetManager;
var skeletons = [];
var timeKeeper;
@ -28,9 +32,11 @@ function init() {
assetManager = new spine.webgl.AssetManager(gl, "assets/");
var textureLoader = function(img) { return new spine.webgl.GLTexture(gl, img); };
input = new spine.webgl.Input(canvas);
assetManager.loadTexture("spineboy.png");
assetManager.loadText("spineboy.atlas");
assetManager.loadText("spineboy.json");
assetManager.loadTexture(FILE + ".png");
assetManager.loadText(FILE + ".atlas");
assetManager.loadText(FILE + ".json");
timeKeeper = new spine.TimeKeeper();
requestAnimationFrame(load);
}
@ -38,19 +44,31 @@ function init() {
function load() {
timeKeeper.update();
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);
});
var atlasLoader = new spine.AtlasAttachmentLoader(atlas);
var skeletonJson = new spine.SkeletonJson(atlasLoader);
skeletonJson.scale = 0.01;
var skeletonData = skeletonJson.readSkeletonData(JSON.parse(assetManager.get("spineboy.json")));
skeletonJson.scale = SCALE;
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);
var stateData = new spine.AnimationStateData(skeleton.data);
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);
skeleton.x = Math.random() * 200 - Math.random() * 200;
skeleton.y = Math.random() * 200 - Math.random() * 200;