mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-11 17:48:45 +08:00
[ts] Port of #2837
This commit is contained in:
parent
3f440bfc4a
commit
c9aca368d6
@ -852,10 +852,11 @@ spAnimationState_addAnimation(spAnimationState *self, int trackIndex, spAnimatio
|
||||
if (!last) {
|
||||
_spAnimationState_setCurrent(self, trackIndex, entry, 1);
|
||||
_spEventQueue_drain(internal->queue);
|
||||
if (delay < 0) delay = 0;
|
||||
} else {
|
||||
last->next = entry;
|
||||
entry->previous = last;
|
||||
if (delay <= 0) delay = MAX(delay +spTrackEntry_getTrackComplete(last) - entry->mixDuration, 0);
|
||||
if (delay <= 0) delay = MAX(delay + spTrackEntry_getTrackComplete(last) - entry->mixDuration, 0);
|
||||
}
|
||||
|
||||
entry->delay = delay;
|
||||
@ -872,7 +873,7 @@ spTrackEntry *spAnimationState_setEmptyAnimation(spAnimationState *self, int tra
|
||||
spTrackEntry *
|
||||
spAnimationState_addEmptyAnimation(spAnimationState *self, int trackIndex, float mixDuration, float delay) {
|
||||
spTrackEntry *entry = spAnimationState_addAnimation(self, trackIndex, SP_EMPTY_ANIMATION, 0, delay);
|
||||
if (delay <= 0) entry->delay = MAX(delay + entry->mixDuration - mixDuration, 0);
|
||||
if (delay <= 0) entry->delay = MAX(entry->delay + entry->mixDuration - mixDuration, 0);
|
||||
entry->mixDuration = mixDuration;
|
||||
entry->trackEnd = mixDuration;
|
||||
return entry;
|
||||
|
||||
@ -586,10 +586,11 @@ export class AnimationState {
|
||||
if (!last) {
|
||||
this.setCurrent(trackIndex, entry, true);
|
||||
this.queue.drain();
|
||||
if (delay < 0) delay = 0;
|
||||
} else {
|
||||
last.next = entry;
|
||||
entry.previous = last;
|
||||
if (delay <= 0) delay += last.getTrackComplete() - entry.mixDuration;
|
||||
if (delay <= 0) delay = Math.max(delay + last.getTrackComplete() - entry.mixDuration, 0);
|
||||
}
|
||||
|
||||
entry.delay = delay;
|
||||
@ -630,7 +631,7 @@ export class AnimationState {
|
||||
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
||||
addEmptyAnimation (trackIndex: number, mixDuration: number = 0, delay: number = 0) {
|
||||
let entry = this.addAnimationWith(trackIndex, AnimationState.emptyAnimation(), false, delay);
|
||||
if (delay <= 0) entry.delay += entry.mixDuration - mixDuration;
|
||||
if (delay <= 0) entry.delay = Math.max(entry.delay + entry.mixDuration - mixDuration, 0);
|
||||
entry.mixDuration = mixDuration;
|
||||
entry.trackEnd = mixDuration;
|
||||
return entry;
|
||||
@ -955,7 +956,12 @@ export class TrackEntry {
|
||||
|
||||
setMixDurationWithDelay (mixDuration: number, delay: number) {
|
||||
this._mixDuration = mixDuration;
|
||||
if (this.previous != null && delay <= 0) delay += this.previous.getTrackComplete() - mixDuration;
|
||||
if (delay <= 0) {
|
||||
if (this.previous != null)
|
||||
delay = Math.max(delay + this.previous.getTrackComplete() - mixDuration, 0);
|
||||
else
|
||||
delay = 0;
|
||||
}
|
||||
this.delay = delay;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user