@luma.gl/engine 9.0.0-alpha.14 → 9.0.0-alpha.16

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.
Files changed (172) hide show
  1. package/dist/animation/key-frames.d.ts +1 -1
  2. package/dist/animation/key-frames.d.ts.map +1 -1
  3. package/dist/animation/key-frames.js +51 -72
  4. package/dist/animation/timeline.d.ts +4 -4
  5. package/dist/animation/timeline.d.ts.map +1 -1
  6. package/dist/animation/timeline.js +94 -131
  7. package/dist/animation-loop/animation-loop.d.ts +2 -3
  8. package/dist/animation-loop/animation-loop.d.ts.map +1 -1
  9. package/dist/animation-loop/animation-loop.js +414 -473
  10. package/dist/animation-loop/animation-props.d.ts +1 -2
  11. package/dist/animation-loop/animation-props.d.ts.map +1 -1
  12. package/dist/animation-loop/animation-props.js +0 -1
  13. package/dist/animation-loop/make-animation-loop.d.ts +1 -1
  14. package/dist/animation-loop/make-animation-loop.d.ts.map +1 -1
  15. package/dist/animation-loop/make-animation-loop.js +26 -31
  16. package/dist/animation-loop/render-loop.js +17 -7
  17. package/dist/bundle.js +2 -2
  18. package/dist/dist.min.js +31 -0
  19. package/dist/es5/animation/key-frames.js +84 -0
  20. package/dist/es5/animation/key-frames.js.map +1 -0
  21. package/dist/es5/animation/timeline.js +183 -0
  22. package/dist/es5/animation/timeline.js.map +1 -0
  23. package/dist/es5/animation-loop/animation-loop.js +534 -0
  24. package/dist/es5/animation-loop/animation-loop.js.map +1 -0
  25. package/dist/es5/animation-loop/animation-props.js +2 -0
  26. package/dist/es5/animation-loop/animation-props.js.map +1 -0
  27. package/dist/es5/animation-loop/make-animation-loop.js +53 -0
  28. package/dist/es5/animation-loop/make-animation-loop.js.map +1 -0
  29. package/dist/es5/animation-loop/render-loop.js +39 -0
  30. package/dist/es5/animation-loop/render-loop.js.map +1 -0
  31. package/dist/es5/bundle.js +6 -0
  32. package/dist/es5/bundle.js.map +1 -0
  33. package/dist/es5/geometries/cone-geometry.js +43 -0
  34. package/dist/es5/geometries/cone-geometry.js.map +1 -0
  35. package/dist/es5/geometries/cube-geometry.js +84 -0
  36. package/dist/es5/geometries/cube-geometry.js.map +1 -0
  37. package/dist/es5/geometries/cylinder-geometry.js +39 -0
  38. package/dist/es5/geometries/cylinder-geometry.js.map +1 -0
  39. package/dist/es5/geometries/ico-sphere-geometry.js +185 -0
  40. package/dist/es5/geometries/ico-sphere-geometry.js.map +1 -0
  41. package/dist/es5/geometries/plane-geometry.js +137 -0
  42. package/dist/es5/geometries/plane-geometry.js.map +1 -0
  43. package/dist/es5/geometries/sphere-geometry.js +120 -0
  44. package/dist/es5/geometries/sphere-geometry.js.map +1 -0
  45. package/dist/es5/geometries/truncated-cone-geometry.js +160 -0
  46. package/dist/es5/geometries/truncated-cone-geometry.js.map +1 -0
  47. package/dist/es5/geometry/geometry-table.js +2 -0
  48. package/dist/es5/geometry/geometry-table.js.map +1 -0
  49. package/dist/es5/geometry/geometry-utils.js +39 -0
  50. package/dist/es5/geometry/geometry-utils.js.map +1 -0
  51. package/dist/es5/geometry/geometry.js +150 -0
  52. package/dist/es5/geometry/geometry.js.map +1 -0
  53. package/dist/es5/geometry/primitive-utils.js +2 -0
  54. package/dist/es5/geometry/primitive-utils.js.map +1 -0
  55. package/dist/es5/index.js +112 -0
  56. package/dist/es5/index.js.map +1 -0
  57. package/dist/es5/lib/clip-space.js +2 -0
  58. package/dist/es5/lib/clip-space.js.map +1 -0
  59. package/dist/es5/lib/model-utils.js +52 -0
  60. package/dist/es5/lib/model-utils.js.map +1 -0
  61. package/dist/es5/lib/model.js +173 -0
  62. package/dist/es5/lib/model.js.map +1 -0
  63. package/dist/es5/lib/pipeline-factory.js +244 -0
  64. package/dist/es5/lib/pipeline-factory.js.map +1 -0
  65. package/dist/esm/animation/key-frames.js +57 -0
  66. package/dist/esm/animation/key-frames.js.map +1 -0
  67. package/dist/esm/animation/timeline.js +113 -0
  68. package/dist/esm/animation/timeline.js.map +1 -0
  69. package/dist/esm/animation-loop/animation-loop.js +367 -0
  70. package/dist/esm/animation-loop/animation-loop.js.map +1 -0
  71. package/dist/esm/animation-loop/animation-props.js +2 -0
  72. package/dist/esm/animation-loop/animation-props.js.map +1 -0
  73. package/dist/esm/animation-loop/make-animation-loop.js +28 -0
  74. package/dist/esm/animation-loop/make-animation-loop.js.map +1 -0
  75. package/dist/esm/animation-loop/render-loop.js +7 -0
  76. package/dist/esm/animation-loop/render-loop.js.map +1 -0
  77. package/dist/esm/bundle.js +4 -0
  78. package/dist/esm/bundle.js.map +1 -0
  79. package/dist/esm/geometries/cone-geometry.js +21 -0
  80. package/dist/esm/geometries/cone-geometry.js.map +1 -0
  81. package/dist/esm/geometries/cube-geometry.js +67 -0
  82. package/dist/esm/geometries/cube-geometry.js.map +1 -0
  83. package/dist/esm/geometries/cylinder-geometry.js +18 -0
  84. package/dist/esm/geometries/cylinder-geometry.js.map +1 -0
  85. package/dist/esm/geometries/ico-sphere-geometry.js +170 -0
  86. package/dist/esm/geometries/ico-sphere-geometry.js.map +1 -0
  87. package/dist/esm/geometries/plane-geometry.js +119 -0
  88. package/dist/esm/geometries/plane-geometry.js.map +1 -0
  89. package/dist/esm/geometries/sphere-geometry.js +102 -0
  90. package/dist/esm/geometries/sphere-geometry.js.map +1 -0
  91. package/dist/esm/geometries/truncated-cone-geometry.js +136 -0
  92. package/dist/esm/geometries/truncated-cone-geometry.js.map +1 -0
  93. package/dist/esm/geometry/geometry-table.js +2 -0
  94. package/dist/esm/geometry/geometry-table.js.map +1 -0
  95. package/dist/esm/geometry/geometry-utils.js +37 -0
  96. package/dist/esm/geometry/geometry-utils.js.map +1 -0
  97. package/dist/esm/geometry/geometry.js +119 -0
  98. package/dist/esm/geometry/geometry.js.map +1 -0
  99. package/dist/esm/geometry/primitive-utils.js +2 -0
  100. package/dist/esm/geometry/primitive-utils.js.map +1 -0
  101. package/dist/esm/index.js +16 -0
  102. package/dist/esm/index.js.map +1 -0
  103. package/dist/esm/lib/clip-space.js +2 -0
  104. package/dist/esm/lib/clip-space.js.map +1 -0
  105. package/dist/esm/lib/model-utils.js +40 -0
  106. package/dist/esm/lib/model-utils.js.map +1 -0
  107. package/dist/esm/lib/model.js +146 -0
  108. package/dist/esm/lib/model.js.map +1 -0
  109. package/dist/esm/lib/pipeline-factory.js +180 -0
  110. package/dist/esm/lib/pipeline-factory.js.map +1 -0
  111. package/dist/geometries/cone-geometry.d.ts +1 -1
  112. package/dist/geometries/cone-geometry.d.ts.map +1 -1
  113. package/dist/geometries/cone-geometry.js +12 -17
  114. package/dist/geometries/cube-geometry.d.ts +1 -1
  115. package/dist/geometries/cube-geometry.d.ts.map +1 -1
  116. package/dist/geometries/cube-geometry.js +187 -56
  117. package/dist/geometries/cylinder-geometry.d.ts +1 -1
  118. package/dist/geometries/cylinder-geometry.d.ts.map +1 -1
  119. package/dist/geometries/cylinder-geometry.js +10 -14
  120. package/dist/geometries/ico-sphere-geometry.d.ts +1 -1
  121. package/dist/geometries/ico-sphere-geometry.d.ts.map +1 -1
  122. package/dist/geometries/ico-sphere-geometry.js +141 -170
  123. package/dist/geometries/plane-geometry.d.ts +1 -1
  124. package/dist/geometries/plane-geometry.d.ts.map +1 -1
  125. package/dist/geometries/plane-geometry.js +93 -121
  126. package/dist/geometries/sphere-geometry.d.ts +1 -1
  127. package/dist/geometries/sphere-geometry.d.ts.map +1 -1
  128. package/dist/geometries/sphere-geometry.js +76 -100
  129. package/dist/geometries/truncated-cone-geometry.d.ts +1 -1
  130. package/dist/geometries/truncated-cone-geometry.d.ts.map +1 -1
  131. package/dist/geometries/truncated-cone-geometry.js +104 -131
  132. package/dist/geometry/geometry-table.d.ts +1 -1
  133. package/dist/geometry/geometry-table.d.ts.map +1 -1
  134. package/dist/geometry/geometry-table.js +0 -1
  135. package/dist/geometry/geometry-utils.js +22 -41
  136. package/dist/geometry/geometry.d.ts +4 -4
  137. package/dist/geometry/geometry.d.ts.map +1 -1
  138. package/dist/geometry/geometry.js +96 -142
  139. package/dist/geometry/primitive-utils.js +30 -1
  140. package/dist/index.js +20 -16
  141. package/dist/lib/clip-space.js +50 -1
  142. package/dist/lib/model-utils.js +97 -29
  143. package/dist/lib/model.d.ts +1 -1
  144. package/dist/lib/model.d.ts.map +1 -1
  145. package/dist/lib/model.js +122 -166
  146. package/dist/lib/pipeline-factory.d.ts +3 -3
  147. package/dist/lib/pipeline-factory.d.ts.map +1 -1
  148. package/dist/lib/pipeline-factory.js +136 -204
  149. package/package.json +12 -11
  150. package/dist/animation/key-frames.js.map +0 -1
  151. package/dist/animation/timeline.js.map +0 -1
  152. package/dist/animation-loop/animation-loop.js.map +0 -1
  153. package/dist/animation-loop/animation-props.js.map +0 -1
  154. package/dist/animation-loop/make-animation-loop.js.map +0 -1
  155. package/dist/animation-loop/render-loop.js.map +0 -1
  156. package/dist/bundle.js.map +0 -1
  157. package/dist/geometries/cone-geometry.js.map +0 -1
  158. package/dist/geometries/cube-geometry.js.map +0 -1
  159. package/dist/geometries/cylinder-geometry.js.map +0 -1
  160. package/dist/geometries/ico-sphere-geometry.js.map +0 -1
  161. package/dist/geometries/plane-geometry.js.map +0 -1
  162. package/dist/geometries/sphere-geometry.js.map +0 -1
  163. package/dist/geometries/truncated-cone-geometry.js.map +0 -1
  164. package/dist/geometry/geometry-table.js.map +0 -1
  165. package/dist/geometry/geometry-utils.js.map +0 -1
  166. package/dist/geometry/geometry.js.map +0 -1
  167. package/dist/geometry/primitive-utils.js.map +0 -1
  168. package/dist/index.js.map +0 -1
  169. package/dist/lib/clip-space.js.map +0 -1
  170. package/dist/lib/model-utils.js.map +0 -1
  171. package/dist/lib/model.js.map +0 -1
  172. package/dist/lib/pipeline-factory.js.map +0 -1
