@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.
@@ -87,8 +87,11 @@ export class Timeline {
87
87
  this._progression = null;
88
88
  if (endAction == "loop")
89
89
  endAction = "restart";
90
- if (autoplay !== false) {
91
- this.play(typeof autoplay == "number" ? autoplay : default_fps);
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.point(0),
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 !== undefined && requestAnimFrame) {
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 = Date.now();
340
+ let previousTime = performance.now();
338
341
  const interval = setInterval(() => {
339
- const newTime = Date.now();
342
+ const newTime = performance.now();
340
343
  const elapsed = newTime - previousTime;
341
344
  previousTime = newTime;
342
345
  let delta = elapsed * this.timeScale;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xtia/timeline",
3
- "version": "1.1.9",
3
+ "version": "1.1.11",
4
4
  "repository": {
5
5
  "url": "https://github.com/tiadrop/timeline",
6
6
  "type": "github"