mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
More clean up.
This commit is contained in:
parent
137c3f69ed
commit
a5be08a62a
@ -79,8 +79,8 @@ package spine {
|
|||||||
var data : PathConstraintData = this._data;
|
var data : PathConstraintData = this._data;
|
||||||
var tangents : Boolean = data.rotateMode == RotateMode.tangent, scale : Boolean = data.rotateMode == RotateMode.chainScale;
|
var tangents : Boolean = data.rotateMode == RotateMode.tangent, scale : Boolean = data.rotateMode == RotateMode.chainScale;
|
||||||
|
|
||||||
var boneCount : int = this._bones.length, spacesCount : int = tangents ? boneCount : boneCount + 1;
|
|
||||||
var bones : Vector.<Bone> = this._bones;
|
var bones : Vector.<Bone> = this._bones;
|
||||||
|
var boneCount : int = bones.length, spacesCount : int = tangents ? boneCount : boneCount + 1;
|
||||||
this._spaces.length = spacesCount;
|
this._spaces.length = spacesCount;
|
||||||
var spaces : Vector.<Number> = this._spaces, lengths : Vector.<Number> = _lengths;
|
var spaces : Vector.<Number> = this._spaces, lengths : Vector.<Number> = _lengths;
|
||||||
if (scale) lengths.length = boneCount;
|
if (scale) lengths.length = boneCount;
|
||||||
|
|||||||
@ -180,8 +180,8 @@ package spine.animation {
|
|||||||
applyTime = current.animation.duration - applyTime;
|
applyTime = current.animation.duration - applyTime;
|
||||||
applyEvents = null;
|
applyEvents = null;
|
||||||
}
|
}
|
||||||
var timelineCount : int = current.animation.timelines.length;
|
|
||||||
var timelines : Vector.<Timeline> = current.animation.timelines;
|
var timelines : Vector.<Timeline> = current.animation.timelines;
|
||||||
|
var timelineCount : int = timelines.length;
|
||||||
var ii : int = 0;
|
var ii : int = 0;
|
||||||
var timeline : Timeline;
|
var timeline : Timeline;
|
||||||
if ((i == 0 && mix == 1) || blend == MixBlend.add) {
|
if ((i == 0 && mix == 1) || blend == MixBlend.add) {
|
||||||
@ -202,7 +202,7 @@ package spine.animation {
|
|||||||
timeline = timelines[ii];
|
timeline = timelines[ii];
|
||||||
var timelineBlend : MixBlend = timelineMode[ii] == SUBSEQUENT ? blend : MixBlend.setup;
|
var timelineBlend : MixBlend = timelineMode[ii] == SUBSEQUENT ? blend : MixBlend.setup;
|
||||||
if (timeline is RotateTimeline)
|
if (timeline is RotateTimeline)
|
||||||
applyRotateTimeline(timeline, skeleton, applyTime, mix, timelineBlend, current.timelinesRotation, ii << 1, firstFrame);
|
applyRotateTimeline(RotateTimeline(timeline), skeleton, applyTime, mix, timelineBlend, current.timelinesRotation, ii << 1, firstFrame);
|
||||||
else if (timeline is AttachmentTimeline)
|
else if (timeline is AttachmentTimeline)
|
||||||
applyAttachmentTimeline(AttachmentTimeline(timeline), skeleton, applyTime, timelineBlend, true);
|
applyAttachmentTimeline(AttachmentTimeline(timeline), skeleton, applyTime, timelineBlend, true);
|
||||||
else
|
else
|
||||||
@ -248,8 +248,8 @@ package spine.animation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var attachments : Boolean = mix < from.attachmentThreshold, drawOrder : Boolean = mix < from.drawOrderThreshold;
|
var attachments : Boolean = mix < from.attachmentThreshold, drawOrder : Boolean = mix < from.drawOrderThreshold;
|
||||||
var timelineCount : int = from.animation.timelines.length;
|
|
||||||
var timelines : Vector.<Timeline> = from.animation.timelines;
|
var timelines : Vector.<Timeline> = from.animation.timelines;
|
||||||
|
var timelineCount : int = timelines.length;
|
||||||
var alphaHold : Number = from.alpha * to.interruptAlpha, alphaMix : Number = alphaHold * (1 - mix);
|
var alphaHold : Number = from.alpha * to.interruptAlpha, alphaMix : Number = alphaHold * (1 - mix);
|
||||||
var animationLast : Number = from.animationLast, animationTime : Number = from.getAnimationTime(), applyTime : Number = animationTime;
|
var animationLast : Number = from.animationLast, animationTime : Number = from.getAnimationTime(), applyTime : Number = animationTime;
|
||||||
var events : Vector.<Event> = null;
|
var events : Vector.<Event> = null;
|
||||||
@ -340,7 +340,7 @@ package spine.animation {
|
|||||||
if (attachments) slot.attachmentState = unkeyedState + CURRENT;
|
if (attachments) slot.attachmentState = unkeyedState + CURRENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function applyRotateTimeline(timeline : Timeline, skeleton : Skeleton, time : Number, alpha : Number, blend : MixBlend, timelinesRotation : Vector.<Number>, i : int, firstFrame : Boolean) : void {
|
private function applyRotateTimeline(timeline : RotateTimeline, skeleton : Skeleton, time : Number, alpha : Number, blend : MixBlend, timelinesRotation : Vector.<Number>, i : int, firstFrame : Boolean) : void {
|
||||||
if (firstFrame) timelinesRotation[i] = 0;
|
if (firstFrame) timelinesRotation[i] = 0;
|
||||||
|
|
||||||
if (alpha == 1) {
|
if (alpha == 1) {
|
||||||
@ -348,10 +348,9 @@ package spine.animation {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var rotateTimeline : RotateTimeline = RotateTimeline(timeline);
|
var bone : Bone = skeleton.bones[timeline.getBoneIndex()];
|
||||||
var bone : Bone = skeleton.bones[rotateTimeline.getBoneIndex()];
|
|
||||||
if (!bone.active) return;
|
if (!bone.active) return;
|
||||||
var frames : Vector.<Number> = rotateTimeline.frames;
|
var frames : Vector.<Number> = timeline.frames;
|
||||||
var r1 : Number, r2 : Number;
|
var r1 : Number, r2 : Number;
|
||||||
if (time < frames[0]) {
|
if (time < frames[0]) {
|
||||||
switch (blend) {
|
switch (blend) {
|
||||||
@ -365,7 +364,7 @@ package spine.animation {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
r1 = blend == MixBlend.setup ? bone.data.rotation : bone.rotation;
|
r1 = blend == MixBlend.setup ? bone.data.rotation : bone.rotation;
|
||||||
r2 = bone.data.rotation + rotateTimeline.getCurveValue(time);
|
r2 = bone.data.rotation + timeline.getCurveValue(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mix between rotations using the direction of the shortest route on the first frame while detecting crosses.
|
// Mix between rotations using the direction of the shortest route on the first frame while detecting crosses.
|
||||||
@ -558,7 +557,7 @@ package spine.animation {
|
|||||||
var entry : TrackEntry = addAnimation(trackIndex, emptyAnimation, false, delay <= 0 ? 1 : delay);
|
var entry : TrackEntry = addAnimation(trackIndex, emptyAnimation, false, delay <= 0 ? 1 : delay);
|
||||||
entry.mixDuration = mixDuration;
|
entry.mixDuration = mixDuration;
|
||||||
entry.trackEnd = mixDuration;
|
entry.trackEnd = mixDuration;
|
||||||
if (delay <= 0 && entry.previous != null) entry.delay = entry.previous.getTrackComplete() - entry.mixDuration;
|
if (delay <= 0 && entry.previous != null) entry.delay = entry.previous.getTrackComplete() - entry.mixDuration + delay;
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -622,18 +621,16 @@ package spine.animation {
|
|||||||
animationsChanged = false;
|
animationsChanged = false;
|
||||||
|
|
||||||
propertyIDs.clear();
|
propertyIDs.clear();
|
||||||
var i : int = 0;
|
var tracks = this.tracks;
|
||||||
var n: int = 0;
|
for (var i : int = 0, n : int = tracks.length; i < n; i++) {
|
||||||
var entry : TrackEntry = null;
|
var entry : TrackEntry = tracks[i];
|
||||||
for (i = 0, n = tracks.length; i < n; i++) {
|
if (!entry) continue;
|
||||||
entry = tracks[i];
|
while (entry.mixingFrom)
|
||||||
if (entry == null) continue;
|
|
||||||
while (entry.mixingFrom != null)
|
|
||||||
entry = entry.mixingFrom;
|
entry = entry.mixingFrom;
|
||||||
do {
|
do {
|
||||||
if (entry.mixingTo == null || entry.mixBlend != MixBlend.add) computeHold(entry);
|
if (!entry.mixingTo || entry.mixBlend != MixBlend.add) computeHold(entry);
|
||||||
entry = entry.mixingTo;
|
entry = entry.mixingTo;
|
||||||
} while (entry != null);
|
} while (entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -67,7 +67,7 @@ package spine.animation {
|
|||||||
/** If this track entry is non-looping, the track time in seconds when {@link #getAnimationEnd()} is reached, or the current
|
/** If this track entry is non-looping, the track time in seconds when {@link #getAnimationEnd()} is reached, or the current
|
||||||
* {@link #getTrackTime()} if it has already been reached. If this track entry is looping, the track time when this
|
* {@link #getTrackTime()} if it has already been reached. If this track entry is looping, the track time when this
|
||||||
* animation will reach its next {@link #getAnimationEnd()} (the next loop completion). */
|
* animation will reach its next {@link #getAnimationEnd()} (the next loop completion). */
|
||||||
public function getTrackComplete () : Number {
|
public function getTrackComplete() : Number {
|
||||||
var duration : Number = animationEnd - animationStart;
|
var duration : Number = animationEnd - animationStart;
|
||||||
if (duration != 0) {
|
if (duration != 0) {
|
||||||
if (loop) return duration * (1 + int(trackTime / duration)); // Completion of next loop.
|
if (loop) return duration * (1 + int(trackTime / duration)); // Completion of next loop.
|
||||||
|
|||||||
@ -838,7 +838,7 @@ spTrackEntry* spAnimationState_addEmptyAnimation(spAnimationState* self, int tra
|
|||||||
entry = spAnimationState_addAnimation(self, trackIndex, SP_EMPTY_ANIMATION, 0, delay <= 0 ? 1 : delay);
|
entry = spAnimationState_addAnimation(self, trackIndex, SP_EMPTY_ANIMATION, 0, delay <= 0 ? 1 : delay);
|
||||||
entry->mixDuration = mixDuration;
|
entry->mixDuration = mixDuration;
|
||||||
entry->trackEnd = mixDuration;
|
entry->trackEnd = mixDuration;
|
||||||
if (delay <= 0 && entry->previous != NULL) entry->delay = spTrackEntry_getTrackComplete(entry->previous) - entry->mixDuration;
|
if (delay <= 0 && entry->previous != NULL) entry->delay = spTrackEntry_getTrackComplete(entry->previous) - entry->mixDuration + delay;
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -596,7 +596,7 @@ TrackEntry *AnimationState::addEmptyAnimation(size_t trackIndex, float mixDurati
|
|||||||
TrackEntry *entry = addAnimation(trackIndex, AnimationState::getEmptyAnimation(), false, delay <= 0 ? 1 : delay);
|
TrackEntry *entry = addAnimation(trackIndex, AnimationState::getEmptyAnimation(), false, delay <= 0 ? 1 : delay);
|
||||||
entry->_mixDuration = mixDuration;
|
entry->_mixDuration = mixDuration;
|
||||||
entry->_trackEnd = mixDuration;
|
entry->_trackEnd = mixDuration;
|
||||||
if (delay <= 0 && entry->_previous != NULL) entry->_delay = entry->_previous->getTrackComplete() - entry->_mixDuration;
|
if (delay <= 0 && entry->_previous != NULL) entry->_delay = entry->_previous->getTrackComplete() - entry->_mixDuration + delay;
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -323,7 +323,6 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stores the segments for the specified Bezier curve. For timelines that modify multiple values, there may be more than
|
/// Stores the segments for the specified Bezier curve. For timelines that modify multiple values, there may be more than
|
||||||
/// one curve per frame.</summary>
|
/// one curve per frame.</summary>
|
||||||
|
|||||||
@ -366,7 +366,6 @@ namespace Spine {
|
|||||||
if (mix < from.eventThreshold) events = this.events;
|
if (mix < from.eventThreshold) events = this.events;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (blend == MixBlend.Add) {
|
if (blend == MixBlend.Add) {
|
||||||
for (int i = 0; i < timelineCount; i++)
|
for (int i = 0; i < timelineCount; i++)
|
||||||
timelines[i].Apply(skeleton, animationLast, applyTime, events, alphaMix, blend, MixDirection.Out);
|
timelines[i].Apply(skeleton, animationLast, applyTime, events, alphaMix, blend, MixDirection.Out);
|
||||||
@ -661,7 +660,6 @@ namespace Spine {
|
|||||||
queue.Start(current); // triggers AnimationsChanged
|
queue.Start(current); // triggers AnimationsChanged
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>Sets an animation by name. <seealso cref="SetAnimation(int, Animation, bool)" /></summary>
|
/// <summary>Sets an animation by name. <seealso cref="SetAnimation(int, Animation, bool)" /></summary>
|
||||||
public TrackEntry SetAnimation (int trackIndex, string animationName, bool loop) {
|
public TrackEntry SetAnimation (int trackIndex, string animationName, bool loop) {
|
||||||
Animation animation = data.skeletonData.FindAnimation(animationName);
|
Animation animation = data.skeletonData.FindAnimation(animationName);
|
||||||
@ -780,7 +778,7 @@ namespace Spine {
|
|||||||
TrackEntry entry = AddAnimation(trackIndex, AnimationState.EmptyAnimation, false, delay <= 0 ? 1 : delay);
|
TrackEntry entry = AddAnimation(trackIndex, AnimationState.EmptyAnimation, false, delay <= 0 ? 1 : delay);
|
||||||
entry.mixDuration = mixDuration;
|
entry.mixDuration = mixDuration;
|
||||||
entry.trackEnd = mixDuration;
|
entry.trackEnd = mixDuration;
|
||||||
if (delay <= 0 && entry.previous != null) entry.delay = entry.previous.TrackComplete - entry.mixDuration;
|
if (delay <= 0 && entry.previous != null) entry.delay = entry.previous.TrackComplete - entry.mixDuration + delay;
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -859,7 +857,6 @@ namespace Spine {
|
|||||||
if (entry == null) continue;
|
if (entry == null) continue;
|
||||||
while (entry.mixingFrom != null) // Move to last entry, then iterate in reverse.
|
while (entry.mixingFrom != null) // Move to last entry, then iterate in reverse.
|
||||||
entry = entry.mixingFrom;
|
entry = entry.mixingFrom;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (entry.mixingTo == null || entry.mixBlend != MixBlend.Add) ComputeHold(entry);
|
if (entry.mixingTo == null || entry.mixBlend != MixBlend.Add) ComputeHold(entry);
|
||||||
entry = entry.mixingTo;
|
entry = entry.mixingTo;
|
||||||
@ -867,8 +864,6 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void ComputeHold (TrackEntry entry) {
|
private void ComputeHold (TrackEntry entry) {
|
||||||
TrackEntry to = entry.mixingTo;
|
TrackEntry to = entry.mixingTo;
|
||||||
Timeline[] timelines = entry.animation.timelines.Items;
|
Timeline[] timelines = entry.animation.timelines.Items;
|
||||||
|
|||||||
@ -219,8 +219,6 @@ namespace Spine {
|
|||||||
Array.Copy(Items, index, array, arrayIndex, count);
|
Array.Copy(Items, index, array, arrayIndex, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public bool Exists (Predicate<T> match) {
|
public bool Exists (Predicate<T> match) {
|
||||||
CheckMatch(match);
|
CheckMatch(match);
|
||||||
return GetIndex(0, Count, match) != -1;
|
return GetIndex(0, Count, match) != -1;
|
||||||
|
|||||||
@ -325,7 +325,6 @@ namespace Spine {
|
|||||||
return skeletonData;
|
return skeletonData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <returns>May be null.</returns>
|
/// <returns>May be null.</returns>
|
||||||
private Skin ReadSkin (SkeletonInput input, SkeletonData skeletonData, bool defaultSkin, bool nonessential) {
|
private Skin ReadSkin (SkeletonInput input, SkeletonData skeletonData, bool defaultSkin, bool nonessential) {
|
||||||
|
|
||||||
|
|||||||
@ -125,7 +125,6 @@ namespace Spine {
|
|||||||
this.maxY = maxY;
|
this.maxY = maxY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>Returns true if the axis aligned bounding box contains the point.</summary>
|
/// <summary>Returns true if the axis aligned bounding box contains the point.</summary>
|
||||||
public bool AabbContainsPoint (float x, float y) {
|
public bool AabbContainsPoint (float x, float y) {
|
||||||
return x >= minX && x <= maxX && y >= minY && y <= maxY;
|
return x >= minX && x <= maxX && y >= minY && y <= maxY;
|
||||||
|
|||||||
@ -381,12 +381,11 @@ public class AnimationState {
|
|||||||
Slot slot = skeleton.slots.get(timeline.slotIndex);
|
Slot slot = skeleton.slots.get(timeline.slotIndex);
|
||||||
if (!slot.bone.active) return;
|
if (!slot.bone.active) return;
|
||||||
|
|
||||||
float[] frames = timeline.frames;
|
if (time < timeline.frames[0]) { // Time is before first frame.
|
||||||
if (time < frames[0]) { // Time is before first frame.
|
|
||||||
if (blend == MixBlend.setup || blend == MixBlend.first)
|
if (blend == MixBlend.setup || blend == MixBlend.first)
|
||||||
setAttachment(skeleton, slot, slot.data.attachmentName, attachments);
|
setAttachment(skeleton, slot, slot.data.attachmentName, attachments);
|
||||||
} else
|
} else
|
||||||
setAttachment(skeleton, slot, timeline.attachmentNames[Timeline.search(frames, time)], attachments);
|
setAttachment(skeleton, slot, timeline.attachmentNames[Timeline.search(timeline.frames, time)], attachments);
|
||||||
|
|
||||||
// If an attachment wasn't set (ie before the first frame or attachments is false), set the setup attachment later.
|
// If an attachment wasn't set (ie before the first frame or attachments is false), set the setup attachment later.
|
||||||
if (slot.attachmentState <= unkeyedState) slot.attachmentState = unkeyedState + SETUP;
|
if (slot.attachmentState <= unkeyedState) slot.attachmentState = unkeyedState + SETUP;
|
||||||
@ -675,7 +674,7 @@ public class AnimationState {
|
|||||||
TrackEntry entry = addAnimation(trackIndex, emptyAnimation, false, delay <= 0 ? 1 : delay);
|
TrackEntry entry = addAnimation(trackIndex, emptyAnimation, false, delay <= 0 ? 1 : delay);
|
||||||
entry.mixDuration = mixDuration;
|
entry.mixDuration = mixDuration;
|
||||||
entry.trackEnd = mixDuration;
|
entry.trackEnd = mixDuration;
|
||||||
if (delay <= 0 && entry.previous != null) entry.delay = entry.previous.getTrackComplete() - entry.mixDuration;
|
if (delay <= 0 && entry.previous != null) entry.delay = entry.previous.getTrackComplete() - entry.mixDuration + delay;
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -180,8 +180,8 @@ module spine {
|
|||||||
applyTime = current.animation.duration - applyTime;
|
applyTime = current.animation.duration - applyTime;
|
||||||
applyEvents = null;
|
applyEvents = null;
|
||||||
}
|
}
|
||||||
let timelineCount = current.animation.timelines.length;
|
|
||||||
let timelines = current.animation.timelines;
|
let timelines = current.animation.timelines;
|
||||||
|
let timelineCount = timelines.length;
|
||||||
if ((i == 0 && mix == 1) || blend == MixBlend.add) {
|
if ((i == 0 && mix == 1) || blend == MixBlend.add) {
|
||||||
for (let ii = 0; ii < timelineCount; ii++) {
|
for (let ii = 0; ii < timelineCount; ii++) {
|
||||||
// Fixes issue #302 on IOS9 where mix, blend sometimes became undefined and caused assets
|
// Fixes issue #302 on IOS9 where mix, blend sometimes became undefined and caused assets
|
||||||
@ -253,8 +253,8 @@ module spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let attachments = mix < from.attachmentThreshold, drawOrder = mix < from.drawOrderThreshold;
|
let attachments = mix < from.attachmentThreshold, drawOrder = mix < from.drawOrderThreshold;
|
||||||
let timelineCount = from.animation.timelines.length;
|
|
||||||
let timelines = from.animation.timelines;
|
let timelines = from.animation.timelines;
|
||||||
|
let timelineCount = timelines.length;
|
||||||
let alphaHold = from.alpha * to.interruptAlpha, alphaMix = alphaHold * (1 - mix);
|
let alphaHold = from.alpha * to.interruptAlpha, alphaMix = alphaHold * (1 - mix);
|
||||||
let animationLast = from.animationLast, animationTime = from.getAnimationTime(), applyTime = animationTime;
|
let animationLast = from.animationLast, animationTime = from.getAnimationTime(), applyTime = animationTime;
|
||||||
let events = null;
|
let events = null;
|
||||||
@ -331,12 +331,11 @@ module spine {
|
|||||||
var slot = skeleton.slots[timeline.slotIndex];
|
var slot = skeleton.slots[timeline.slotIndex];
|
||||||
if (!slot.bone.active) return;
|
if (!slot.bone.active) return;
|
||||||
|
|
||||||
var frames = timeline.frames;
|
if (time < timeline.frames[0]) { // Time is before first frame.
|
||||||
if (time < frames[0]) { // Time is before first frame.
|
|
||||||
if (blend == MixBlend.setup || blend == MixBlend.first)
|
if (blend == MixBlend.setup || blend == MixBlend.first)
|
||||||
this.setAttachment(skeleton, slot, slot.data.attachmentName, attachments);
|
this.setAttachment(skeleton, slot, slot.data.attachmentName, attachments);
|
||||||
} else
|
} else
|
||||||
this.setAttachment(skeleton, slot, timeline.attachmentNames[Timeline.search1(frames, time)], attachments);
|
this.setAttachment(skeleton, slot, timeline.attachmentNames[Timeline.search1(timeline.frames, time)], attachments);
|
||||||
|
|
||||||
// If an attachment wasn't set (ie before the first frame or attachments is false), set the setup attachment later.
|
// If an attachment wasn't set (ie before the first frame or attachments is false), set the setup attachment later.
|
||||||
if (slot.attachmentState <= this.unkeyedState) slot.attachmentState = this.unkeyedState + SETUP;
|
if (slot.attachmentState <= this.unkeyedState) slot.attachmentState = this.unkeyedState + SETUP;
|
||||||
@ -347,7 +346,7 @@ module spine {
|
|||||||
if (attachments) slot.attachmentState = this.unkeyedState + CURRENT;
|
if (attachments) slot.attachmentState = this.unkeyedState + CURRENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
applyRotateTimeline (timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, blend: MixBlend,
|
applyRotateTimeline (timeline: RotateTimeline, skeleton: Skeleton, time: number, alpha: number, blend: MixBlend,
|
||||||
timelinesRotation: Array<number>, i: number, firstFrame: boolean) {
|
timelinesRotation: Array<number>, i: number, firstFrame: boolean) {
|
||||||
|
|
||||||
if (firstFrame) timelinesRotation[i] = 0;
|
if (firstFrame) timelinesRotation[i] = 0;
|
||||||
@ -357,10 +356,9 @@ module spine {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let rotateTimeline = timeline as RotateTimeline;
|
let bone = skeleton.bones[timeline.boneIndex];
|
||||||
let bone = skeleton.bones[rotateTimeline.boneIndex];
|
|
||||||
if (!bone.active) return;
|
if (!bone.active) return;
|
||||||
let frames = rotateTimeline.frames;
|
let frames = timeline.frames;
|
||||||
let r1 = 0, r2 = 0;
|
let r1 = 0, r2 = 0;
|
||||||
if (time < frames[0]) {
|
if (time < frames[0]) {
|
||||||
switch (blend) {
|
switch (blend) {
|
||||||
@ -374,7 +372,7 @@ module spine {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
r1 = blend == MixBlend.setup ? bone.data.rotation : bone.rotation;
|
r1 = blend == MixBlend.setup ? bone.data.rotation : bone.rotation;
|
||||||
r2 = bone.data.rotation + rotateTimeline.getCurveValue(time);
|
r2 = bone.data.rotation + timeline.getCurveValue(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mix between rotations using the direction of the shortest route on the first frame while detecting crosses.
|
// Mix between rotations using the direction of the shortest route on the first frame while detecting crosses.
|
||||||
@ -619,7 +617,7 @@ module spine {
|
|||||||
let entry = this.addAnimationWith(trackIndex, AnimationState.emptyAnimation(), false, delay <= 0 ? 1 : delay);
|
let entry = this.addAnimationWith(trackIndex, AnimationState.emptyAnimation(), false, delay <= 0 ? 1 : delay);
|
||||||
entry.mixDuration = mixDuration;
|
entry.mixDuration = mixDuration;
|
||||||
entry.trackEnd = mixDuration;
|
entry.trackEnd = mixDuration;
|
||||||
if (delay <= 0 && entry.previous) entry.delay = entry.previous.getTrackComplete() - entry.mixDuration;
|
if (delay <= 0 && entry.previous) entry.delay = entry.previous.getTrackComplete() - entry.mixDuration + delay;
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -688,17 +686,16 @@ module spine {
|
|||||||
this.animationsChanged = false;
|
this.animationsChanged = false;
|
||||||
|
|
||||||
this.propertyIDs.clear();
|
this.propertyIDs.clear();
|
||||||
|
let tracks = this.tracks;
|
||||||
for (let i = 0, n = this.tracks.length; i < n; i++) {
|
for (let i = 0, n = tracks.length; i < n; i++) {
|
||||||
let entry = this.tracks[i];
|
let entry = tracks[i];
|
||||||
if (!entry) continue;
|
if (!entry) continue;
|
||||||
while (entry.mixingFrom)
|
while (entry.mixingFrom)
|
||||||
entry = entry.mixingFrom;
|
entry = entry.mixingFrom;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (!entry.mixingFrom || entry.mixBlend != MixBlend.add) this.computeHold(entry);
|
if (!entry.mixingTo || entry.mixBlend != MixBlend.add) this.computeHold(entry);
|
||||||
entry = entry.mixingTo;
|
entry = entry.mixingTo;
|
||||||
} while (entry)
|
} while (entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -123,7 +123,8 @@ module spine {
|
|||||||
if (bone.ascaleX < 0) rotationIK += 180;
|
if (bone.ascaleX < 0) rotationIK += 180;
|
||||||
if (rotationIK > 180)
|
if (rotationIK > 180)
|
||||||
rotationIK -= 360;
|
rotationIK -= 360;
|
||||||
else if (rotationIK < -180) rotationIK += 360;
|
else if (rotationIK < -180)
|
||||||
|
rotationIK += 360;
|
||||||
let sx = bone.ascaleX, sy = bone.ascaleY;
|
let sx = bone.ascaleX, sy = bone.ascaleY;
|
||||||
if (compress || stretch) {
|
if (compress || stretch) {
|
||||||
switch (bone.data.transformMode) {
|
switch (bone.data.transformMode) {
|
||||||
@ -272,13 +273,15 @@ module spine {
|
|||||||
a1 = (a1 - os) * MathUtils.radDeg + os1 - rotation;
|
a1 = (a1 - os) * MathUtils.radDeg + os1 - rotation;
|
||||||
if (a1 > 180)
|
if (a1 > 180)
|
||||||
a1 -= 360;
|
a1 -= 360;
|
||||||
else if (a1 < -180) a1 += 360;
|
else if (a1 < -180) //
|
||||||
|
a1 += 360;
|
||||||
parent.updateWorldTransformWith(px, py, rotation + a1 * alpha, sx, parent.ascaleY, 0, 0);
|
parent.updateWorldTransformWith(px, py, rotation + a1 * alpha, sx, parent.ascaleY, 0, 0);
|
||||||
rotation = child.arotation;
|
rotation = child.arotation;
|
||||||
a2 = ((a2 + os) * MathUtils.radDeg - child.ashearX) * s2 + os2 - rotation;
|
a2 = ((a2 + os) * MathUtils.radDeg - child.ashearX) * s2 + os2 - rotation;
|
||||||
if (a2 > 180)
|
if (a2 > 180)
|
||||||
a2 -= 360;
|
a2 -= 360;
|
||||||
else if (a2 < -180) a2 += 360;
|
else if (a2 < -180) //
|
||||||
|
a2 += 360;
|
||||||
child.updateWorldTransformWith(cx, cy, rotation + a2 * alpha, child.ascaleX, child.ascaleY, child.ashearX, child.ashearY);
|
child.updateWorldTransformWith(cx, cy, rotation + a2 * alpha, child.ascaleX, child.ascaleY, child.ashearX, child.ashearY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -93,8 +93,8 @@ module spine {
|
|||||||
let data = this.data;
|
let data = this.data;
|
||||||
let tangents = data.rotateMode == RotateMode.Tangent, scale = data.rotateMode == RotateMode.ChainScale;
|
let tangents = data.rotateMode == RotateMode.Tangent, scale = data.rotateMode == RotateMode.ChainScale;
|
||||||
|
|
||||||
let boneCount = this.bones.length, spacesCount = tangents ? boneCount : boneCount + 1;
|
|
||||||
let bones = this.bones;
|
let bones = this.bones;
|
||||||
|
let boneCount = bones.length, spacesCount = tangents ? boneCount : boneCount + 1;
|
||||||
let spaces = Utils.setArraySize(this.spaces, spacesCount), lengths: Array<number> = scale ? this.lengths = Utils.setArraySize(this.lengths, boneCount) : null;
|
let spaces = Utils.setArraySize(this.spaces, spacesCount), lengths: Array<number> = scale ? this.lengths = Utils.setArraySize(this.lengths, boneCount) : null;
|
||||||
let spacing = this.spacing;
|
let spacing = this.spacing;
|
||||||
|
|
||||||
@ -342,7 +342,7 @@ module spine {
|
|||||||
|
|
||||||
if (this.data.positionMode == PositionMode.Percent) position *= pathLength;
|
if (this.data.positionMode == PositionMode.Percent) position *= pathLength;
|
||||||
|
|
||||||
let multiplier = 0;
|
let multiplier;
|
||||||
switch (this.data.spacingMode) {
|
switch (this.data.spacingMode) {
|
||||||
case SpacingMode.Percent:
|
case SpacingMode.Percent:
|
||||||
multiplier = pathLength;
|
multiplier = pathLength;
|
||||||
|
|||||||
@ -255,7 +255,6 @@ module spine {
|
|||||||
x: number;
|
x: number;
|
||||||
y: number;
|
y: number;
|
||||||
index: number;
|
index: number;
|
||||||
rotate: boolean;
|
|
||||||
degrees: number;
|
degrees: number;
|
||||||
texture: Texture;
|
texture: Texture;
|
||||||
names: string[];
|
names: string[];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user