@xtia/timeline 1.1.10 → 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 +7 -4
- 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) {
|
|
@@ -334,9 +337,9 @@ export class Timeline {
|
|
|
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;
|