@vpmedia/phaser 1.94.0 → 1.96.0

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 (205) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/package.json +11 -11
  3. package/src/phaser/core/animation.js +79 -56
  4. package/src/phaser/core/animation_manager.js +55 -55
  5. package/src/phaser/core/animation_parser.js +2 -2
  6. package/src/phaser/core/cache.js +154 -154
  7. package/src/phaser/core/device.js +2 -1
  8. package/src/phaser/core/device_util.js +27 -27
  9. package/src/phaser/core/dom.js +43 -43
  10. package/src/phaser/core/event_manager.js +63 -63
  11. package/src/phaser/core/factory.js +47 -47
  12. package/src/phaser/core/frame.js +30 -30
  13. package/src/phaser/core/frame_data.js +30 -28
  14. package/src/phaser/core/frame_util.js +8 -8
  15. package/src/phaser/core/game.js +35 -19
  16. package/src/phaser/core/input_pointer.js +18 -0
  17. package/src/phaser/core/loader.js +171 -171
  18. package/src/phaser/core/loader_parser.js +22 -22
  19. package/src/phaser/core/raf.js +1 -1
  20. package/src/phaser/core/scale_manager.js +3 -2
  21. package/src/phaser/core/scene.js +16 -10
  22. package/src/phaser/core/scene_manager.js +51 -43
  23. package/src/phaser/core/signal.js +56 -52
  24. package/src/phaser/core/sound.js +54 -54
  25. package/src/phaser/core/sound_manager.js +49 -49
  26. package/src/phaser/core/stage.js +16 -16
  27. package/src/phaser/core/time.js +54 -30
  28. package/src/phaser/core/timer.js +82 -64
  29. package/src/phaser/core/timer_event.js +9 -9
  30. package/src/phaser/core/tween.js +106 -90
  31. package/src/phaser/core/tween_data.js +30 -30
  32. package/src/phaser/core/tween_manager.js +32 -24
  33. package/src/phaser/core/world.js +4 -3
  34. package/src/phaser/display/bitmap_text.js +72 -54
  35. package/src/phaser/display/button.js +48 -47
  36. package/src/phaser/display/canvas/buffer.js +8 -8
  37. package/src/phaser/display/canvas/graphics.js +8 -8
  38. package/src/phaser/display/canvas/masker.js +5 -5
  39. package/src/phaser/display/canvas/pool.js +18 -18
  40. package/src/phaser/display/canvas/renderer.js +17 -16
  41. package/src/phaser/display/canvas/tinter.js +22 -22
  42. package/src/phaser/display/canvas/util.js +42 -42
  43. package/src/phaser/display/display_object.js +119 -108
  44. package/src/phaser/display/graphics.js +129 -112
  45. package/src/phaser/display/graphics_data.js +10 -10
  46. package/src/phaser/display/graphics_data_util.js +3 -3
  47. package/src/phaser/display/group.js +63 -50
  48. package/src/phaser/display/image.js +68 -50
  49. package/src/phaser/display/sprite_batch.js +2 -2
  50. package/src/phaser/display/sprite_util.js +19 -19
  51. package/src/phaser/display/text.js +217 -187
  52. package/src/phaser/display/webgl/abstract_filter.js +4 -4
  53. package/src/phaser/display/webgl/base_texture.js +9 -9
  54. package/src/phaser/display/webgl/blend_manager.js +7 -7
  55. package/src/phaser/display/webgl/earcut.js +95 -95
  56. package/src/phaser/display/webgl/earcut_node.js +4 -4
  57. package/src/phaser/display/webgl/fast_sprite_batch.js +15 -15
  58. package/src/phaser/display/webgl/filter_manager.js +9 -9
  59. package/src/phaser/display/webgl/filter_texture.js +10 -10
  60. package/src/phaser/display/webgl/graphics.js +37 -37
  61. package/src/phaser/display/webgl/graphics_data.js +4 -4
  62. package/src/phaser/display/webgl/mask_manager.js +6 -6
  63. package/src/phaser/display/webgl/render_texture.js +16 -16
  64. package/src/phaser/display/webgl/renderer.js +21 -20
  65. package/src/phaser/display/webgl/shader/complex.js +4 -4
  66. package/src/phaser/display/webgl/shader/fast.js +4 -4
  67. package/src/phaser/display/webgl/shader/normal.js +8 -8
  68. package/src/phaser/display/webgl/shader/primitive.js +4 -4
  69. package/src/phaser/display/webgl/shader/strip.js +4 -4
  70. package/src/phaser/display/webgl/shader_manager.js +9 -9
  71. package/src/phaser/display/webgl/sprite_batch.js +18 -18
  72. package/src/phaser/display/webgl/stencil_manager.js +16 -16
  73. package/src/phaser/display/webgl/texture.js +13 -13
  74. package/src/phaser/display/webgl/texture_util.js +8 -8
  75. package/src/phaser/display/webgl/util.js +25 -25
  76. package/src/phaser/geom/circle.js +74 -69
  77. package/src/phaser/geom/ellipse.js +33 -28
  78. package/src/phaser/geom/line.js +96 -93
  79. package/src/phaser/geom/matrix.js +61 -54
  80. package/src/phaser/geom/point.js +99 -96
  81. package/src/phaser/geom/polygon.js +27 -22
  82. package/src/phaser/geom/rectangle.js +137 -132
  83. package/src/phaser/geom/rounded_rectangle.js +12 -12
  84. package/src/phaser/geom/util/circle.js +33 -33
  85. package/src/phaser/geom/util/ellipse.js +5 -5
  86. package/src/phaser/geom/util/line.js +26 -26
  87. package/src/phaser/geom/util/matrix.js +8 -8
  88. package/src/phaser/geom/util/point.js +97 -97
  89. package/src/phaser/geom/util/polygon.js +4 -4
  90. package/src/phaser/geom/util/rectangle.js +74 -74
  91. package/src/phaser/geom/util/rounded_rectangle.js +4 -4
  92. package/src/phaser/util/math.js +81 -81
  93. package/types/phaser/core/animation.d.ts +79 -56
  94. package/types/phaser/core/animation.d.ts.map +1 -1
  95. package/types/phaser/core/animation_manager.d.ts +55 -55
  96. package/types/phaser/core/animation_parser.d.ts +3 -2
  97. package/types/phaser/core/animation_parser.d.ts.map +1 -1
  98. package/types/phaser/core/cache.d.ts +154 -154
  99. package/types/phaser/core/device.d.ts.map +1 -1
  100. package/types/phaser/core/dom.d.ts +51 -44
  101. package/types/phaser/core/dom.d.ts.map +1 -1
  102. package/types/phaser/core/event_manager.d.ts +63 -63
  103. package/types/phaser/core/factory.d.ts +47 -47
  104. package/types/phaser/core/frame.d.ts +30 -30
  105. package/types/phaser/core/frame_data.d.ts +28 -27
  106. package/types/phaser/core/frame_data.d.ts.map +1 -1
  107. package/types/phaser/core/game.d.ts +54 -21
  108. package/types/phaser/core/game.d.ts.map +1 -1
  109. package/types/phaser/core/input_pointer.d.ts +18 -0
  110. package/types/phaser/core/input_pointer.d.ts.map +1 -1
  111. package/types/phaser/core/loader.d.ts +175 -172
  112. package/types/phaser/core/loader.d.ts.map +1 -1
  113. package/types/phaser/core/loader_parser.d.ts.map +1 -1
  114. package/types/phaser/core/raf.d.ts +1 -1
  115. package/types/phaser/core/scale_manager.d.ts +6 -5
  116. package/types/phaser/core/scale_manager.d.ts.map +1 -1
  117. package/types/phaser/core/scene.d.ts +15 -9
  118. package/types/phaser/core/scene.d.ts.map +1 -1
  119. package/types/phaser/core/scene_manager.d.ts +51 -43
  120. package/types/phaser/core/scene_manager.d.ts.map +1 -1
  121. package/types/phaser/core/signal.d.ts +54 -51
  122. package/types/phaser/core/signal.d.ts.map +1 -1
  123. package/types/phaser/core/sound.d.ts +54 -54
  124. package/types/phaser/core/sound_manager.d.ts +49 -49
  125. package/types/phaser/core/stage.d.ts +10 -10
  126. package/types/phaser/core/time.d.ts +54 -30
  127. package/types/phaser/core/time.d.ts.map +1 -1
  128. package/types/phaser/core/timer.d.ts +82 -64
  129. package/types/phaser/core/timer.d.ts.map +1 -1
  130. package/types/phaser/core/timer_event.d.ts +9 -9
  131. package/types/phaser/core/tween.d.ts +106 -90
  132. package/types/phaser/core/tween.d.ts.map +1 -1
  133. package/types/phaser/core/tween_data.d.ts +30 -30
  134. package/types/phaser/core/tween_manager.d.ts +35 -67
  135. package/types/phaser/core/tween_manager.d.ts.map +1 -1
  136. package/types/phaser/core/world.d.ts +4 -3
  137. package/types/phaser/core/world.d.ts.map +1 -1
  138. package/types/phaser/display/bitmap_text.d.ts +76 -53
  139. package/types/phaser/display/bitmap_text.d.ts.map +1 -1
  140. package/types/phaser/display/button.d.ts +47 -46
  141. package/types/phaser/display/button.d.ts.map +1 -1
  142. package/types/phaser/display/canvas/buffer.d.ts +8 -8
  143. package/types/phaser/display/canvas/graphics.d.ts +3 -3
  144. package/types/phaser/display/canvas/graphics.d.ts.map +1 -1
  145. package/types/phaser/display/canvas/pool.d.ts +6 -3
  146. package/types/phaser/display/canvas/pool.d.ts.map +1 -1
  147. package/types/phaser/display/canvas/renderer.d.ts +18 -17
  148. package/types/phaser/display/canvas/renderer.d.ts.map +1 -1
  149. package/types/phaser/display/canvas/util.d.ts +6 -6
  150. package/types/phaser/display/canvas/util.d.ts.map +1 -1
  151. package/types/phaser/display/display_object.d.ts +119 -108
  152. package/types/phaser/display/display_object.d.ts.map +1 -1
  153. package/types/phaser/display/graphics.d.ts +118 -102
  154. package/types/phaser/display/graphics.d.ts.map +1 -1
  155. package/types/phaser/display/graphics_data.d.ts +10 -10
  156. package/types/phaser/display/group.d.ts +59 -47
  157. package/types/phaser/display/group.d.ts.map +1 -1
  158. package/types/phaser/display/image.d.ts +58 -45
  159. package/types/phaser/display/image.d.ts.map +1 -1
  160. package/types/phaser/display/text.d.ts +237 -188
  161. package/types/phaser/display/text.d.ts.map +1 -1
  162. package/types/phaser/display/webgl/abstract_filter.d.ts +4 -4
  163. package/types/phaser/display/webgl/base_texture.d.ts +10 -10
  164. package/types/phaser/display/webgl/base_texture.d.ts.map +1 -1
  165. package/types/phaser/display/webgl/blend_manager.d.ts +6 -6
  166. package/types/phaser/display/webgl/earcut.d.ts +95 -95
  167. package/types/phaser/display/webgl/earcut_node.d.ts +4 -4
  168. package/types/phaser/display/webgl/fast_sprite_batch.d.ts +15 -15
  169. package/types/phaser/display/webgl/filter_manager.d.ts +8 -8
  170. package/types/phaser/display/webgl/filter_texture.d.ts +10 -10
  171. package/types/phaser/display/webgl/graphics.d.ts +2 -2
  172. package/types/phaser/display/webgl/graphics.d.ts.map +1 -1
  173. package/types/phaser/display/webgl/graphics_data.d.ts +4 -4
  174. package/types/phaser/display/webgl/render_texture.d.ts +16 -16
  175. package/types/phaser/display/webgl/renderer.d.ts +21 -20
  176. package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
  177. package/types/phaser/display/webgl/shader/complex.d.ts +4 -4
  178. package/types/phaser/display/webgl/shader/fast.d.ts +4 -4
  179. package/types/phaser/display/webgl/shader/normal.d.ts +8 -8
  180. package/types/phaser/display/webgl/shader/primitive.d.ts +4 -4
  181. package/types/phaser/display/webgl/shader/strip.d.ts +4 -4
  182. package/types/phaser/display/webgl/shader_manager.d.ts +8 -8
  183. package/types/phaser/display/webgl/sprite_batch.d.ts +17 -17
  184. package/types/phaser/display/webgl/stencil_manager.d.ts +15 -15
  185. package/types/phaser/display/webgl/texture.d.ts +12 -12
  186. package/types/phaser/display/webgl/texture_util.d.ts +4 -2
  187. package/types/phaser/display/webgl/texture_util.d.ts.map +1 -1
  188. package/types/phaser/geom/circle.d.ts +74 -69
  189. package/types/phaser/geom/circle.d.ts.map +1 -1
  190. package/types/phaser/geom/ellipse.d.ts +33 -28
  191. package/types/phaser/geom/ellipse.d.ts.map +1 -1
  192. package/types/phaser/geom/line.d.ts +96 -93
  193. package/types/phaser/geom/line.d.ts.map +1 -1
  194. package/types/phaser/geom/matrix.d.ts +61 -54
  195. package/types/phaser/geom/matrix.d.ts.map +1 -1
  196. package/types/phaser/geom/point.d.ts +99 -96
  197. package/types/phaser/geom/point.d.ts.map +1 -1
  198. package/types/phaser/geom/polygon.d.ts +29 -23
  199. package/types/phaser/geom/polygon.d.ts.map +1 -1
  200. package/types/phaser/geom/rectangle.d.ts +137 -132
  201. package/types/phaser/geom/rectangle.d.ts.map +1 -1
  202. package/types/phaser/geom/rounded_rectangle.d.ts +12 -12
  203. package/types/phaser/geom/util/point.d.ts +1 -1
  204. package/types/phaser/geom/util/point.d.ts.map +1 -1
  205. package/pnpm-workspace.yaml +0 -4
