mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 22:34:53 +08:00
[ts] 4.3 porting WIP.
This commit is contained in:
parent
5347aed45a
commit
cb7872274d
@ -245,31 +245,10 @@ export abstract class Timeline {
|
||||
abstract apply (skeleton: Skeleton, lastTime: number, time: number, events: Array<Event> | null, alpha: number,
|
||||
blend: MixBlend, direction: MixDirection, appliedPose: boolean): void;
|
||||
|
||||
/** Linear search using a stride of 1.
|
||||
/** Linear search using the specified stride (default 1).
|
||||
* @param time Must be >= the first value in <code>frames</code>.
|
||||
* @return The index of the first value <= <code>time</code>. */
|
||||
static search (frames: NumberArrayLike, time: number): number;
|
||||
|
||||
/** Linear search using the specified stride.
|
||||
* @param time Must be >= the first value in <code>frames</code>.
|
||||
* @return The index of the first value <= <code>time</code>. */
|
||||
static search (frames: NumberArrayLike, time: number, step: number): number;
|
||||
|
||||
static search (frames: NumberArrayLike, time: number, step?: number): number {
|
||||
if (step === undefined)
|
||||
return Timeline.search1(frames, time);
|
||||
else
|
||||
return Timeline.search2(frames, time, step);
|
||||
}
|
||||
|
||||
private static search1 (frames: NumberArrayLike, time: number) {
|
||||
let n = frames.length;
|
||||
for (let i = 1; i < n; i++)
|
||||
if (frames[i] > time) return i - 1;
|
||||
return n - 1;
|
||||
}
|
||||
|
||||
private static search2 (frames: NumberArrayLike, time: number, step: number) {
|
||||
static search (frames: NumberArrayLike, time: number, step = 1) {
|
||||
let n = frames.length;
|
||||
for (let i = step; i < n; i += step)
|
||||
if (frames[i] > time) return i - step;
|
||||
|
||||
@ -989,15 +989,17 @@ export class TrackEntry {
|
||||
* entry minus the specified mix duration plus the specified <code>delay</code> (ie the mix ends at
|
||||
* (<code>delay</code> = 0) or before (<code>delay</code> < 0) the previous track entry duration). If the previous
|
||||
* entry is looping, its next loop completion is used instead of its duration. */
|
||||
setMixDuration (mixDuration: number, delay: number) {
|
||||
setMixDuration (mixDuration: number, delay?: number) {
|
||||
this.mixDuration = mixDuration;
|
||||
if (delay <= 0) {
|
||||
if (this.previous != null)
|
||||
delay = Math.max(delay + this.previous.getTrackComplete() - mixDuration, 0);
|
||||
else
|
||||
delay = 0;
|
||||
if (delay !== undefined) {
|
||||
if (delay <= 0) {
|
||||
if (this.previous != null)
|
||||
delay = Math.max(delay + this.previous.getTrackComplete() - mixDuration, 0);
|
||||
else
|
||||
delay = 0;
|
||||
}
|
||||
this.delay = delay;
|
||||
}
|
||||
this.delay = delay;
|
||||
}
|
||||
|
||||
/** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to {@link MixBlend#replace}, which
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user