@xtia/timeline 1.1.8 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/internal/timeline.d.ts +10 -1
- package/internal/timeline.js +6 -2
- package/package.json +1 -1
package/internal/timeline.d.ts
CHANGED
|
@@ -118,7 +118,8 @@ export declare class Timeline {
|
|
|
118
118
|
*/
|
|
119
119
|
range(): TimelineRange;
|
|
120
120
|
/**
|
|
121
|
-
* Seeks the Timeline to a specified position, triggering in order any point and range
|
|
121
|
+
* Seeks the Timeline to a specified position, triggering in order any point and range
|
|
122
|
+
* subscriptions between its current and new positions
|
|
122
123
|
* @param toPosition
|
|
123
124
|
*/
|
|
124
125
|
seek(toPosition: number | TimelinePoint): void;
|
|
@@ -133,6 +134,14 @@ export declare class Timeline {
|
|
|
133
134
|
*/
|
|
134
135
|
seek(toPosition: number | TimelinePoint, durationMs: number, easer?: Easer | keyof typeof easers): Promise<void>;
|
|
135
136
|
seek(toPosition: number | TimelinePoint, duration: Period, easer?: Easer | keyof typeof easers): Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* Smooth-seeks through a range over a given duration
|
|
139
|
+
* @param range The range to seek through
|
|
140
|
+
* @param durationMs Smooth-seek duration
|
|
141
|
+
* @param easer Optional easing function
|
|
142
|
+
*/
|
|
143
|
+
seek(range: TimelineRange, durationMs: number, easer?: Easer | keyof typeof easers): Promise<void>;
|
|
144
|
+
seek(range: TimelineRange, duration: Period, easer?: Easer | keyof typeof easers): Promise<void>;
|
|
136
145
|
private seekDirect;
|
|
137
146
|
private seekWrapped;
|
|
138
147
|
private seekPoints;
|
package/internal/timeline.js
CHANGED
|
@@ -176,6 +176,10 @@ export class Timeline {
|
|
|
176
176
|
return range;
|
|
177
177
|
}
|
|
178
178
|
seek(to, duration, easer) {
|
|
179
|
+
if (to instanceof TimelineRange) {
|
|
180
|
+
this.seek(to.start);
|
|
181
|
+
return this.seek(to, duration, easer);
|
|
182
|
+
}
|
|
179
183
|
const durationMs = typeof duration == "object"
|
|
180
184
|
? duration.asMilliseconds
|
|
181
185
|
: duration;
|
|
@@ -195,7 +199,6 @@ export class Timeline {
|
|
|
195
199
|
this.seekDirect(interruptPosition);
|
|
196
200
|
}
|
|
197
201
|
if (!durationMs) {
|
|
198
|
-
const fromTime = this._currentTime;
|
|
199
202
|
this.seekDirect(toPosition);
|
|
200
203
|
this._frameEvents?.emit();
|
|
201
204
|
// only add Promise overhead if duration is explicitly 0
|
|
@@ -352,7 +355,8 @@ export class Timeline {
|
|
|
352
355
|
previousTime = currentTime;
|
|
353
356
|
let delta = elapsed * this.timeScale;
|
|
354
357
|
this.next(delta);
|
|
355
|
-
|
|
358
|
+
if (this._pause)
|
|
359
|
+
rafId = requestAnimFrame(frame);
|
|
356
360
|
};
|
|
357
361
|
rafId = requestAnimFrame(frame);
|
|
358
362
|
this._pause = () => cancelAnimFrame(rafId);
|