@@ -5,48 +5,64 @@ import { TweenData } from './tween_data.js';
5
5
 
6
6
  export class Tween {
7
7
  /**
8
- * TBD.
9
- * @param {import('../display/display_object.js').DisplayObject} target - TBD.
10
- * @param {import('./game.js').Game} game - TBD.
11
- * @param {import('./tween_manager.js').TweenManager} manager - TBD.
8
+ * Creates a new Tween instance.
9
+ * @param {import('../display/display_object.js').DisplayObject} target - The object to tween.
10
+ * @param {import('./game.js').Game} game - Reference to the Phaser Game instance.
11
+ * @param {import('./tween_manager.js').TweenManager} manager - Reference to the Tween Manager.
12
12
  */
13
13
  constructor(target, game, manager) {
14
14
  this.game = game;
15
15
  this.target = target;
16
+ /** @type {import('./tween_manager.js').TweenManager} */
16
17
  this.manager = manager;
17
18
  /** @type {TweenData[]} */
18
19
  this.timeline = [];
20
+ /** @type {boolean} */
19
21
  this.reverse = false;
22
+ /** @type {number} */
20
23
  this.timeScale = 1;
24
+ /** @type {number} */
21
25
  this.repeatCounter = 0;
26
+ /** @type {boolean} */
22
27
  this.pendingDelete = false;
28
+ /** @type {Signal} */
23
29
  this.onStart = new Signal();
30
+ /** @type {Signal} */
24
31
  this.onLoop = new Signal();
32
+ /** @type {Signal} */
25
33
  this.onRepeat = new Signal();
34
+ /** @type {Signal} */
26
35
  this.onChildComplete = new Signal();
36
+ /** @type {Signal} */
27
37
  this.onComplete = new Signal();
38
+ /** @type {boolean} */
28
39
  this.isRunning = false;
40
+ /** @type {number} */
29
41
  this.current = 0;
30
42
  this.properties = {};
31
43
  this.chainedTween = null;
44
+ /** @type {boolean} */
32
45
  this.isPaused = false;
33
46
  this._onUpdateCallback = null;
34
47
  this._onUpdateCallbackContext = null;
48
+ /** @type {number} */
35
49
  this._pausedTime = 0;
50
+ /** @type {boolean} */
36
51
  this._codePaused = false;
52
+ /** @type {boolean} */
37
53
  this._hasStarted = false;
38
54
  }
39
55
 
40
56
  /**
41
- * TBD.
42
- * @param {object} properties - TBD.
43
- * @param {number} duration - TBD.
44
- * @param {string | Function} ease - TBD.
45
- * @param {boolean} autoStart - TBD.
46
- * @param {number} delay - TBD.
47
- * @param {number} repeat - TBD.
48
- * @param {boolean} yoyo - TBD.
49
- * @returns {Tween} TBD.
57
+ * Adds a tween to the timeline that animates properties to their target values.
58
+ * @param {object} properties - The properties to tween and their target values.
59
+ * @param {number} duration - The duration of the tween in milliseconds.
60
+ * @param {string | Function} ease - The easing function to use.
61
+ * @param {boolean} autoStart - Whether to start the tween immediately.
62
+ * @param {number} delay - The delay before starting the tween in milliseconds.
63
+ * @param {number} repeat - Number of times to repeat the tween.
64
+ * @param {boolean} yoyo - Whether to reverse the tween on repeat.
65
+ * @returns {Tween} This Tween object for chaining.
50
66
  */
51
67
  to(properties, duration = 1000, ease = 'Linear', autoStart = false, delay = 0, repeat = 0, yoyo = false) {
52
68
  if (typeof ease === 'string' && this.manager.easeMap[ease]) {
@@ -64,15 +80,15 @@ export class Tween {
64
80
  }
65
81
 
66
82
  /**
67
- * TBD.
68
- * @param {object} properties - TBD.
69
- * @param {number} duration - TBD.
70
- * @param {string | Function} ease - TBD.
71
- * @param {boolean} autoStart - TBD.
72
- * @param {number} delay - TBD.
73
- * @param {number} repeat - TBD.
74
- * @param {boolean} yoyo - TBD.
75
- * @returns {Tween} TBD.
83
+ * Adds a tween to the timeline that animates properties from their current values.
84
+ * @param {object} properties - The properties to tween and their target values.
85
+ * @param {number} duration - The duration of the tween in milliseconds.
86
+ * @param {string | Function} ease - The easing function to use.
87
+ * @param {boolean} autoStart - Whether to start the tween immediately.
88
+ * @param {number} delay - The delay before starting the tween in milliseconds.
89
+ * @param {number} repeat - Number of times to repeat the tween.
90
+ * @param {boolean} yoyo - Whether to reverse the tween on repeat.
91
+ * @returns {Tween} This Tween object for chaining.
76
92
  */
77
93
  from(properties, duration = 1000, ease = 'Linear', autoStart = false, delay = 0, repeat = 0, yoyo = false) {
78
94
  if (typeof ease === 'string' && this.manager.easeMap[ease]) {
@@ -91,9 +107,9 @@ export class Tween {
91
107
  }
92
108
 
93
109
  /**
94
- * TBD.
95
- * @param {number} index - TBD.
96
- * @returns {Tween} TBD.
110
+ * Starts the tween timeline from a specific index.
111
+ * @param {number} index - The index to start from in the timeline.
112
+ * @returns {Tween} This Tween object for chaining.
97
113
  */
98
114
  start(index = 0) {
99
115
  if (this.game === null || this.target === null || this.timeline.length === 0 || this.isRunning) {
@@ -126,9 +142,9 @@ export class Tween {
126
142
  }
127
143
 
128
144
  /**
129
- * TBD.
130
- * @param {boolean} complete - TBD.
131
- * @returns {Tween} TBD.
145
+ * Stops the tween and optionally completes it.
146
+ * @param {boolean} complete - Whether to dispatch the complete event.
147
+ * @returns {Tween} This Tween object for chaining.
132
148
  */
133
149
  stop(complete = false) {
134
150
  this.isRunning = false;
@@ -146,11 +162,11 @@ export class Tween {
146
162
  }
147
163
 
148
164
  /**
149
- * TBD.
150
- * @param {string} property - TBD.
151
- * @param {object} value - TBD.
152
- * @param {number} index - TBD.
153
- * @returns {Tween} TBD.
165
+ * Updates a property in the tween data.
166
+ * @param {string} property - The property name to update.
167
+ * @param {object} value - The new value for the property.
168
+ * @param {number} index - The index in the timeline to update.
169
+ * @returns {Tween} This Tween object for chaining.
154
170
  */
155
171
  updateTweenData(property, value, index = 0) {
156
172
  if (this.timeline.length === 0) {
@@ -167,21 +183,21 @@ export class Tween {
167
183
  }
168
184
 
169
185
  /**
170
- * TBD.
171
- * @param {number} duration - TBD.
172
- * @param {number} index - TBD.
173
- * @returns {Tween} TBD.
186
+ * Sets a delay for a specific timeline entry.
187
+ * @param {number} duration - The delay in milliseconds.
188
+ * @param {number} index - The index in the timeline to apply the delay to.
189
+ * @returns {Tween} This Tween object for chaining.
174
190
  */
175
191
  delay(duration, index) {
176
192
  return this.updateTweenData('delay', duration, index);
177
193
  }
178
194
 
179
195
  /**
180
- * TBD.
181
- * @param {number} total - TBD.
182
- * @param {number} repeatDelay - TBD.
183
- * @param {number} index - TBD.
184
- * @returns {Tween} TBD.
196
+ * Sets how many times to repeat the tween.
197
+ * @param {number} total - The number of times to repeat (-1 for infinite).
198
+ * @param {number} repeatDelay - Delay between repeats in milliseconds.
199
+ * @param {number} index - The index in the timeline to apply the repeat to.
200
+ * @returns {Tween} This Tween object for chaining.
185
201
  */
186
202
  repeat(total, repeatDelay = 0, index = 0) {
187
203
  this.updateTweenData('repeatCounter', total, index);
@@ -189,21 +205,21 @@ export class Tween {
189
205
  }
190
206
 
191
207
  /**
192
- * TBD.
193
- * @param {number} duration - TBD.
194
- * @param {number} index - TBD.
195
- * @returns {Tween} TBD.
208
+ * Sets the repeat delay for a specific timeline entry.
209
+ * @param {number} duration - The delay between repeats in milliseconds.
210
+ * @param {number} index - The index in the timeline to apply the delay to.
211
+ * @returns {Tween} This Tween object for chaining.
196
212
  */
197
213
  repeatDelay(duration, index) {
198
214
  return this.updateTweenData('repeatDelay', duration, index);
199
215
  }
200
216
 
201
217
  /**
202
- * TBD.
203
- * @param {boolean} enable - TBD.
204
- * @param {number} yoyoDelay - TBD.
205
- * @param {number} index - TBD.
206
- * @returns {Tween} TBD.
218
+ * Enables or disables yoyo behavior for a timeline entry.
219
+ * @param {boolean} enable - Whether to enable yoyo behavior.
220
+ * @param {number} yoyoDelay - Delay between yoyo cycles in milliseconds.
221
+ * @param {number} index - The index in the timeline to apply yoyo to.
222
+ * @returns {Tween} This Tween object for chaining.
207
223
  */
208
224
  yoyo(enable, yoyoDelay = 0, index = 0) {
209
225
  this.updateTweenData('yoyo', enable, index);
@@ -211,20 +227,20 @@ export class Tween {
211
227
  }
212
228
 
213
229
  /**
214
- * TBD.
215
- * @param {number} duration - TBD.
216
- * @param {number} index - TBD.
217
- * @returns {Tween} TBD.
230
+ * Sets the yoyo delay for a specific timeline entry.
231
+ * @param {number} duration - The delay between yoyo cycles in milliseconds.
232
+ * @param {number} index - The index in the timeline to apply the delay to.
233
+ * @returns {Tween} This Tween object for chaining.
218
234
  */
219
235
  yoyoDelay(duration, index) {
220
236
  return this.updateTweenData('yoyoDelay', duration, index);
221
237
  }
222
238
 
223
239
  /**
224
- * TBD.
225
- * @param {string|Function} ease - TBD.
226
- * @param {number} index - TBD.
227
- * @returns {Tween} TBD.
240
+ * Sets the easing function for a timeline entry.
241
+ * @param {string|Function} ease - The easing function to use.
242
+ * @param {number} index - The index in the timeline to apply easing to.
243
+ * @returns {Tween} This Tween object for chaining.
228
244
  */
229
245
  easing(ease, index) {
230
246
  if (typeof ease === 'string' && this.manager.easeMap[ease]) {
@@ -234,11 +250,11 @@ export class Tween {
234
250
  }
235
251
 
236
252
  /**
237
- * TBD.
238
- * @param {Function} interpolation - TBD.
239
- * @param {object} context - TBD.
240
- * @param {number} index - TBD.
241
- * @returns {Tween} TBD.
253
+ * Sets the interpolation function for a timeline entry.
254
+ * @param {Function} interpolation - The interpolation function to use.
255
+ * @param {object} context - The context in which to call the interpolation function.
256
+ * @param {number} index - The index in the timeline to apply interpolation to.
257
+ * @returns {Tween} This Tween object for chaining.
242
258
  */
243
259
  interpolation(interpolation, context = MathUtils, index = 0) {
244
260
  this.updateTweenData('interpolationFunction', interpolation, index);
@@ -246,9 +262,9 @@ export class Tween {
246
262
  }
247
263
 
248
264
  /**
249
- * TBD.
250
- * @param {number} total - TBD.
251
- * @returns {Tween} TBD.
265
+ * Sets how many times to repeat all timeline entries.
266
+ * @param {number} total - The number of times to repeat (-1 for infinite).
267
+ * @returns {Tween} This Tween object for chaining.
252
268
  */
253
269
  repeatAll(total = 0) {
254
270
  this.repeatCounter = total;
@@ -256,9 +272,9 @@ export class Tween {
256
272
  }
257
273
 
258
274
  /**
259
- * TBD.
260
- * @param {...any} args - TBD.
261
- * @returns {Tween} TBD.
275
+ * Chains one or more tweens to this tween.
276
+ * @param {...any} args - The tweens to chain.
277
+ * @returns {Tween} This Tween object for chaining.
262
278
  */
263
279
  chain(...args) {
264
280
  let i = args.length;
@@ -274,9 +290,9 @@ export class Tween {
274
290
  }
275
291
 
276
292
  /**
277
- * TBD.
278
- * @param {boolean} value - TBD.
279
- * @returns {Tween} TBD.
293
+ * Sets whether the tween should loop infinitely.
294
+ * @param {boolean} value - Whether to loop infinitely.
295
+ * @returns {Tween} This Tween object for chaining.
280
296
  */
281
297
  loop(value = true) {
282
298
  this.repeatCounter = value ? -1 : 0;
@@ -284,10 +300,10 @@ export class Tween {
284
300
  }
285
301
 
286
302
  /**
287
- * TBD.
288
- * @param {Function} callback - TBD.
289
- * @param {object} callbackContext - TBD.
290
- * @returns {Tween} TBD.
303
+ * Sets a callback to be called when the tween updates.
304
+ * @param {Function} callback - The callback function to call.
305
+ * @param {object} callbackContext - The context in which to call the callback.
306
+ * @returns {Tween} This Tween object for chaining.
291
307
  */
292
308
  onUpdateCallback(callback, callbackContext) {
293
309
  this._onUpdateCallback = callback;
@@ -296,7 +312,7 @@ export class Tween {
296
312
  }
297
313
 
298
314
  /**
299
- * TBD.
315
+ * Pauses the tween.
300
316
  */
301
317
  pause() {
302
318
  this.isPaused = true;
@@ -305,7 +321,7 @@ export class Tween {
305
321
  }
306
322
 
307
323
  /**
308
- * TBD.
324
+ * Internal method to pause the tween.
309
325
  */
310
326
  _pause() {
311
327
  if (!this._codePaused) {
@@ -315,7 +331,7 @@ export class Tween {
315
331
  }
316
332
 
317
333
  /**
318
- * TBD.
334
+ * Resumes the tween.
319
335
  */
320
336
  resume() {
321
337
  if (this.isPaused) {
@@ -330,7 +346,7 @@ export class Tween {
330
346
  }
331
347
 
332
348
  /**
333
- * TBD.
349
+ * Internal method to resume the tween.
334
350
  */
335
351
  _resume() {
336
352
  if (!this._codePaused) {
@@ -339,9 +355,9 @@ export class Tween {
339
355
  }
340
356
 
341
357
  /**
342
- * TBD.
343
- * @param {number} time - TBD.
344
- * @returns {boolean} TBD.
358
+ * Updates the tween state at a given time.
359
+ * @param {number} time - The current game time.
360
+ * @returns {boolean} True if the tween should continue running, false if it's complete.
345
361
  */
346
362
  update(time) {
347
363
  if (this.pendingDelete || !this.target) {
@@ -422,10 +438,10 @@ export class Tween {
422
438
  }
423
439
 
424
440
  /**
425
- * TBD.
426
- * @param {number} frameRate - TBD.
427
- * @param {object[]} data - TBD.
428
- * @returns {object[]} TBD.
441
+ * Generates animation data for a given frame rate.
442
+ * @param {number} frameRate - The target frame rate.
443
+ * @param {object[]} data - The array to store the generated data in.
444
+ * @returns {object[]} The populated data array.
429
445
  */
430
446
  generateData(frameRate = 60, data = []) {
431
447
  if (this.game === null || this.target === null) {
@@ -454,8 +470,8 @@ export class Tween {
454
470
  }
455
471
 
456
472
  /**
457
- * TBD.
458
- * @returns {number} TBD.
473
+ * Gets the total duration of all timeline entries.
474
+ * @returns {number} The total duration in milliseconds.
459
475
  */
460
476
  get totalDuration() {
461
477
  let total = 0;
@@ -3,8 +3,8 @@ import { TWEEN_COMPLETE, TWEEN_LOOPED, TWEEN_PENDING, TWEEN_RUNNING } from './co
3
3
 
4
4
  export class TweenData {
5
5
  /**
6
- * TBD.
7
- * @param {import('./tween.js').Tween} parent - TBD.
6
+ * Creates a new TweenData instance.
7
+ * @param {import('./tween.js').Tween} parent - The parent Tween instance.
8
8
  */
9
9
  constructor(parent) {
10
10
  this.parent = parent;
@@ -34,14 +34,14 @@ export class TweenData {
34
34
  }
35
35
 
36
36
  /**
37
- * TBD.
38
- * @param {object} properties - TBD.
39
- * @param {number} duration - TBD.
40
- * @param {(number) => number} ease - TBD.
41
- * @param {number} delay - TBD.
42
- * @param {number} repeat - TBD.
43
- * @param {boolean} yoyo - TBD.
44
- * @returns {TweenData} TBD.
37
+ * Sets the target properties to tween to.
38
+ * @param {object} properties - The properties to tween to.
39
+ * @param {number} duration - The duration of the tween in milliseconds.
40
+ * @param {(number) => number} ease - The easing function to use.
41
+ * @param {number} delay - The delay before starting the tween in milliseconds.
42
+ * @param {number} repeat - The number of times to repeat the tween (0 = no repeat, -1 = infinite).
43
+ * @param {boolean} yoyo - Whether to reverse the tween on each repeat.
44
+ * @returns {TweenData} This TweenData object for chaining.
45
45
  */
46
46
  to(properties, duration, ease, delay, repeat, yoyo) {
47
47
  this.vEnd = properties;
@@ -55,14 +55,14 @@ export class TweenData {
55
55
  }
56
56
 
57
57
  /**
58
- * TBD.
59
- * @param {object} properties - TBD.
60
- * @param {number} duration - TBD.
61
- * @param {(number) => number} ease - TBD.
62
- * @param {number} delay - TBD.
63
- * @param {number} repeat - TBD.
64
- * @param {boolean} yoyo - TBD.
65
- * @returns {TweenData} TBD.
58
+ * Sets the target properties to tween from (in reverse).
59
+ * @param {object} properties - The properties to tween from.
60
+ * @param {number} duration - The duration of the tween in milliseconds.
61
+ * @param {(number) => number} ease - The easing function to use.
62
+ * @param {number} delay - The delay before starting the tween in milliseconds.
63
+ * @param {number} repeat - The number of times to repeat the tween (0 = no repeat, -1 = infinite).
64
+ * @param {boolean} yoyo - Whether to reverse the tween on each repeat.
65
+ * @returns {TweenData} This TweenData object for chaining.
66
66
  */
67
67
  from(properties, duration, ease, delay, repeat, yoyo) {
68
68
  this.vEnd = properties;
@@ -76,8 +76,8 @@ export class TweenData {
76
76
  }
77
77
 
78
78
  /**
79
- * TBD.
80
- * @returns {TweenData} TBD.
79
+ * Starts the tween.
80
+ * @returns {TweenData} This TweenData object for chaining.
81
81
  */
82
82
  start() {
83
83
  this.startTime = this.game.time.time + this.delay;
@@ -108,8 +108,8 @@ export class TweenData {
108
108
  }
109
109
 
110
110
  /**
111
- * TBD.
112
- * @returns {TweenData} TBD.
111
+ * Loads the tween values from the parent object.
112
+ * @returns {TweenData} This TweenData object for chaining.
113
113
  */
114
114
  loadValues() {
115
115
  const keys = Object.keys(this.parent.properties);
@@ -145,9 +145,9 @@ export class TweenData {
145
145
  }
146
146
 
147
147
  /**
148
- * TBD.
149
- * @param {number} time - TBD.
150
- * @returns {number} TBD.
148
+ * Updates the tween at a given time.
149
+ * @param {number} time - The current time in milliseconds.
150
+ * @returns {number} The tween status (TWEEN_PENDING, TWEEN_RUNNING, or TWEEN_COMPLETE).
151
151
  */
152
152
  update(time) {
153
153
  if (!this.isRunning) {
@@ -188,9 +188,9 @@ export class TweenData {
188
188
  }
189
189
 
190
190
  /**
191
- * TBD.
192
- * @param {number} frameRate - TBD.
193
- * @returns {object[]} TBD.
191
+ * Generates an array of tween data points for a given frame rate.
192
+ * @param {number} frameRate - The frame rate to generate data for.
193
+ * @returns {object[]} An array of tween data points.
194
194
  */
195
195
  generateData(frameRate) {
196
196
  if (this.parent.reverse) {
@@ -237,8 +237,8 @@ export class TweenData {
237
237
  }
238
238
 
239
239
  /**
240
- * TBD.
241
- * @returns {number} TBD.
240
+ * Handles tween repetition logic.
241
+ * @returns {number} The tween status (TWEEN_LOOPED or TWEEN_COMPLETE).
242
242
  */
243
243
  repeat() {
244
244
  // If not a yoyo and repeatCounter = 0 then we're done
@@ -36,13 +36,16 @@ import {
36
36
 
37
37
  export class TweenManager {
38
38
  /**
39
- * TBD.
40
- * @param {import('./game.js').Game} game - TBD.
39
+ * Creates a new TweenManager instance.
40
+ * @param {import('./game.js').Game} game - The game instance this manager belongs to.
41
41
  */
42
42
  constructor(game) {
43
43
  this.game = game;
44
+ /** @type {Tween[]} */
44
45
  this._tweens = [];
46
+ /** @type {Tween[]} */
45
47
  this._add = [];
48
+ /** @type {{[key: string]: (k: number) => number}} */
46
49
  this.easeMap = {
47
50
  Linear: LinearNone,
48
51
  Quad: QuadraticOut,
@@ -92,15 +95,16 @@ export class TweenManager {
92
95
  }
93
96
 
94
97
  /**
95
- * TBD.
96
- * @returns {Tween[]} TBD.
98
+ * Get all tweens managed by this manager.
99
+ * @returns {Tween[]} An array of all active tweens.
97
100
  */
98
101
  getAll() {
99
102
  return this._tweens;
100
103
  }
101
104
 
102
105
  /**
103
- * TBD.
106
+ * Remove all tweens from the manager.
107
+ * This method removes all active and pending tweens.
104
108
  */
105
109
  removeAll() {
106
110
  for (let i = 0; i < this._tweens.length; i += 1) {
@@ -110,9 +114,9 @@ export class TweenManager {
110
114
  }
111
115
 
112
116
  /**
113
- * TBD.
114
- * @param {object} obj - TBD.
115
- * @param {object[]} children - TBD.
117
+ * Remove tweens associated with an object or its children.
118
+ * @param {object} obj - The object to remove tweens from.
119
+ * @param {object[]} children - Optional array of child objects to remove tweens from.
116
120
  */
117
121
  removeFrom(obj, children = null) {
118
122
  let i;
@@ -140,8 +144,8 @@ export class TweenManager {
140
144
  }
141
145
 
142
146
  /**
143
- * TBD.
144
- * @param {Tween} tween - TBD.
147
+ * Add a tween to the manager.
148
+ * @param {Tween} tween - The tween to add.
145
149
  */
146
150
  add(tween) {
147
151
  tween.manager = this;
@@ -149,17 +153,17 @@ export class TweenManager {
149
153
  }
150
154
 
151
155
  /**
152
- * TBD.
153
- * @param {object} object - TBD.
154
- * @returns {Tween} TBD.
156
+ * Create a new tween for an object.
157
+ * @param {object} object - The object to create a tween for.
158
+ * @returns {Tween} The created Tween object.
155
159
  */
156
160
  create(object) {
157
161
  return new Tween(object, this.game, this);
158
162
  }
159
163
 
160
164
  /**
161
- * TBD.
162
- * @param {Tween | null | undefined} tween - TBD.
165
+ * Remove a tween from the manager.
166
+ * @param {Tween | null | undefined} tween - The tween to remove.
163
167
  */
164
168
  remove(tween) {
165
169
  let i = this._tweens.indexOf(tween);
@@ -174,8 +178,8 @@ export class TweenManager {
174
178
  }
175
179
 
176
180
  /**
177
- * TBD.
178
- * @returns {boolean} TBD.
181
+ * Update all tweens managed by this manager.
182
+ * @returns {boolean} True if any tweens were updated, false otherwise.
179
183
  */
180
184
  update() {
181
185
  const addTweens = this._add.length;
@@ -201,16 +205,17 @@ export class TweenManager {
201
205
  }
202
206
 
203
207
  /**
204
- * TBD.
205
- * @param {object} object - TBD.
206
- * @returns {boolean} TBD.
208
+ * Check if an object is currently being tweened.
209
+ * @param {object} object - The object to check.
210
+ * @returns {boolean} True if the object is being tweened, false otherwise.
207
211
  */
208
212
  isTweening(object) {
209
213
  return this._tweens.some((tween) => tween.target === object);
210
214
  }
211
215
 
212
216
  /**
213
- * TBD.
217
+ * Pause all tweens managed by this manager.
218
+ * This method pauses all active tweens.
214
219
  */
215
220
  _pauseAll() {
216
221
  for (let i = this._tweens.length - 1; i >= 0; i -= 1) {
@@ -219,7 +224,8 @@ export class TweenManager {
219
224
  }
220
225
 
221
226
  /**
222
- * TBD.
227
+ * Resume all tweens managed by this manager.
228
+ * This method resumes all paused tweens.
223
229
  */
224
230
  _resumeAll() {
225
231
  for (let i = this._tweens.length - 1; i >= 0; i -= 1) {
@@ -228,7 +234,8 @@ export class TweenManager {
228
234
  }
229
235
 
230
236
  /**
231
- * TBD.
237
+ * Pause all tweens managed by this manager.
238
+ * This method pauses all active tweens.
232
239
  */
233
240
  pauseAll() {
234
241
  for (let i = this._tweens.length - 1; i >= 0; i -= 1) {
@@ -237,7 +244,8 @@ export class TweenManager {
237
244
  }
238
245
 
239
246
  /**
240
- * TBD.
247
+ * Resume all tweens managed by this manager.
248
+ * This method resumes all paused tweens.
241
249
  */
242
250
  resumeAll() {
243
251
  for (let i = this._tweens.length - 1; i >= 0; i -= 1) {
@@ -2,15 +2,16 @@ import { Group } from '../display/group.js';
2
2
 
3
3
  export class World extends Group {
4
4
  /**
5
- * TBD.
6
- * @param {import('./game.js').Game} game - TBD.
5
+ * Creates a new World instance.
6
+ * @param {import('./game.js').Game} game - The game instance this world belongs to.
7
7
  */
8
8
  constructor(game) {
9
9
  super(game, null, '__world', false);
10
10
  }
11
11
 
12
12
  /**
13
- * TBD.
13
+ * Initialize the world.
14
+ * This method is called when the game boots and sets up the world.
14
15
  */
15
16
  boot() {
16
17
  this.game.stage.addChild(this);