@vpmedia/phaser 1.15.0 → 1.17.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 (290) hide show
  1. package/README.md +3 -3
  2. package/package.json +6 -5
  3. package/src/index.js +15 -18
  4. package/src/phaser/core/animation.js +114 -6
  5. package/src/phaser/core/animation_manager.js +102 -10
  6. package/src/phaser/core/animation_parser.js +6 -19
  7. package/src/phaser/core/array_set.js +59 -5
  8. package/src/phaser/core/cache.js +307 -6
  9. package/src/phaser/core/const.js +107 -4
  10. package/src/phaser/core/device.js +3 -6
  11. package/src/phaser/core/device_util.js +3 -16
  12. package/src/phaser/core/dom.js +127 -29
  13. package/src/phaser/core/event_manager.js +128 -6
  14. package/src/phaser/core/factory.js +69 -34
  15. package/src/phaser/core/frame.js +43 -6
  16. package/src/phaser/core/frame_data.js +55 -5
  17. package/src/phaser/core/frame_util.js +7 -12
  18. package/src/phaser/core/game.js +35 -7
  19. package/src/phaser/core/input.js +133 -17
  20. package/src/phaser/core/input_handler.js +243 -43
  21. package/src/phaser/core/input_mouse.js +70 -5
  22. package/src/phaser/core/input_mspointer.js +40 -9
  23. package/src/phaser/core/input_pointer.js +88 -17
  24. package/src/phaser/core/input_touch.js +42 -5
  25. package/src/phaser/core/loader.js +303 -101
  26. package/src/phaser/core/loader_parser.js +2 -10
  27. package/src/phaser/core/raf.js +16 -5
  28. package/src/phaser/core/scale_manager.js +204 -39
  29. package/src/phaser/core/scene.js +24 -5
  30. package/src/phaser/core/scene_manager.js +81 -11
  31. package/src/phaser/core/signal.js +88 -11
  32. package/src/phaser/core/signal_binding.js +35 -15
  33. package/src/phaser/core/sound.js +99 -10
  34. package/src/phaser/core/sound_manager.js +89 -13
  35. package/src/phaser/core/sound_sprite.js +20 -5
  36. package/src/phaser/core/stage.js +43 -7
  37. package/src/phaser/core/time.js +67 -5
  38. package/src/phaser/core/timer.js +107 -30
  39. package/src/phaser/core/timer_event.js +11 -6
  40. package/src/phaser/core/tween.js +124 -30
  41. package/src/phaser/core/tween_data.js +42 -18
  42. package/src/phaser/core/tween_easing.js +1 -8
  43. package/src/phaser/core/tween_manager.js +47 -5
  44. package/src/phaser/core/world.js +9 -6
  45. package/src/phaser/display/bitmap_text.js +91 -10
  46. package/src/phaser/display/button.js +63 -12
  47. package/src/phaser/display/canvas/buffer.js +16 -6
  48. package/src/phaser/display/canvas/graphics.js +1 -13
  49. package/src/phaser/display/canvas/masker.js +0 -6
  50. package/src/phaser/display/canvas/pool.js +0 -7
  51. package/src/phaser/display/canvas/renderer.js +28 -8
  52. package/src/phaser/display/canvas/tinter.js +4 -43
  53. package/src/phaser/display/canvas/util.js +0 -6
  54. package/src/phaser/display/display_object.js +192 -20
  55. package/src/phaser/display/graphics.js +161 -26
  56. package/src/phaser/display/graphics_data.js +14 -6
  57. package/src/phaser/display/graphics_data_util.js +2 -8
  58. package/src/phaser/display/group.js +82 -9
  59. package/src/phaser/display/image.js +87 -9
  60. package/src/phaser/display/sprite_batch.js +3 -8
  61. package/src/phaser/display/sprite_util.js +3 -23
  62. package/src/phaser/display/text.js +331 -31
  63. package/src/phaser/display/webgl/abstract_filter.js +8 -7
  64. package/src/phaser/display/webgl/base_texture.js +20 -12
  65. package/src/phaser/display/webgl/blend_manager.js +14 -7
  66. package/src/phaser/display/webgl/earcut.js +4 -23
  67. package/src/phaser/display/webgl/earcut_node.js +6 -7
  68. package/src/phaser/display/webgl/fast_sprite_batch.js +34 -11
  69. package/src/phaser/display/webgl/filter_manager.js +25 -7
  70. package/src/phaser/display/webgl/filter_texture.js +21 -22
  71. package/src/phaser/display/webgl/graphics.js +5 -28
  72. package/src/phaser/display/webgl/graphics_data.js +10 -7
  73. package/src/phaser/display/webgl/mask_manager.js +0 -6
  74. package/src/phaser/display/webgl/render_texture.js +33 -21
  75. package/src/phaser/display/webgl/renderer.js +38 -11
  76. package/src/phaser/display/webgl/shader/complex.js +10 -6
  77. package/src/phaser/display/webgl/shader/fast.js +10 -6
  78. package/src/phaser/display/webgl/shader/normal.js +23 -32
  79. package/src/phaser/display/webgl/shader/primitive.js +10 -6
  80. package/src/phaser/display/webgl/shader/strip.js +10 -6
  81. package/src/phaser/display/webgl/shader_manager.js +18 -6
  82. package/src/phaser/display/webgl/sprite_batch.js +41 -8
  83. package/src/phaser/display/webgl/stencil_manager.js +28 -6
  84. package/src/phaser/display/webgl/texture.js +28 -15
  85. package/src/phaser/display/webgl/texture_util.js +0 -6
  86. package/src/phaser/display/webgl/util.js +0 -7
  87. package/src/phaser/geom/circle.js +123 -18
  88. package/src/phaser/geom/ellipse.js +39 -18
  89. package/src/phaser/geom/line.js +148 -16
  90. package/src/phaser/geom/matrix.js +73 -6
  91. package/src/phaser/geom/point.js +152 -6
  92. package/src/phaser/geom/polygon.js +42 -14
  93. package/src/phaser/geom/rectangle.js +233 -6
  94. package/src/phaser/geom/rounded_rectangle.js +10 -6
  95. package/src/phaser/geom/util/circle.js +3 -9
  96. package/src/phaser/geom/util/ellipse.js +0 -7
  97. package/src/phaser/geom/util/line.js +5 -14
  98. package/src/phaser/geom/util/matrix.js +1 -7
  99. package/src/phaser/geom/util/point.js +0 -6
  100. package/src/phaser/geom/util/polygon.js +1 -7
  101. package/src/phaser/geom/util/rectangle.js +1 -7
  102. package/src/phaser/geom/util/rounded_rectangle.js +1 -7
  103. package/src/phaser/util/math.js +3 -21
  104. package/types/index.d.ts +2 -1
  105. package/types/index.d.ts.map +1 -1
  106. package/types/phaser/core/animation.d.ts +126 -13
  107. package/types/phaser/core/animation.d.ts.map +1 -1
  108. package/types/phaser/core/animation_manager.d.ts +121 -19
  109. package/types/phaser/core/animation_manager.d.ts.map +1 -1
  110. package/types/phaser/core/animation_parser.d.ts +6 -5
  111. package/types/phaser/core/animation_parser.d.ts.map +1 -1
  112. package/types/phaser/core/array_set.d.ts +67 -13
  113. package/types/phaser/core/array_set.d.ts.map +1 -1
  114. package/types/phaser/core/cache.d.ts +365 -69
  115. package/types/phaser/core/cache.d.ts.map +1 -1
  116. package/types/phaser/core/const.d.ts +143 -40
  117. package/types/phaser/core/const.d.ts.map +1 -1
  118. package/types/phaser/core/device.d.ts +0 -5
  119. package/types/phaser/core/device.d.ts.map +1 -1
  120. package/types/phaser/core/device_util.d.ts +1 -1
  121. package/types/phaser/core/device_util.d.ts.map +1 -1
  122. package/types/phaser/core/dom.d.ts +119 -0
  123. package/types/phaser/core/dom.d.ts.map +1 -1
  124. package/types/phaser/core/event_manager.d.ts +127 -0
  125. package/types/phaser/core/event_manager.d.ts.map +1 -1
  126. package/types/phaser/core/factory.d.ts +75 -8
  127. package/types/phaser/core/factory.d.ts.map +1 -1
  128. package/types/phaser/core/frame.d.ts +64 -21
  129. package/types/phaser/core/frame.d.ts.map +1 -1
  130. package/types/phaser/core/frame_data.d.ts +61 -9
  131. package/types/phaser/core/frame_data.d.ts.map +1 -1
  132. package/types/phaser/core/frame_util.d.ts +10 -8
  133. package/types/phaser/core/frame_util.d.ts.map +1 -1
  134. package/types/phaser/core/game.d.ts +40 -6
  135. package/types/phaser/core/game.d.ts.map +1 -1
  136. package/types/phaser/core/input.d.ts +143 -15
  137. package/types/phaser/core/input.d.ts.map +1 -1
  138. package/types/phaser/core/input_handler.d.ts +258 -25
  139. package/types/phaser/core/input_handler.d.ts.map +1 -1
  140. package/types/phaser/core/input_mouse.d.ts +62 -14
  141. package/types/phaser/core/input_mouse.d.ts.map +1 -1
  142. package/types/phaser/core/input_mspointer.d.ts +51 -17
  143. package/types/phaser/core/input_mspointer.d.ts.map +1 -1
  144. package/types/phaser/core/input_pointer.d.ts +99 -14
  145. package/types/phaser/core/input_pointer.d.ts.map +1 -1
  146. package/types/phaser/core/input_touch.d.ts +53 -16
  147. package/types/phaser/core/input_touch.d.ts.map +1 -1
  148. package/types/phaser/core/loader.d.ts +299 -28
  149. package/types/phaser/core/loader.d.ts.map +1 -1
  150. package/types/phaser/core/loader_parser.d.ts.map +1 -1
  151. package/types/phaser/core/raf.d.ts +19 -9
  152. package/types/phaser/core/raf.d.ts.map +1 -1
  153. package/types/phaser/core/scale_manager.d.ts +208 -13
  154. package/types/phaser/core/scale_manager.d.ts.map +1 -1
  155. package/types/phaser/core/scene.d.ts +21 -5
  156. package/types/phaser/core/scene.d.ts.map +1 -1
  157. package/types/phaser/core/scene_manager.d.ts +90 -10
  158. package/types/phaser/core/scene_manager.d.ts.map +1 -1
  159. package/types/phaser/core/signal.d.ts +93 -9
  160. package/types/phaser/core/signal.d.ts.map +1 -1
  161. package/types/phaser/core/signal_binding.d.ts +34 -5
  162. package/types/phaser/core/signal_binding.d.ts.map +1 -1
  163. package/types/phaser/core/sound.d.ts +111 -14
  164. package/types/phaser/core/sound.d.ts.map +1 -1
  165. package/types/phaser/core/sound_manager.d.ts +97 -11
  166. package/types/phaser/core/sound_manager.d.ts.map +1 -1
  167. package/types/phaser/core/sound_sprite.d.ts +22 -8
  168. package/types/phaser/core/sound_sprite.d.ts.map +1 -1
  169. package/types/phaser/core/stage.d.ts +32 -3
  170. package/types/phaser/core/stage.d.ts.map +1 -1
  171. package/types/phaser/core/time.d.ts +73 -6
  172. package/types/phaser/core/time.d.ts.map +1 -1
  173. package/types/phaser/core/timer.d.ts +108 -7
  174. package/types/phaser/core/timer.d.ts.map +1 -1
  175. package/types/phaser/core/timer_event.d.ts +13 -7
  176. package/types/phaser/core/timer_event.d.ts.map +1 -1
  177. package/types/phaser/core/tween.d.ts +124 -4
  178. package/types/phaser/core/tween.d.ts.map +1 -1
  179. package/types/phaser/core/tween_data.d.ts +41 -2
  180. package/types/phaser/core/tween_data.d.ts.map +1 -1
  181. package/types/phaser/core/tween_easing.d.ts +0 -5
  182. package/types/phaser/core/tween_easing.d.ts.map +1 -1
  183. package/types/phaser/core/tween_manager.d.ts +49 -2
  184. package/types/phaser/core/tween_manager.d.ts.map +1 -1
  185. package/types/phaser/core/world.d.ts +9 -1
  186. package/types/phaser/core/world.d.ts.map +1 -1
  187. package/types/phaser/display/bitmap_text.d.ts +84 -7
  188. package/types/phaser/display/bitmap_text.d.ts.map +1 -1
  189. package/types/phaser/display/button.d.ts +65 -8
  190. package/types/phaser/display/button.d.ts.map +1 -1
  191. package/types/phaser/display/canvas/buffer.d.ts +20 -4
  192. package/types/phaser/display/canvas/buffer.d.ts.map +1 -1
  193. package/types/phaser/display/canvas/graphics.d.ts.map +1 -1
  194. package/types/phaser/display/canvas/masker.d.ts.map +1 -1
  195. package/types/phaser/display/canvas/pool.d.ts +0 -6
  196. package/types/phaser/display/canvas/pool.d.ts.map +1 -1
  197. package/types/phaser/display/canvas/renderer.d.ts +29 -2
  198. package/types/phaser/display/canvas/renderer.d.ts.map +1 -1
  199. package/types/phaser/display/canvas/tinter.d.ts.map +1 -1
  200. package/types/phaser/display/canvas/util.d.ts.map +1 -1
  201. package/types/phaser/display/display_object.d.ts +195 -8
  202. package/types/phaser/display/display_object.d.ts.map +1 -1
  203. package/types/phaser/display/graphics.d.ts +132 -6
  204. package/types/phaser/display/graphics.d.ts.map +1 -1
  205. package/types/phaser/display/graphics_data.d.ts +15 -1
  206. package/types/phaser/display/graphics_data.d.ts.map +1 -1
  207. package/types/phaser/display/graphics_data_util.d.ts +3 -2
  208. package/types/phaser/display/graphics_data_util.d.ts.map +1 -1
  209. package/types/phaser/display/group.d.ts +80 -10
  210. package/types/phaser/display/group.d.ts.map +1 -1
  211. package/types/phaser/display/image.d.ts +72 -6
  212. package/types/phaser/display/image.d.ts.map +1 -1
  213. package/types/phaser/display/sprite_batch.d.ts +4 -3
  214. package/types/phaser/display/sprite_batch.d.ts.map +1 -1
  215. package/types/phaser/display/sprite_util.d.ts.map +1 -1
  216. package/types/phaser/display/text.d.ts +366 -46
  217. package/types/phaser/display/text.d.ts.map +1 -1
  218. package/types/phaser/display/webgl/abstract_filter.d.ts +8 -6
  219. package/types/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
  220. package/types/phaser/display/webgl/base_texture.d.ts +20 -1
  221. package/types/phaser/display/webgl/base_texture.d.ts.map +1 -1
  222. package/types/phaser/display/webgl/blend_manager.d.ts +11 -6
  223. package/types/phaser/display/webgl/blend_manager.d.ts.map +1 -1
  224. package/types/phaser/display/webgl/earcut.d.ts.map +1 -1
  225. package/types/phaser/display/webgl/earcut_node.d.ts +9 -9
  226. package/types/phaser/display/webgl/earcut_node.d.ts.map +1 -1
  227. package/types/phaser/display/webgl/fast_sprite_batch.d.ts +33 -6
  228. package/types/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
  229. package/types/phaser/display/webgl/filter_manager.d.ts +22 -6
  230. package/types/phaser/display/webgl/filter_manager.d.ts.map +1 -1
  231. package/types/phaser/display/webgl/filter_texture.d.ts +21 -3
  232. package/types/phaser/display/webgl/filter_texture.d.ts.map +1 -1
  233. package/types/phaser/display/webgl/graphics.d.ts.map +1 -1
  234. package/types/phaser/display/webgl/graphics_data.d.ts +10 -6
  235. package/types/phaser/display/webgl/graphics_data.d.ts.map +1 -1
  236. package/types/phaser/display/webgl/mask_manager.d.ts.map +1 -1
  237. package/types/phaser/display/webgl/render_texture.d.ts +30 -3
  238. package/types/phaser/display/webgl/render_texture.d.ts.map +1 -1
  239. package/types/phaser/display/webgl/renderer.d.ts +41 -4
  240. package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
  241. package/types/phaser/display/webgl/shader/complex.d.ts +10 -0
  242. package/types/phaser/display/webgl/shader/complex.d.ts.map +1 -1
  243. package/types/phaser/display/webgl/shader/fast.d.ts +10 -0
  244. package/types/phaser/display/webgl/shader/fast.d.ts.map +1 -1
  245. package/types/phaser/display/webgl/shader/normal.d.ts +20 -0
  246. package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -1
  247. package/types/phaser/display/webgl/shader/primitive.d.ts +10 -0
  248. package/types/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
  249. package/types/phaser/display/webgl/shader/strip.d.ts +10 -0
  250. package/types/phaser/display/webgl/shader/strip.d.ts.map +1 -1
  251. package/types/phaser/display/webgl/shader_manager.d.ts +15 -0
  252. package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -1
  253. package/types/phaser/display/webgl/sprite_batch.d.ts +37 -0
  254. package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
  255. package/types/phaser/display/webgl/stencil_manager.d.ts +25 -0
  256. package/types/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
  257. package/types/phaser/display/webgl/texture.d.ts +21 -0
  258. package/types/phaser/display/webgl/texture.d.ts.map +1 -1
  259. package/types/phaser/display/webgl/texture_util.d.ts.map +1 -1
  260. package/types/phaser/display/webgl/util.d.ts +0 -6
  261. package/types/phaser/display/webgl/util.d.ts.map +1 -1
  262. package/types/phaser/geom/circle.d.ts +131 -9
  263. package/types/phaser/geom/circle.d.ts.map +1 -1
  264. package/types/phaser/geom/ellipse.d.ts +43 -5
  265. package/types/phaser/geom/ellipse.d.ts.map +1 -1
  266. package/types/phaser/geom/line.d.ts +159 -13
  267. package/types/phaser/geom/line.d.ts.map +1 -1
  268. package/types/phaser/geom/matrix.d.ts +85 -11
  269. package/types/phaser/geom/matrix.d.ts.map +1 -1
  270. package/types/phaser/geom/point.d.ts +170 -18
  271. package/types/phaser/geom/point.d.ts.map +1 -1
  272. package/types/phaser/geom/polygon.d.ts +45 -5
  273. package/types/phaser/geom/polygon.d.ts.map +1 -1
  274. package/types/phaser/geom/rectangle.d.ts +253 -20
  275. package/types/phaser/geom/rectangle.d.ts.map +1 -1
  276. package/types/phaser/geom/rounded_rectangle.d.ts +11 -1
  277. package/types/phaser/geom/rounded_rectangle.d.ts.map +1 -1
  278. package/types/phaser/geom/util/circle.d.ts +3 -3
  279. package/types/phaser/geom/util/circle.d.ts.map +1 -1
  280. package/types/phaser/geom/util/ellipse.d.ts +0 -6
  281. package/types/phaser/geom/util/ellipse.d.ts.map +1 -1
  282. package/types/phaser/geom/util/line.d.ts +5 -5
  283. package/types/phaser/geom/util/line.d.ts.map +1 -1
  284. package/types/phaser/geom/util/matrix.d.ts.map +1 -1
  285. package/types/phaser/geom/util/point.d.ts.map +1 -1
  286. package/types/phaser/geom/util/polygon.d.ts.map +1 -1
  287. package/types/phaser/geom/util/rectangle.d.ts.map +1 -1
  288. package/types/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
  289. package/types/phaser/util/math.d.ts +0 -5
  290. package/types/phaser/util/math.d.ts.map +1 -1
