@xtia/timeline 1.1.9 → 1.1.11
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.js +9 -6
- package/package.json +1 -1
package/internal/timeline.js
CHANGED
|
@@ -87,8 +87,11 @@ export class Timeline {
|
|
|
87
87
|
this._progression = null;
|
|
88
88
|
if (endAction == "loop")
|
|
89
89
|
endAction = "restart";
|
|
90
|
-
if (autoplay
|
|
91
|
-
this.play(
|
|
90
|
+
if (autoplay === true) {
|
|
91
|
+
this.play();
|
|
92
|
+
}
|
|
93
|
+
else if (typeof autoplay == "number") {
|
|
94
|
+
this.play(autoplay);
|
|
92
95
|
}
|
|
93
96
|
if (typeof endAction == "object"
|
|
94
97
|
&& "restartAt" in endAction) {
|
|
@@ -107,7 +110,7 @@ export class Timeline {
|
|
|
107
110
|
else
|
|
108
111
|
this.endAction = {
|
|
109
112
|
type: EndAction[endAction],
|
|
110
|
-
at: this.
|
|
113
|
+
at: this.start,
|
|
111
114
|
};
|
|
112
115
|
}
|
|
113
116
|
/**
|
|
@@ -327,16 +330,16 @@ export class Timeline {
|
|
|
327
330
|
this.seek(arg.start);
|
|
328
331
|
return this.seek(arg.end, arg.duration / this.timeScale, easer);
|
|
329
332
|
}
|
|
330
|
-
if (arg
|
|
333
|
+
if (arg === undefined && requestAnimFrame) {
|
|
331
334
|
this.playWithRAF();
|
|
332
335
|
return;
|
|
333
336
|
}
|
|
334
337
|
this.playWithInterval(arg ?? default_fps);
|
|
335
338
|
}
|
|
336
339
|
playWithInterval(fps) {
|
|
337
|
-
let previousTime =
|
|
340
|
+
let previousTime = performance.now();
|
|
338
341
|
const interval = setInterval(() => {
|
|
339
|
-
const newTime =
|
|
342
|
+
const newTime = performance.now();
|
|
340
343
|
const elapsed = newTime - previousTime;
|
|
341
344
|
previousTime = newTime;
|
|
342
345
|
let delta = elapsed * this.timeScale;
|