@@ -1,4 +1,4 @@
1
- export declare type KeyFrame<T> = [number, T];
1
+ export type KeyFrame<T> = [number, T];
2
2
  /** Holds a list of key frames (timestamped values) */
3
3
  export declare class KeyFrames<T = number> {
4
4
  startIndex: number;
@@ -1 +1 @@
1
- {"version":3,"file":"key-frames.d.ts","sourceRoot":"","sources":["../../src/animation/key-frames.ts"],"names":[],"mappings":"AACA,oBAAY,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAEtC,sDAAsD;AACtD,qBAAa,SAAS,CAAC,CAAC,GAAG,MAAM;IAC/B,UAAU,EAAE,MAAM,CAAM;IACxB,QAAQ,EAAE,MAAM,CAAM;IACtB,MAAM,EAAE,MAAM,CAAK;IACnB,KAAK,EAAE,MAAM,EAAE,CAAM;IACrB,MAAM,EAAE,CAAC,EAAE,CAAM;IACjB,OAAO,CAAC,SAAS,CAAM;gBAEX,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE;IAKpC,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI;IAa5C,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAS3B,YAAY,IAAI,MAAM;IAItB,UAAU,IAAI,MAAM;IAIpB,YAAY,IAAI,CAAC;IAIjB,UAAU,IAAI,CAAC;IAIf,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CAiBnC"}
1
+ {"version":3,"file":"key-frames.d.ts","sourceRoot":"","sources":["../../src/animation/key-frames.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAEtC,sDAAsD;AACtD,qBAAa,SAAS,CAAC,CAAC,GAAG,MAAM;IAC/B,UAAU,EAAE,MAAM,CAAM;IACxB,QAAQ,EAAE,MAAM,CAAM;IACtB,MAAM,EAAE,MAAM,CAAK;IACnB,KAAK,EAAE,MAAM,EAAE,CAAM;IACrB,MAAM,EAAE,CAAC,EAAE,CAAM;IACjB,OAAO,CAAC,SAAS,CAAM;gBAEX,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE;IAKpC,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI;IAa5C,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAS3B,YAAY,IAAI,MAAM;IAItB,UAAU,IAAI,MAAM;IAIpB,YAAY,IAAI,CAAC;IAIjB,UAAU,IAAI,CAAC;IAIf,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CAiBnC"}
@@ -1,77 +1,56 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
1
+ /** Holds a list of key frames (timestamped values) */
2
2
  export class KeyFrames {
3
- constructor(keyFrames) {
4
- _defineProperty(this, "startIndex", -1);
5
-
6
- _defineProperty(this, "endIndex", -1);
7
-
8
- _defineProperty(this, "factor", 0);
9
-
10
- _defineProperty(this, "times", []);
11
-
12
- _defineProperty(this, "values", []);
13
-
14
- _defineProperty(this, "_lastTime", -1);
15
-
16
- this.setKeyFrames(keyFrames);
17
- this.setTime(0);
18
- }
19
-
20
- setKeyFrames(keyFrames) {
21
- const numKeys = keyFrames.length;
22
- this.times.length = numKeys;
23
- this.values.length = numKeys;
24
-
25
- for (let i = 0; i < numKeys; ++i) {
26
- this.times[i] = keyFrames[i][0];
27
- this.values[i] = keyFrames[i][1];
3
+ constructor(keyFrames) {
4
+ this.startIndex = -1;
5
+ this.endIndex = -1;
6
+ this.factor = 0;
7
+ this.times = [];
8
+ this.values = [];
9
+ this._lastTime = -1;
10
+ this.setKeyFrames(keyFrames);
11
+ this.setTime(0);
28
12
  }
29
-
30
- this._calculateKeys(this._lastTime);
31
- }
32
-
33
- setTime(time) {
34
- time = Math.max(0, time);
35
-
36
- if (time !== this._lastTime) {
37
- this._calculateKeys(time);
38
-
39
- this._lastTime = time;
13
+ setKeyFrames(keyFrames) {
14
+ const numKeys = keyFrames.length;
15
+ this.times.length = numKeys;
16
+ this.values.length = numKeys;
17
+ for (let i = 0; i < numKeys; ++i) {
18
+ this.times[i] = keyFrames[i][0];
19
+ this.values[i] = keyFrames[i][1];
20
+ }
21
+ this._calculateKeys(this._lastTime);
40
22
  }
41
- }
42
-
43
- getStartTime() {
44
- return this.times[this.startIndex];
45
- }
46
-
47
- getEndTime() {
48
- return this.times[this.endIndex];
49
- }
50
-
51
- getStartData() {
52
- return this.values[this.startIndex];
53
- }
54
-
55
- getEndData() {
56
- return this.values[this.endIndex];
57
- }
58
-
59
- _calculateKeys(time) {
60
- let index = 0;
61
- const numKeys = this.times.length;
62
-
63
- for (index = 0; index < numKeys - 2; ++index) {
64
- if (this.times[index + 1] > time) {
65
- break;
66
- }
23
+ setTime(time) {
24
+ time = Math.max(0, time);
25
+ if (time !== this._lastTime) {
26
+ this._calculateKeys(time);
27
+ this._lastTime = time;
28
+ }
29
+ }
30
+ getStartTime() {
31
+ return this.times[this.startIndex];
32
+ }
33
+ getEndTime() {
34
+ return this.times[this.endIndex];
35
+ }
36
+ getStartData() {
37
+ return this.values[this.startIndex];
38
+ }
39
+ getEndData() {
40
+ return this.values[this.endIndex];
41
+ }
42
+ _calculateKeys(time) {
43
+ let index = 0;
44
+ const numKeys = this.times.length;
45
+ for (index = 0; index < numKeys - 2; ++index) {
46
+ if (this.times[index + 1] > time) {
47
+ break;
48
+ }
49
+ }
50
+ this.startIndex = index;
51
+ this.endIndex = index + 1;
52
+ const startTime = this.times[this.startIndex];
53
+ const endTime = this.times[this.endIndex];
54
+ this.factor = Math.min(Math.max(0, (time - startTime) / (endTime - startTime)), 1);
67
55
  }
68
-
69
- this.startIndex = index;
70
- this.endIndex = index + 1;
71
- const startTime = this.times[this.startIndex];
72
- const endTime = this.times[this.endIndex];
73
- this.factor = Math.min(Math.max(0, (time - startTime) / (endTime - startTime)), 1);
74
- }
75
-
76
56
  }
77
- //# sourceMappingURL=key-frames.js.map
@@ -5,23 +5,23 @@
5
5
  * @param rate = 1
6
6
  * @param repeat = 1
7
7
  */
8
- export declare type ChannelOptions = {
8
+ export type ChannelOptions = {
9
9
  delay?: number;
10
10
  duration?: number;
11
11
  rate?: number;
12
12
  repeat?: number;
13
13
  };
14
- export declare type AnimationOptions = {
14
+ export type AnimationOptions = {
15
15
  setTime: (time: number) => void;
16
16
  };
17
- declare type Channel = {
17
+ type Channel = {
18
18
  time: number;
19
19
  delay: number;
20
20
  duration: number;
21
21
  rate: number;
22
22
  repeat: number;
23
23
  };
24
- declare type Animation = {
24
+ type Animation = {
25
25
  channel?: number;
26
26
  animation: {
27
27
  setTime: (time: number) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../../src/animation/timeline.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACF,oBAAY,cAAc,GAAG;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,oBAAY,gBAAgB,GAAG;IAC7B,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAChC,CAAA;AAEA,aAAK,OAAO,GAAG;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,aAAK,SAAS,GAAG;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE;QACT,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;KAChC,CAAA;CACF,CAAA;AAKD,qBAAa,QAAQ;IACnB,IAAI,EAAE,MAAM,CAAK;IACjB,QAAQ,uBAA8B;IACtC,UAAU,yBAAgC;IAC1C,OAAO,EAAE,OAAO,CAAS;IACzB,cAAc,EAAE,MAAM,CAAM;;IAK5B,UAAU,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM;IAiBzC,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAUnC,UAA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I,EAAE,MAAM,CAAK;IACjB,QAAQ,uBAA8B;IACtC,UAAU,yBAAgC;IAC1C,OAAO,EAAE,OAAO,CAAS;IACzB,cAAc,EAAE,MAAM,CAAM;;IAK5B,UAAU,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM;IAiBzC,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAUnC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IASnC,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;IAchC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAe3B,IAAI,IAAI,IAAI;IAIZ,KAAK,IAAI,IAAI;IAKb,KAAK,IAAI,IAAI;IAIb,eAAe,CAAC,SAAS,EAAE,gBAAgB,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM;IAa5E,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIrC,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAUhC,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;CAWtD"}
@@ -1,143 +1,106 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
1
+ // luma.gl, MIT license
2
2
  let channelHandles = 1;
3
3
  let animationHandles = 1;
4
4
  export class Timeline {
5
- constructor() {
6
- _defineProperty(this, "time", 0);
7
-
8
- _defineProperty(this, "channels", new Map());
9
-
10
- _defineProperty(this, "animations", new Map());
11
-
12
- _defineProperty(this, "playing", false);
13
-
14
- _defineProperty(this, "lastEngineTime", -1);
15
- }
16
-
17
- addChannel(props) {
18
- const {
19
- delay = 0,
20
- duration = Number.POSITIVE_INFINITY,
21
- rate = 1,
22
- repeat = 1
23
- } = props;
24
- const handle = channelHandles++;
25
- const channel = {
26
- time: 0,
27
- delay,
28
- duration,
29
- rate,
30
- repeat
31
- };
32
-
33
- this._setChannelTime(channel, this.time);
34
-
35
- this.channels.set(handle, channel);
36
- return handle;
37
- }
38
-
39
- removeChannel(handle) {
40
- this.channels.delete(handle);
41
-
42
- for (const [animationHandle, animation] of this.animations) {
43
- if (animation.channel === handle) {
44
- this.detachAnimation(animationHandle);
45
- }
5
+ constructor() {
6
+ this.time = 0;
7
+ this.channels = new Map();
8
+ this.animations = new Map();
9
+ this.playing = false;
10
+ this.lastEngineTime = -1;
46
11
  }
47
- }
48
-
49
- isFinished(handle) {
50
- const channel = this.channels.get(handle);
51
-
52
- if (channel === undefined) {
53
- return false;
12
+ addChannel(props) {
13
+ const { delay = 0, duration = Number.POSITIVE_INFINITY, rate = 1, repeat = 1 } = props;
14
+ const handle = channelHandles++;
15
+ const channel = {
16
+ time: 0,
17
+ delay,
18
+ duration,
19
+ rate,
20
+ repeat
21
+ };
22
+ this._setChannelTime(channel, this.time);
23
+ this.channels.set(handle, channel);
24
+ return handle;
54
25
  }
55
-
56
- return this.time >= channel.delay + channel.duration * channel.repeat;
57
- }
58
-
59
- getTime(handle) {
60
- if (handle === undefined) {
61
- return this.time;
26
+ removeChannel(handle) {
27
+ this.channels.delete(handle);
28
+ for (const [animationHandle, animation] of this.animations) {
29
+ if (animation.channel === handle) {
30
+ this.detachAnimation(animationHandle);
31
+ }
32
+ }
62
33
  }
63
-
64
- const channel = this.channels.get(handle);
65
-
66
- if (channel === undefined) {
67
- return -1;
34
+ isFinished(handle) {
35
+ const channel = this.channels.get(handle);
36
+ if (channel === undefined) {
37
+ return false;
38
+ }
39
+ return this.time >= channel.delay + channel.duration * channel.repeat;
68
40
  }
69
-
70
- return channel.time;
71
- }
72
-
73
- setTime(time) {
74
- this.time = Math.max(0, time);
75
- const channels = this.channels.values();
76
-
77
- for (const channel of channels) {
78
- this._setChannelTime(channel, this.time);
41
+ getTime(handle) {
42
+ if (handle === undefined) {
43
+ return this.time;
44
+ }
45
+ const channel = this.channels.get(handle);
46
+ if (channel === undefined) {
47
+ return -1;
48
+ }
49
+ return channel.time;
79
50
  }
80
-
81
- const animations = this.animations.values();
82
-
83
- for (const animationData of animations) {
84
- const {
85
- animation,
86
- channel
87
- } = animationData;
88
- animation.setTime(this.getTime(channel));
51
+ setTime(time) {
52
+ this.time = Math.max(0, time);
53
+ const channels = this.channels.values();
54
+ for (const channel of channels) {
55
+ this._setChannelTime(channel, this.time);
56
+ }
57
+ const animations = this.animations.values();
58
+ for (const animationData of animations) {
59
+ const { animation, channel } = animationData;
60
+ animation.setTime(this.getTime(channel));
61
+ }
89
62
  }
90
- }
91
-
92
- play() {
93
- this.playing = true;
94
- }
95
-
96
- pause() {
97
- this.playing = false;
98
- this.lastEngineTime = -1;
99
- }
100
-
101
- reset() {
102
- this.setTime(0);
103
- }
104
-
105
- attachAnimation(animation, channelHandle) {
106
- const animationHandle = animationHandles++;
107
- this.animations.set(animationHandle, {
108
- animation,
109
- channel: channelHandle
110
- });
111
- animation.setTime(this.getTime(channelHandle));
112
- return animationHandle;
113
- }
114
-
115
- detachAnimation(handle) {
116
- this.animations.delete(handle);
117
- }
118
-
119
- update(engineTime) {
120
- if (this.playing) {
121
- if (this.lastEngineTime === -1) {
122
- this.lastEngineTime = engineTime;
123
- }
124
-
125
- this.setTime(this.time + (engineTime - this.lastEngineTime));
126
- this.lastEngineTime = engineTime;
63
+ play() {
64
+ this.playing = true;
127
65
  }
128
- }
129
-
130
- _setChannelTime(channel, time) {
131
- const offsetTime = time - channel.delay;
132
- const totalDuration = channel.duration * channel.repeat;
133
-
134
- if (offsetTime >= totalDuration) {
135
- channel.time = channel.duration * channel.rate;
136
- } else {
137
- channel.time = Math.max(0, offsetTime) % channel.duration;
138
- channel.time *= channel.rate;
66
+ pause() {
67
+ this.playing = false;
68
+ this.lastEngineTime = -1;
69
+ }
70
+ reset() {
71
+ this.setTime(0);
72
+ }
73
+ attachAnimation(animation, channelHandle) {
74
+ const animationHandle = animationHandles++;
75
+ this.animations.set(animationHandle, {
76
+ animation,
77
+ channel: channelHandle
78
+ });
79
+ animation.setTime(this.getTime(channelHandle));
80
+ return animationHandle;
81
+ }
82
+ detachAnimation(handle) {
83
+ this.animations.delete(handle);
84
+ }
85
+ update(engineTime) {
86
+ if (this.playing) {
87
+ if (this.lastEngineTime === -1) {
88
+ this.lastEngineTime = engineTime;
89
+ }
90
+ this.setTime(this.time + (engineTime - this.lastEngineTime));
91
+ this.lastEngineTime = engineTime;
92
+ }
93
+ }
94
+ _setChannelTime(channel, time) {
95
+ const offsetTime = time - channel.delay;
96
+ const totalDuration = channel.duration * channel.repeat;
97
+ // Note(Tarek): Don't loop on final repeat.
98
+ if (offsetTime >= totalDuration) {
99
+ channel.time = channel.duration * channel.rate;
100
+ }
101
+ else {
102
+ channel.time = Math.max(0, offsetTime) % channel.duration;
103
+ channel.time *= channel.rate;
104
+ }
139
105
  }
140
- }
141
-
142
106
  }
143
- //# sourceMappingURL=timeline.js.map
@@ -1,10 +1,9 @@
1
- /// <reference types="offscreencanvas" />
2
1
  import { Device } from '@luma.gl/api';
3
2
  import { Timeline } from '../animation/timeline';
4
3
  import { AnimationProps } from './animation-props';
5
4
  import { Stats, Stat } from '@probe.gl/stats';
6
5
  /** AnimationLoop properties */
7
- export declare type AnimationLoopProps = {
6
+ export type AnimationLoopProps = {
8
7
  device: Device | Promise<Device>;
9
8
  onAddHTML?: (div: HTMLDivElement) => string;
10
9
  onInitialize?: (animationProps: AnimationProps) => Promise<unknown>;
@@ -16,7 +15,7 @@ export declare type AnimationLoopProps = {
16
15
  autoResizeDrawingBuffer?: boolean;
17
16
  useDevicePixels?: number | boolean;
18
17
  };
19
- export declare type MutableAnimationLoopProps = {
18
+ export type MutableAnimationLoopProps = {
20
19
  autoResizeViewport?: boolean;
21
20
  autoResizeDrawingBuffer?: boolean;
22
21
  useDevicePixels?: number | boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"animation-loop.d.ts","sourceRoot":"","sources":["../../src/animation-loop/animation-loop.ts"],"names":[],"mappings":";AAEA,OAAO,EAAO,MAAM,EAAC,MAAM,cAAc,CAAC;AAE1C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