@@ -1,14 +1,16 @@
1
- /**
2
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
3
- * @author Andras Csizmadia <andras@vpmedia.hu>
4
- * @author Richard Davey <rich@photonstorm.com>
5
- */
6
- import { Signal } from './signal';
1
+ import { Signal } from './signal';
7
2
  import { TweenData } from './tween_data';
8
3
  import * as MathUtils from '../util/math';
9
4
  import { TWEEN_PENDING, TWEEN_RUNNING, TWEEN_COMPLETE, TWEEN_LOOPED } from './const';
5
+ import { Game } from './game';
10
6
 
11
7
  export class Tween {
8
+ /**
9
+ * TBD.
10
+ * @param target - TBD.
11
+ * @param {Game} game - TBD.
12
+ * @param manager
13
+ */
12
14
  constructor(target, game, manager) {
13
15
  this.game = game;
14
16
  this.target = target;
@@ -35,15 +37,17 @@ export class Tween {
35
37
  this._hasStarted = false;
36
38
  }
37
39
 
38
- to(
39
- properties,
40
- duration = 1000,
41
- ease = 'Linear',
42
- autoStart = false,
43
- delay = 0,
44
- repeat = 0,
45
- yoyo = false
46
- ) {
40
+ /**
41
+ * TBD.
42
+ * @param properties
43
+ * @param duration - TBD.
44
+ * @param ease - TBD.
45
+ * @param autoStart
46
+ * @param delay - TBD.
47
+ * @param repeat
48
+ * @param yoyo
49
+ */
50
+ to(properties, duration = 1000, ease = 'Linear', autoStart = false, delay = 0, repeat = 0, yoyo = false) {
47
51
  if (typeof ease === 'string' && this.manager.easeMap[ease]) {
48
52
  ease = this.manager.easeMap[ease];
49
53
  }
@@ -57,15 +61,17 @@ export class Tween {
57
61
  return this;
58
62
  }
59
63
 
60
- from(
61
- properties,
62
- duration = 1000,
63
- ease = 'Linear',
64
- autoStart = false,
65
- delay = 0,
66
- repeat = 0,
67
- yoyo = false
68
- ) {
64
+ /**
65
+ * TBD.
66
+ * @param properties
67
+ * @param duration - TBD.
68
+ * @param ease - TBD.
69
+ * @param autoStart
70
+ * @param delay - TBD.
71
+ * @param repeat
72
+ * @param yoyo
73
+ */
74
+ from(properties, duration = 1000, ease = 'Linear', autoStart = false, delay = 0, repeat = 0, yoyo = false) {
69
75
  if (typeof ease === 'string' && this.manager.easeMap[ease]) {
70
76
  ease = this.manager.easeMap[ease];
71
77
  }
@@ -80,13 +86,12 @@ export class Tween {
80
86
  return this;
81
87
  }
82
88
 
89
+ /**
90
+ * TBD.
91
+ * @param index - TBD.
92
+ */
83
93
  start(index = 0) {
84
- if (
85
- this.game === null ||
86
- this.target === null ||
87
- this.timeline.length === 0 ||
88
- this.isRunning
89
- ) {
94
+ if (this.game === null || this.target === null || this.timeline.length === 0 || this.isRunning) {
90
95
  return this;
91
96
  }
92
97
  // Populate the tween data
@@ -115,6 +120,10 @@ export class Tween {
115
120
  return this;
116
121
  }
117
122
 
123
+ /**
124
+ * TBD.
125
+ * @param complete
126
+ */
118
127
  stop(complete = false) {
119
128
  this.isRunning = false;
120
129
  this._onUpdateCallback = null;
@@ -130,6 +139,12 @@ export class Tween {
130
139
  return this;
131
140
  }
132
141
 
142
+ /**
143
+ * TBD.
144
+ * @param property
145
+ * @param value
146
+ * @param index - TBD.
147
+ */
133
148
  updateTweenData(property, value, index = 0) {
134
149
  if (this.timeline.length === 0) {
135
150
  return this;
@@ -144,28 +159,60 @@ export class Tween {
144
159
  return this;
145
160
  }
146
161
 
162
+ /**
163
+ * TBD.
164
+ * @param duration - TBD.
165
+ * @param index - TBD.
166
+ */
147
167
  delay(duration, index) {
148
168
  return this.updateTweenData('delay', duration, index);
149
169
  }
150
170
 
171
+ /**
172
+ * TBD.
173
+ * @param total
174
+ * @param repeatDelay
175
+ * @param index - TBD.
176
+ */
151
177
  repeat(total, repeatDelay = 0, index = 0) {
152
178
  this.updateTweenData('repeatCounter', total, index);
153
179
  return this.updateTweenData('repeatDelay', repeatDelay, index);
154
180
  }
155
181
 
182
+ /**
183
+ * TBD.
184
+ * @param duration - TBD.
185
+ * @param index - TBD.
186
+ */
156
187
  repeatDelay(duration, index) {
157
188
  return this.updateTweenData('repeatDelay', duration, index);
158
189
  }
159
190
 
191
+ /**
192
+ * TBD.
193
+ * @param enable
194
+ * @param yoyoDelay
195
+ * @param index - TBD.
196
+ */
160
197
  yoyo(enable, yoyoDelay = 0, index = 0) {
161
198
  this.updateTweenData('yoyo', enable, index);
162
199
  return this.updateTweenData('yoyoDelay', yoyoDelay, index);
163
200
  }
164
201
 
202
+ /**
203
+ * TBD.
204
+ * @param duration - TBD.
205
+ * @param index - TBD.
206
+ */
165
207
  yoyoDelay(duration, index) {
166
208
  return this.updateTweenData('yoyoDelay', duration, index);
167
209
  }
168
210
 
211
+ /**
212
+ * TBD.
213
+ * @param ease - TBD.
214
+ * @param index - TBD.
215
+ */
169
216
  easing(ease, index) {
170
217
  if (typeof ease === 'string' && this.manager.easeMap[ease]) {
171
218
  ease = this.manager.easeMap[ease];
@@ -173,16 +220,30 @@ export class Tween {
173
220
  return this.updateTweenData('easingFunction', ease, index);
174
221
  }
175
222
 
223
+ /**
224
+ * TBD.
225
+ * @param interpolation
226
+ * @param context
227
+ * @param index - TBD.
228
+ */
176
229
  interpolation(interpolation, context = MathUtils, index = 0) {
177
230
  this.updateTweenData('interpolationFunction', interpolation, index);
178
231
  return this.updateTweenData('interpolationContext', context, index);
179
232
  }
180
233
 
234
+ /**
235
+ * TBD.
236
+ * @param total
237
+ */
181
238
  repeatAll(total = 0) {
182
239
  this.repeatCounter = total;
183
240
  return this;
184
241
  }
185
242
 
243
+ /**
244
+ * TBD.
245
+ * @param {...any} args
246
+ */
186
247
  chain(...args) {
187
248
  let i = args.length;
188
249
  while (i) {
@@ -196,23 +257,38 @@ export class Tween {
196
257
  return this;
197
258
  }
198
259
 
260
+ /**
261
+ * TBD.
262
+ * @param value
263
+ */
199
264
  loop(value = true) {
200
265
  this.repeatCounter = value ? -1 : 0;
201
266
  return this;
202
267
  }
203
268
 
269
+ /**
270
+ * TBD.
271
+ * @param {Function} callback - TBD.
272
+ * @param callbackContext
273
+ */
204
274
  onUpdateCallback(callback, callbackContext) {
205
275
  this._onUpdateCallback = callback;
206
276
  this._onUpdateCallbackContext = callbackContext;
207
277
  return this;
208
278
  }
209
279
 
280
+ /**
281
+ * TBD.
282
+ */
210
283
  pause() {
211
284
  this.isPaused = true;
212
285
  this._codePaused = true;
213
286
  this._pausedTime = this.game.time.time;
214
287
  }
215
288
 
289
+ /**
290
+ * TBD.
291
+ */
216
292
  _pause() {
217
293
  if (!this._codePaused) {
218
294
  this.isPaused = true;
@@ -220,6 +296,9 @@ export class Tween {
220
296
  }
221
297
  }
222
298
 
299
+ /**
300
+ * TBD.
301
+ */
223
302
  resume() {
224
303
  if (this.isPaused) {
225
304
  this.isPaused = false;
@@ -232,12 +311,19 @@ export class Tween {
232
311
  }
233
312
  }
234
313
 
314
+ /**
315
+ * TBD.
316
+ */
235
317
  _resume() {
236
318
  if (!this._codePaused) {
237
319
  this.resume();
238
320
  }
239
321
  }
240
322
 
323
+ /**
324
+ * TBD.
325
+ * @param time
326
+ */
241
327
  update(time) {
242
328
  if (this.pendingDelete || !this.target) {
243
329
  return false;
@@ -316,6 +402,11 @@ export class Tween {
316
402
  return false;
317
403
  }
318
404
 
405
+ /**
406
+ * TBD.
407
+ * @param frameRate
408
+ * @param data
409
+ */
319
410
  generateData(frameRate = 60, data = []) {
320
411
  if (this.game === null || this.target === null) {
321
412
  return null;
@@ -342,6 +433,9 @@ export class Tween {
342
433
  return data;
343
434
  }
344
435
 
436
+ /**
437
+ * TBD.
438
+ */
345
439
  get totalDuration() {
346
440
  let total = 0;
347
441
  for (let i = 0; i < this.timeline.length; i += 1) {
@@ -1,12 +1,11 @@
1
- /**
2
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
3
- * @author Andras Csizmadia <andras@vpmedia.hu>
4
- * @author Richard Davey <rich@photonstorm.com>
5
- */
6
1
  import * as MathUtils from '../util/math';
7
2
  import { TWEEN_PENDING, TWEEN_RUNNING, TWEEN_COMPLETE, TWEEN_LOOPED } from './const';
8
3
 
9
4
  export class TweenData {
5
+ /**
6
+ * TBD.
7
+ * @param parent
8
+ */
10
9
  constructor(parent) {
11
10
  this.parent = parent;
12
11
  this.game = parent.game;
@@ -34,6 +33,15 @@ export class TweenData {
34
33
  this.isFrom = false;
35
34
  }
36
35
 
36
+ /**
37
+ * TBD.
38
+ * @param properties
39
+ * @param duration - TBD.
40
+ * @param ease - TBD.
41
+ * @param delay - TBD.
42
+ * @param repeat
43
+ * @param yoyo
44
+ */
37
45
  to(properties, duration, ease, delay, repeat, yoyo) {
38
46
  this.vEnd = properties;
39
47
  this.duration = duration;
@@ -45,6 +53,15 @@ export class TweenData {
45
53
  return this;
46
54
  }
47
55
 
56
+ /**
57
+ * TBD.
58
+ * @param properties
59
+ * @param duration - TBD.
60
+ * @param ease - TBD.
61
+ * @param delay - TBD.
62
+ * @param repeat
63
+ * @param yoyo
64
+ */
48
65
  from(properties, duration, ease, delay, repeat, yoyo) {
49
66
  this.vEnd = properties;
50
67
  this.duration = duration;
@@ -56,6 +73,9 @@ export class TweenData {
56
73
  return this;
57
74
  }
58
75
 
76
+ /**
77
+ * TBD.
78
+ */
59
79
  start() {
60
80
  this.startTime = this.game.time.time + this.delay;
61
81
  if (this.parent.reverse) {
@@ -84,6 +104,9 @@ export class TweenData {
84
104
  return this;
85
105
  }
86
106
 
107
+ /**
108
+ * TBD.
109
+ */
87
110
  loadValues() {
88
111
  const keys = Object.keys(this.parent.properties);
89
112
  for (let k = 0; k < keys.length; k += 1) {
@@ -117,6 +140,10 @@ export class TweenData {
117
140
  return this;
118
141
  }
119
142
 
143
+ /**
144
+ * TBD.
145
+ * @param time
146
+ */
120
147
  update(time) {
121
148
  if (!this.isRunning) {
122
149
  if (time >= this.startTime) {
@@ -144,24 +171,21 @@ export class TweenData {
144
171
  const start = this.vStart[property];
145
172
  const end = this.vEnd[property];
146
173
  if (Array.isArray(end)) {
147
- this.parent.target[property] = this.interpolationFunction.call(
148
- this.interpolationContext,
149
- end,
150
- this.value
151
- );
174
+ this.parent.target[property] = this.interpolationFunction.call(this.interpolationContext, end, this.value);
152
175
  } else {
153
176
  this.parent.target[property] = start + (end - start) * this.value;
154
177
  }
155
178
  }
156
- if (
157
- (!this.parent.reverse && this.percent === 1) ||
158
- (this.parent.reverse && this.percent === 0)
159
- ) {
179
+ if ((!this.parent.reverse && this.percent === 1) || (this.parent.reverse && this.percent === 0)) {
160
180
  return this.repeat();
161
181
  }
162
182
  return TWEEN_RUNNING;
163
183
  }
164
184
 
185
+ /**
186
+ * TBD.
187
+ * @param frameRate
188
+ */
165
189
  generateData(frameRate) {
166
190
  if (this.parent.reverse) {
167
191
  this.dt = this.duration;
@@ -194,10 +218,7 @@ export class TweenData {
194
218
  }
195
219
  }
196
220
  data.push(blob);
197
- if (
198
- (!this.parent.reverse && this.percent === 1) ||
199
- (this.parent.reverse && this.percent === 0)
200
- ) {
221
+ if ((!this.parent.reverse && this.percent === 1) || (this.parent.reverse && this.percent === 0)) {
201
222
  complete = true;
202
223
  }
203
224
  } while (!complete);
@@ -209,6 +230,9 @@ export class TweenData {
209
230
  return data;
210
231
  }
211
232
 
233
+ /**
234
+ * TBD.
235
+ */
212
236
  repeat() {
213
237
  // If not a yoyo and repeatCounter = 0 then we're done
214
238
  if (this.yoyo) {
@@ -1,9 +1,3 @@
1
- /**
2
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
3
- * @author Andras Csizmadia <andras@vpmedia.hu>
4
- * @author Richard Davey <rich@photonstorm.com>
5
- */
6
-
7
1
  /**
8
2
  * TBD.
9
3
  * @param {number} k - TBD.
@@ -273,8 +267,7 @@ export function ElasticInOut(k) {
273
267
  } else {
274
268
  s = (p * Math.asin(1 / a)) / (2 * Math.PI);
275
269
  }
276
- if ((k *= 2) < 1)
277
- return -0.5 * (a * Math.pow(2, 10 * (k -= 1)) * Math.sin(((k - s) * (2 * Math.PI)) / p));
270
+ if ((k *= 2) < 1) return -0.5 * (a * Math.pow(2, 10 * (k -= 1)) * Math.sin(((k - s) * (2 * Math.PI)) / p));
278
271
  return a * Math.pow(2, -10 * (k -= 1)) * Math.sin(((k - s) * (2 * Math.PI)) / p) * 0.5 + 1;
279
272
  }
280
273
 
@@ -1,8 +1,3 @@
1
- /**
2
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
3
- * @author Andras Csizmadia <andras@vpmedia.hu>
4
- * @author Richard Davey <rich@photonstorm.com>
5
- */
6
1
  import { Tween } from './tween';
7
2
  import {
8
3
  LinearNone,
@@ -38,8 +33,13 @@ import {
38
33
  BounceInOut,
39
34
  } from './tween_easing';
40
35
  import { GROUP } from './const';
36
+ import { Game } from './game';
41
37
 
42
38
  export class TweenManager {
39
+ /**
40
+ * TBD.
41
+ * @param {Game} game - TBD.
42
+ */
43
43
  constructor(game) {
44
44
  this.game = game;
45
45
  this._tweens = [];
@@ -92,10 +92,16 @@ export class TweenManager {
92
92
  this.game.onResume.add(this._resumeAll, this);
93
93
  }
94
94
 
95
+ /**
96
+ * TBD.
97
+ */
95
98
  getAll() {
96
99
  return this._tweens;
97
100
  }
98
101
 
102
+ /**
103
+ * TBD.
104
+ */
99
105
  removeAll() {
100
106
  for (let i = 0; i < this._tweens.length; i += 1) {
101
107
  this._tweens[i].pendingDelete = true;
@@ -103,6 +109,11 @@ export class TweenManager {
103
109
  this._add = [];
104
110
  }
105
111
 
112
+ /**
113
+ * TBD.
114
+ * @param obj
115
+ * @param children
116
+ */
106
117
  removeFrom(obj, children) {
107
118
  let i;
108
119
  let len;
@@ -128,15 +139,27 @@ export class TweenManager {
128
139
  }
129
140
  }
130
141
 
142
+ /**
143
+ * TBD.
144
+ * @param tween
145
+ */
131
146
  add(tween) {
132
147
  tween._manager = this;
133
148
  this._add.push(tween);
134
149
  }
135
150
 
151
+ /**
152
+ * TBD.
153
+ * @param object
154
+ */
136
155
  create(object) {
137
156
  return new Tween(object, this.game, this);
138
157
  }
139
158
 
159
+ /**
160
+ * TBD.
161
+ * @param tween
162
+ */
140
163
  remove(tween) {
141
164
  let i = this._tweens.indexOf(tween);
142
165
  if (i !== -1) {
@@ -149,6 +172,9 @@ export class TweenManager {
149
172
  }
150
173
  }
151
174
 
175
+ /**
176
+ * TBD.
177
+ */
152
178
  update() {
153
179
  const addTweens = this._add.length;
154
180
  let numTweens = this._tweens.length;
@@ -172,28 +198,44 @@ export class TweenManager {
172
198
  return true;
173
199
  }
174
200
 
201
+ /**
202
+ * TBD.
203
+ * @param object
204
+ */
175
205
  isTweening(object) {
176
206
  return this._tweens.some((tween) => tween.target === object);
177
207
  }
178
208
 
209
+ /**
210
+ * TBD.
211
+ */
179
212
  _pauseAll() {
180
213
  for (let i = this._tweens.length - 1; i >= 0; i -= 1) {
181
214
  this._tweens[i]._pause();
182
215
  }
183
216
  }
184
217
 
218
+ /**
219
+ * TBD.
220
+ */
185
221
  _resumeAll() {
186
222
  for (let i = this._tweens.length - 1; i >= 0; i -= 1) {
187
223
  this._tweens[i]._resume();
188
224
  }
189
225
  }
190
226
 
227
+ /**
228
+ * TBD.
229
+ */
191
230
  pauseAll() {
192
231
  for (let i = this._tweens.length - 1; i >= 0; i -= 1) {
193
232
  this._tweens[i].pause();
194
233
  }
195
234
  }
196
235
 
236
+ /**
237
+ * TBD.
238
+ */
197
239
  resumeAll() {
198
240
  for (let i = this._tweens.length - 1; i >= 0; i -= 1) {
199
241
  this._tweens[i].resume(true);
@@ -1,15 +1,18 @@
1
- /**
2
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
3
- * @author Andras Csizmadia <andras@vpmedia.hu>
4
- * @author Richard Davey <rich@photonstorm.com>
5
- */
6
- import { Group } from '../display/group';
1
+ import { Group } from '../display/group';
2
+ import { Game } from './game';
7
3
 
8
4
  export class World extends Group {
5
+ /**
6
+ * TBD.
7
+ * @param {Game} game - TBD.
8
+ */
9
9
  constructor(game) {
10
10
  super(game, null, '__world', false);
11
11
  }
12
12
 
13
+ /**
14
+ * TBD.
15
+ */
13
16
  boot() {
14
17
  this.game.stage.addChild(this);
15
18
  }