@vpmedia/phaser 1.11.0 → 1.12.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 (298) hide show
  1. package/README.md +1 -1
  2. package/package.json +8 -5
  3. package/src/phaser/core/animation.js +9 -6
  4. package/src/phaser/core/animation_manager.js +14 -4
  5. package/src/phaser/core/animation_parser.js +24 -3
  6. package/src/phaser/core/array_set.js +1 -3
  7. package/src/phaser/core/cache.js +6 -6
  8. package/src/phaser/core/device.js +0 -2
  9. package/src/phaser/core/device_util.js +21 -6
  10. package/src/phaser/core/dom.js +34 -25
  11. package/src/phaser/core/event_manager.js +45 -17
  12. package/src/phaser/core/factory.js +26 -4
  13. package/src/phaser/core/frame.js +0 -2
  14. package/src/phaser/core/frame_data.js +0 -2
  15. package/src/phaser/core/game.js +8 -6
  16. package/src/phaser/core/input.js +17 -9
  17. package/src/phaser/core/input_handler.js +100 -26
  18. package/src/phaser/core/input_mouse.js +10 -14
  19. package/src/phaser/core/input_mspointer.js +10 -9
  20. package/src/phaser/core/input_pointer.js +58 -17
  21. package/src/phaser/core/input_touch.js +6 -8
  22. package/src/phaser/core/loader.js +168 -51
  23. package/src/phaser/core/loader_parser.js +4 -1
  24. package/src/phaser/core/raf.js +0 -2
  25. package/src/phaser/core/scale_manager.js +69 -25
  26. package/src/phaser/core/scene.js +0 -2
  27. package/src/phaser/core/scene_manager.js +6 -3
  28. package/src/phaser/core/signal.js +15 -8
  29. package/src/phaser/core/signal_binding.js +10 -5
  30. package/src/phaser/core/sound.js +20 -11
  31. package/src/phaser/core/sound_manager.js +56 -20
  32. package/src/phaser/core/sound_sprite.js +32 -32
  33. package/src/phaser/core/stage.js +0 -3
  34. package/src/phaser/core/time.js +0 -2
  35. package/src/phaser/core/timer.js +24 -7
  36. package/src/phaser/core/timer_event.js +0 -2
  37. package/src/phaser/core/tween.js +32 -8
  38. package/src/phaser/core/tween_data.js +15 -7
  39. package/src/phaser/core/tween_easing.js +24 -20
  40. package/src/phaser/core/tween_manager.js +31 -13
  41. package/src/phaser/core/world.js +0 -2
  42. package/src/phaser/display/bitmap_text.js +8 -9
  43. package/src/phaser/display/button.js +16 -4
  44. package/src/phaser/display/canvas/buffer.js +0 -2
  45. package/src/phaser/display/canvas/graphics.js +21 -9
  46. package/src/phaser/display/canvas/masker.js +1 -1
  47. package/src/phaser/display/canvas/renderer.js +39 -19
  48. package/src/phaser/display/canvas/tinter.js +43 -6
  49. package/src/phaser/display/canvas/util.js +1 -1
  50. package/src/phaser/display/display_object.js +33 -19
  51. package/src/phaser/display/graphics.js +52 -27
  52. package/src/phaser/display/graphics_data.js +0 -2
  53. package/src/phaser/display/graphics_data_util.js +9 -1
  54. package/src/phaser/display/group.js +1 -4
  55. package/src/phaser/display/image.js +2 -4
  56. package/src/phaser/display/sprite_batch.js +0 -2
  57. package/src/phaser/display/sprite_util.js +46 -11
  58. package/src/phaser/display/text.js +77 -26
  59. package/src/phaser/display/webgl/abstract_filter.js +0 -2
  60. package/src/phaser/display/webgl/base_texture.js +5 -3
  61. package/src/phaser/display/webgl/blend_manager.js +0 -2
  62. package/src/phaser/display/webgl/earcut.js +63 -22
  63. package/src/phaser/display/webgl/earcut_node.js +0 -2
  64. package/src/phaser/display/webgl/fast_sprite_batch.js +47 -46
  65. package/src/phaser/display/webgl/filter_manager.js +0 -2
  66. package/src/phaser/display/webgl/filter_texture.js +16 -5
  67. package/src/phaser/display/webgl/graphics.js +38 -16
  68. package/src/phaser/display/webgl/graphics_data.js +0 -2
  69. package/src/phaser/display/webgl/mask_manager.js +10 -2
  70. package/src/phaser/display/webgl/render_texture.js +14 -5
  71. package/src/phaser/display/webgl/renderer.js +39 -7
  72. package/src/phaser/display/webgl/shader/complex.js +0 -2
  73. package/src/phaser/display/webgl/shader/fast.js +8 -3
  74. package/src/phaser/display/webgl/shader/normal.js +42 -14
  75. package/src/phaser/display/webgl/shader/primitive.js +0 -2
  76. package/src/phaser/display/webgl/shader/strip.js +0 -2
  77. package/src/phaser/display/webgl/shader_manager.js +0 -2
  78. package/src/phaser/display/webgl/sprite_batch.js +13 -14
  79. package/src/phaser/display/webgl/stencil_manager.js +18 -20
  80. package/src/phaser/display/webgl/texture.js +10 -7
  81. package/src/phaser/display/webgl/util.js +1 -2
  82. package/src/phaser/geom/circle.js +15 -7
  83. package/src/phaser/geom/ellipse.js +13 -6
  84. package/src/phaser/geom/line.js +19 -10
  85. package/src/phaser/geom/matrix.js +0 -2
  86. package/src/phaser/geom/point.js +9 -11
  87. package/src/phaser/geom/polygon.js +9 -5
  88. package/src/phaser/geom/rectangle.js +44 -10
  89. package/src/phaser/geom/rounded_rectangle.js +0 -2
  90. package/src/phaser/geom/util/circle.js +3 -3
  91. package/src/phaser/geom/util/ellipse.js +3 -3
  92. package/src/phaser/geom/util/line.js +16 -13
  93. package/src/phaser/geom/util/point.js +1 -1
  94. package/src/phaser/geom/util/rectangle.js +17 -7
  95. package/src/phaser/util/math.js +37 -23
  96. package/tsconfig.json +110 -0
  97. package/types/index.d.ts +22 -0
  98. package/types/index.d.ts.map +1 -0
  99. package/types/phaser/core/animation.d.ts +55 -0
  100. package/types/phaser/core/animation.d.ts.map +1 -0
  101. package/types/phaser/core/animation_manager.d.ts +35 -0
  102. package/types/phaser/core/animation_manager.d.ts.map +1 -0
  103. package/types/phaser/core/animation_parser.d.ts +20 -0
  104. package/types/phaser/core/animation_parser.d.ts.map +1 -0
  105. package/types/phaser/core/array_set.d.ts +23 -0
  106. package/types/phaser/core/array_set.d.ts.map +1 -0
  107. package/types/phaser/core/cache.d.ts +106 -0
  108. package/types/phaser/core/cache.d.ts.map +1 -0
  109. package/types/phaser/core/const.d.ts +81 -0
  110. package/types/phaser/core/const.d.ts.map +1 -0
  111. package/types/phaser/core/device.d.ts +36 -0
  112. package/types/phaser/core/device.d.ts.map +1 -0
  113. package/types/phaser/core/device_util.d.ts +48 -0
  114. package/types/phaser/core/device_util.d.ts.map +1 -0
  115. package/types/phaser/core/dom.d.ts +63 -0
  116. package/types/phaser/core/dom.d.ts.map +1 -0
  117. package/types/phaser/core/event_manager.d.ts +53 -0
  118. package/types/phaser/core/event_manager.d.ts.map +1 -0
  119. package/types/phaser/core/factory.d.ts +12 -0
  120. package/types/phaser/core/factory.d.ts.map +1 -0
  121. package/types/phaser/core/frame.d.ts +30 -0
  122. package/types/phaser/core/frame.d.ts.map +1 -0
  123. package/types/phaser/core/frame_data.d.ts +14 -0
  124. package/types/phaser/core/frame_data.d.ts.map +1 -0
  125. package/types/phaser/core/frame_util.d.ts +15 -0
  126. package/types/phaser/core/frame_util.d.ts.map +1 -0
  127. package/types/phaser/core/game.d.ts +57 -0
  128. package/types/phaser/core/game.d.ts.map +1 -0
  129. package/types/phaser/core/input.d.ts +92 -0
  130. package/types/phaser/core/input.d.ts.map +1 -0
  131. package/types/phaser/core/input_handler.d.ts +111 -0
  132. package/types/phaser/core/input_handler.d.ts.map +1 -0
  133. package/types/phaser/core/input_mouse.d.ts +39 -0
  134. package/types/phaser/core/input_mouse.d.ts.map +1 -0
  135. package/types/phaser/core/input_mspointer.d.ts +34 -0
  136. package/types/phaser/core/input_mspointer.d.ts.map +1 -0
  137. package/types/phaser/core/input_pointer.d.ts +68 -0
  138. package/types/phaser/core/input_pointer.d.ts.map +1 -0
  139. package/types/phaser/core/input_touch.d.ts +37 -0
  140. package/types/phaser/core/input_touch.d.ts.map +1 -0
  141. package/types/phaser/core/loader.d.ts +94 -0
  142. package/types/phaser/core/loader.d.ts.map +1 -0
  143. package/types/phaser/core/loader_parser.d.ts +35 -0
  144. package/types/phaser/core/loader_parser.d.ts.map +1 -0
  145. package/types/phaser/core/raf.d.ts +15 -0
  146. package/types/phaser/core/raf.d.ts.map +1 -0
  147. package/types/phaser/core/scale_manager.d.ts +137 -0
  148. package/types/phaser/core/scale_manager.d.ts.map +1 -0
  149. package/types/phaser/core/scene.d.ts +17 -0
  150. package/types/phaser/core/scene.d.ts.map +1 -0
  151. package/types/phaser/core/scene_manager.d.ts +39 -0
  152. package/types/phaser/core/scene_manager.d.ts.map +1 -0
  153. package/types/phaser/core/signal.d.ts +25 -0
  154. package/types/phaser/core/signal.d.ts.map +1 -0
  155. package/types/phaser/core/signal_binding.d.ts +26 -0
  156. package/types/phaser/core/signal_binding.d.ts.map +1 -0
  157. package/types/phaser/core/sound.d.ts +72 -0
  158. package/types/phaser/core/sound.d.ts.map +1 -0
  159. package/types/phaser/core/sound_manager.d.ts +50 -0
  160. package/types/phaser/core/sound_manager.d.ts.map +1 -0
  161. package/types/phaser/core/sound_sprite.d.ts +18 -0
  162. package/types/phaser/core/sound_sprite.d.ts.map +1 -0
  163. package/types/phaser/core/stage.d.ts +23 -0
  164. package/types/phaser/core/stage.d.ts.map +1 -0
  165. package/types/phaser/core/time.d.ts +49 -0
  166. package/types/phaser/core/time.d.ts.map +1 -0
  167. package/types/phaser/core/timer.d.ts +49 -0
  168. package/types/phaser/core/timer.d.ts.map +1 -0
  169. package/types/phaser/core/timer_event.d.ts +18 -0
  170. package/types/phaser/core/timer_event.d.ts.map +1 -0
  171. package/types/phaser/core/tween.d.ts +52 -0
  172. package/types/phaser/core/tween.d.ts.map +1 -0
  173. package/types/phaser/core/tween_data.d.ts +37 -0
  174. package/types/phaser/core/tween_data.d.ts.map +1 -0
  175. package/types/phaser/core/tween_easing.d.ts +192 -0
  176. package/types/phaser/core/tween_easing.d.ts.map +1 -0
  177. package/types/phaser/core/tween_manager.d.ts +94 -0
  178. package/types/phaser/core/tween_manager.d.ts.map +1 -0
  179. package/types/phaser/core/world.d.ts +6 -0
  180. package/types/phaser/core/world.d.ts.map +1 -0
  181. package/types/phaser/display/bitmap_text.d.ts +48 -0
  182. package/types/phaser/display/bitmap_text.d.ts.map +1 -0
  183. package/types/phaser/display/button.d.ts +33 -0
  184. package/types/phaser/display/button.d.ts.map +1 -0
  185. package/types/phaser/display/canvas/buffer.d.ts +11 -0
  186. package/types/phaser/display/canvas/buffer.d.ts.map +1 -0
  187. package/types/phaser/display/canvas/graphics.d.ts +18 -0
  188. package/types/phaser/display/canvas/graphics.d.ts.map +1 -0
  189. package/types/phaser/display/canvas/masker.d.ts +12 -0
  190. package/types/phaser/display/canvas/masker.d.ts.map +1 -0
  191. package/types/phaser/display/canvas/pool.d.ts +45 -0
  192. package/types/phaser/display/canvas/pool.d.ts.map +1 -0
  193. package/types/phaser/display/canvas/renderer.d.ts +28 -0
  194. package/types/phaser/display/canvas/renderer.d.ts.map +1 -0
  195. package/types/phaser/display/canvas/tinter.d.ts +36 -0
  196. package/types/phaser/display/canvas/tinter.d.ts.map +1 -0
  197. package/types/phaser/display/canvas/util.d.ts +70 -0
  198. package/types/phaser/display/canvas/util.d.ts.map +1 -0
  199. package/types/phaser/display/display_object.d.ts +83 -0
  200. package/types/phaser/display/display_object.d.ts.map +1 -0
  201. package/types/phaser/display/graphics.d.ts +53 -0
  202. package/types/phaser/display/graphics.d.ts.map +1 -0
  203. package/types/phaser/display/graphics_data.d.ts +15 -0
  204. package/types/phaser/display/graphics_data.d.ts.map +1 -0
  205. package/types/phaser/display/graphics_data_util.d.ts +7 -0
  206. package/types/phaser/display/graphics_data_util.d.ts.map +1 -0
  207. package/types/phaser/display/group.d.ts +41 -0
  208. package/types/phaser/display/group.d.ts.map +1 -0
  209. package/types/phaser/display/image.d.ts +43 -0
  210. package/types/phaser/display/image.d.ts.map +1 -0
  211. package/types/phaser/display/sprite_batch.d.ts +6 -0
  212. package/types/phaser/display/sprite_batch.d.ts.map +1 -0
  213. package/types/phaser/display/sprite_util.d.ts +35 -0
  214. package/types/phaser/display/sprite_util.d.ts.map +1 -0
  215. package/types/phaser/display/text.d.ts +116 -0
  216. package/types/phaser/display/text.d.ts.map +1 -0
  217. package/types/phaser/display/webgl/abstract_filter.d.ts +17 -0
  218. package/types/phaser/display/webgl/abstract_filter.d.ts.map +1 -0
  219. package/types/phaser/display/webgl/base_texture.d.ts +20 -0
  220. package/types/phaser/display/webgl/base_texture.d.ts.map +1 -0
  221. package/types/phaser/display/webgl/blend_manager.d.ts +14 -0
  222. package/types/phaser/display/webgl/blend_manager.d.ts.map +1 -0
  223. package/types/phaser/display/webgl/earcut.d.ts +215 -0
  224. package/types/phaser/display/webgl/earcut.d.ts.map +1 -0
  225. package/types/phaser/display/webgl/earcut_node.d.ts +19 -0
  226. package/types/phaser/display/webgl/earcut_node.d.ts.map +1 -0
  227. package/types/phaser/display/webgl/fast_sprite_batch.d.ts +34 -0
  228. package/types/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -0
  229. package/types/phaser/display/webgl/filter_manager.d.ts +21 -0
  230. package/types/phaser/display/webgl/filter_manager.d.ts.map +1 -0
  231. package/types/phaser/display/webgl/filter_texture.d.ts +13 -0
  232. package/types/phaser/display/webgl/filter_texture.d.ts.map +1 -0
  233. package/types/phaser/display/webgl/graphics.d.ts +80 -0
  234. package/types/phaser/display/webgl/graphics.d.ts.map +1 -0
  235. package/types/phaser/display/webgl/graphics_data.d.ts +23 -0
  236. package/types/phaser/display/webgl/graphics_data.d.ts.map +1 -0
  237. package/types/phaser/display/webgl/mask_manager.d.ts +13 -0
  238. package/types/phaser/display/webgl/mask_manager.d.ts.map +1 -0
  239. package/types/phaser/display/webgl/render_texture.d.ts +25 -0
  240. package/types/phaser/display/webgl/render_texture.d.ts.map +1 -0
  241. package/types/phaser/display/webgl/renderer.d.ts +44 -0
  242. package/types/phaser/display/webgl/renderer.d.ts.map +1 -0
  243. package/types/phaser/display/webgl/shader/complex.d.ts +22 -0
  244. package/types/phaser/display/webgl/shader/complex.d.ts.map +1 -0
  245. package/types/phaser/display/webgl/shader/fast.d.ts +25 -0
  246. package/types/phaser/display/webgl/shader/fast.d.ts.map +1 -0
  247. package/types/phaser/display/webgl/shader/normal.d.ts +25 -0
  248. package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -0
  249. package/types/phaser/display/webgl/shader/primitive.d.ts +21 -0
  250. package/types/phaser/display/webgl/shader/primitive.d.ts.map +1 -0
  251. package/types/phaser/display/webgl/shader/strip.d.ts +22 -0
  252. package/types/phaser/display/webgl/shader/strip.d.ts.map +1 -0
  253. package/types/phaser/display/webgl/shader_manager.d.ts +24 -0
  254. package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -0
  255. package/types/phaser/display/webgl/sprite_batch.d.ts +36 -0
  256. package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -0
  257. package/types/phaser/display/webgl/stencil_manager.d.ts +12 -0
  258. package/types/phaser/display/webgl/stencil_manager.d.ts.map +1 -0
  259. package/types/phaser/display/webgl/texture.d.ts +30 -0
  260. package/types/phaser/display/webgl/texture.d.ts.map +1 -0
  261. package/types/phaser/display/webgl/texture_util.d.ts +15 -0
  262. package/types/phaser/display/webgl/texture_util.d.ts.map +1 -0
  263. package/types/phaser/display/webgl/util.d.ts +41 -0
  264. package/types/phaser/display/webgl/util.d.ts.map +1 -0
  265. package/types/phaser/geom/circle.d.ts +39 -0
  266. package/types/phaser/geom/circle.d.ts.map +1 -0
  267. package/types/phaser/geom/ellipse.d.ts +18 -0
  268. package/types/phaser/geom/ellipse.d.ts.map +1 -0
  269. package/types/phaser/geom/line.d.ts +37 -0
  270. package/types/phaser/geom/line.d.ts.map +1 -0
  271. package/types/phaser/geom/matrix.d.ts +25 -0
  272. package/types/phaser/geom/matrix.d.ts.map +1 -0
  273. package/types/phaser/geom/point.d.ts +37 -0
  274. package/types/phaser/geom/point.d.ts.map +1 -0
  275. package/types/phaser/geom/polygon.d.ts +17 -0
  276. package/types/phaser/geom/polygon.d.ts.map +1 -0
  277. package/types/phaser/geom/rectangle.d.ts +63 -0
  278. package/types/phaser/geom/rectangle.d.ts.map +1 -0
  279. package/types/phaser/geom/rounded_rectangle.d.ts +12 -0
  280. package/types/phaser/geom/rounded_rectangle.d.ts.map +1 -0
  281. package/types/phaser/geom/util/circle.d.ts +55 -0
  282. package/types/phaser/geom/util/circle.d.ts.map +1 -0
  283. package/types/phaser/geom/util/ellipse.d.ts +21 -0
  284. package/types/phaser/geom/util/ellipse.d.ts.map +1 -0
  285. package/types/phaser/geom/util/line.d.ts +42 -0
  286. package/types/phaser/geom/util/line.d.ts.map +1 -0
  287. package/types/phaser/geom/util/matrix.d.ts +20 -0
  288. package/types/phaser/geom/util/matrix.d.ts.map +1 -0
  289. package/types/phaser/geom/util/point.d.ts +157 -0
  290. package/types/phaser/geom/util/point.d.ts.map +1 -0
  291. package/types/phaser/geom/util/polygon.d.ts +15 -0
  292. package/types/phaser/geom/util/polygon.d.ts.map +1 -0
  293. package/types/phaser/geom/util/rectangle.d.ts +124 -0
  294. package/types/phaser/geom/util/rectangle.d.ts.map +1 -0
  295. package/types/phaser/geom/util/rounded_rectangle.d.ts +15 -0
  296. package/types/phaser/geom/util/rounded_rectangle.d.ts.map +1 -0
  297. package/types/phaser/util/math.d.ts +162 -0
  298. package/types/phaser/util/math.d.ts.map +1 -0
@@ -84,7 +84,7 @@ export function QuarticIn(k) {
84
84
  * @returns {number} TBD
85
85
  */
86
86
  export function QuarticOut(k) {
87
- return 1 - (--k * k * k * k);
87
+ return 1 - --k * k * k * k;
88
88
  }
89
89
 
90
90
  /**
@@ -133,7 +133,7 @@ export function QuinticInOut(k) {
133
133
  export function SinusoidalIn(k) {
134
134
  if (k === 0) return 0;
135
135
  if (k === 1) return 1;
136
- return 1 - Math.cos(k * Math.PI / 2);
136
+ return 1 - Math.cos((k * Math.PI) / 2);
137
137
  }
138
138
 
139
139
  /**
@@ -144,7 +144,7 @@ export function SinusoidalIn(k) {
144
144
  export function SinusoidalOut(k) {
145
145
  if (k === 0) return 0;
146
146
  if (k === 1) return 1;
147
- return Math.sin(k * Math.PI / 2);
147
+ return Math.sin((k * Math.PI) / 2);
148
148
  }
149
149
 
150
150
  /**
@@ -203,7 +203,7 @@ export function CircularIn(k) {
203
203
  * @returns {number} TBD
204
204
  */
205
205
  export function CircularOut(k) {
206
- return Math.sqrt(1 - (--k * k));
206
+ return Math.sqrt(1 - --k * k);
207
207
  }
208
208
 
209
209
  /**
@@ -228,11 +228,12 @@ export function ElasticIn(k) {
228
228
  if (k === 0) return 0;
229
229
  if (k === 1) return 1;
230
230
  if (!a || a < 1) {
231
- a = 1; s = p / 4;
231
+ a = 1;
232
+ s = p / 4;
232
233
  } else {
233
- s = p * Math.asin(1 / a) / (2 * Math.PI);
234
+ s = (p * Math.asin(1 / a)) / (2 * Math.PI);
234
235
  }
235
- return -(a * Math.pow(2, 10 * (k -= 1)) * Math.sin((k - s) * (2 * Math.PI) / p));
236
+ return -(a * Math.pow(2, 10 * (k -= 1)) * Math.sin(((k - s) * (2 * Math.PI)) / p));
236
237
  }
237
238
 
238
239
  /**
@@ -247,11 +248,12 @@ export function ElasticOut(k) {
247
248
  if (k === 0) return 0;
248
249
  if (k === 1) return 1;
249
250
  if (!a || a < 1) {
250
- a = 1; s = p / 4;
251
+ a = 1;
252
+ s = p / 4;
251
253
  } else {
252
- s = p * Math.asin(1 / a) / (2 * Math.PI);
254
+ s = (p * Math.asin(1 / a)) / (2 * Math.PI);
253
255
  }
254
- return (a * Math.pow(2, -10 * k) * Math.sin((k - s) * (2 * Math.PI) / p) + 1);
256
+ return a * Math.pow(2, -10 * k) * Math.sin(((k - s) * (2 * Math.PI)) / p) + 1;
255
257
  }
256
258
 
257
259
  /**
@@ -266,12 +268,14 @@ export function ElasticInOut(k) {
266
268
  if (k === 0) return 0;
267
269
  if (k === 1) return 1;
268
270
  if (!a || a < 1) {
269
- a = 1; s = p / 4;
271
+ a = 1;
272
+ s = p / 4;
270
273
  } else {
271
- s = p * Math.asin(1 / a) / (2 * Math.PI);
274
+ s = (p * Math.asin(1 / a)) / (2 * Math.PI);
272
275
  }
273
- if ((k *= 2) < 1) return -0.5 * (a * Math.pow(2, 10 * (k -= 1)) * Math.sin((k - s) * (2 * Math.PI) / p));
274
- return a * Math.pow(2, -10 * (k -= 1)) * Math.sin((k - s) * (2 * Math.PI) / p) * 0.5 + 1;
276
+ if ((k *= 2) < 1)
277
+ return -0.5 * (a * Math.pow(2, 10 * (k -= 1)) * Math.sin(((k - s) * (2 * Math.PI)) / p));
278
+ return a * Math.pow(2, -10 * (k -= 1)) * Math.sin(((k - s) * (2 * Math.PI)) / p) * 0.5 + 1;
275
279
  }
276
280
 
277
281
  /**
@@ -311,14 +315,14 @@ export function BackInOut(k) {
311
315
  * @returns {number} TBD
312
316
  */
313
317
  export function BounceOut(k) {
314
- if (k < (1 / 2.75)) {
318
+ if (k < 1 / 2.75) {
315
319
  return 7.5625 * k * k;
316
- } else if (k < (2 / 2.75)) {
317
- return 7.5625 * (k -= (1.5 / 2.75)) * k + 0.75;
318
- } else if (k < (2.5 / 2.75)) {
319
- return 7.5625 * (k -= (2.25 / 2.75)) * k + 0.9375;
320
+ } else if (k < 2 / 2.75) {
321
+ return 7.5625 * (k -= 1.5 / 2.75) * k + 0.75;
322
+ } else if (k < 2.5 / 2.75) {
323
+ return 7.5625 * (k -= 2.25 / 2.75) * k + 0.9375;
320
324
  }
321
- return 7.5625 * (k -= (2.625 / 2.75)) * k + 0.984375;
325
+ return 7.5625 * (k -= 2.625 / 2.75) * k + 0.984375;
322
326
  }
323
327
 
324
328
  /**
@@ -6,21 +6,40 @@
6
6
  import Tween from './tween';
7
7
  import {
8
8
  LinearNone,
9
- QuadraticIn, QuadraticOut, QuadraticInOut,
10
- CubicIn, CubicOut, CubicInOut,
11
- QuarticIn, QuarticOut, QuarticInOut,
12
- QuinticIn, QuinticOut, QuinticInOut,
13
- SinusoidalIn, SinusoidalOut, SinusoidalInOut,
14
- ExponentialIn, ExponentialOut, ExponentialInOut,
15
- CircularIn, CircularOut, CircularInOut,
16
- ElasticIn, ElasticOut, ElasticInOut,
17
- BackIn, BackOut, BackInOut,
18
- BounceIn, BounceOut, BounceInOut,
9
+ QuadraticIn,
10
+ QuadraticOut,
11
+ QuadraticInOut,
12
+ CubicIn,
13
+ CubicOut,
14
+ CubicInOut,
15
+ QuarticIn,
16
+ QuarticOut,
17
+ QuarticInOut,
18
+ QuinticIn,
19
+ QuinticOut,
20
+ QuinticInOut,
21
+ SinusoidalIn,
22
+ SinusoidalOut,
23
+ SinusoidalInOut,
24
+ ExponentialIn,
25
+ ExponentialOut,
26
+ ExponentialInOut,
27
+ CircularIn,
28
+ CircularOut,
29
+ CircularInOut,
30
+ ElasticIn,
31
+ ElasticOut,
32
+ ElasticInOut,
33
+ BackIn,
34
+ BackOut,
35
+ BackInOut,
36
+ BounceIn,
37
+ BounceOut,
38
+ BounceInOut,
19
39
  } from './tween_easing';
20
40
  import { GROUP } from './const';
21
41
 
22
42
  export default class {
23
-
24
43
  constructor(game) {
25
44
  this.game = game;
26
45
  this._tweens = [];
@@ -154,7 +173,7 @@ export default class {
154
173
  }
155
174
 
156
175
  isTweening(object) {
157
- return this._tweens.some(tween => tween.target === object);
176
+ return this._tweens.some((tween) => tween.target === object);
158
177
  }
159
178
 
160
179
  _pauseAll() {
@@ -180,5 +199,4 @@ export default class {
180
199
  this._tweens[i].resume(true);
181
200
  }
182
201
  }
183
-
184
202
  }
@@ -6,7 +6,6 @@
6
6
  import Group from '../display/group';
7
7
 
8
8
  export default class extends Group {
9
-
10
9
  constructor(game) {
11
10
  super(game, null, '__world', false);
12
11
  }
@@ -14,5 +13,4 @@ export default class extends Group {
14
13
  boot() {
15
14
  this.game.stage.addChild(this);
16
15
  }
17
-
18
16
  }
@@ -9,7 +9,6 @@ import Point from '../geom/point';
9
9
  import { BITMAP_TEXT, SCALE_LINEAR, SCALE_NEAREST } from '../core/const';
10
10
 
11
11
  export default class extends DisplayObject {
12
-
13
12
  constructor(game, x = 0, y = 0, font = '', text = '', size = 32, align = 'left') {
14
13
  super();
15
14
  this.game = game;
@@ -25,7 +24,7 @@ export default class extends DisplayObject {
25
24
  this._font = font;
26
25
  this._fontSize = size;
27
26
  this._align = align;
28
- this._tint = 0xFFFFFF;
27
+ this._tint = 0xffffff;
29
28
  this.updateText();
30
29
  this.dirty = false;
31
30
  }
@@ -67,7 +66,7 @@ export default class extends DisplayObject {
67
66
  let lastSpace = -1;
68
67
  let wrappedWidth = 0;
69
68
  let prevCharCode = null;
70
- const maxWidth = (this._maxWidth > 0) ? this._maxWidth : null;
69
+ const maxWidth = this._maxWidth > 0 ? this._maxWidth : null;
71
70
  const chars = [];
72
71
  // Let's scan the text and work out if any of the lines are > maxWidth
73
72
  let end = true;
@@ -91,7 +90,8 @@ export default class extends DisplayObject {
91
90
  charData = data.chars[charCode];
92
91
  }
93
92
  // Adjust for kerning from previous character to this one
94
- const kerning = (prevCharCode && charData.kerning[prevCharCode]) ? charData.kerning[prevCharCode] : 0;
93
+ const kerning =
94
+ prevCharCode && charData.kerning[prevCharCode] ? charData.kerning[prevCharCode] : 0;
95
95
  // Record the last space in the string and the current width
96
96
  if (/(\s)/.test(text.charAt(i))) {
97
97
  lastSpace = i;
@@ -100,7 +100,7 @@ export default class extends DisplayObject {
100
100
  // What will the line width be if we add this character to it?
101
101
  c = (kerning + charData.texture.width + charData.xOffset) * scale;
102
102
  // Do we need to line-wrap?
103
- if (maxWidth && ((w + c) >= maxWidth) && lastSpace > -1) {
103
+ if (maxWidth && w + c >= maxWidth && lastSpace > -1) {
104
104
  // The last space was at "lastSpace" which was "i - lastSpace" characters ago
105
105
  return {
106
106
  width: wrappedWidth || w,
@@ -162,7 +162,7 @@ export default class extends DisplayObject {
162
162
  if (line.width > this.textWidth) {
163
163
  this.textWidth = line.width;
164
164
  }
165
- y += (data.lineHeight * scale);
165
+ y += data.lineHeight * scale;
166
166
  text = text.substr(line.text.length + 1);
167
167
  } while (line.end === false);
168
168
  this.textHeight = y;
@@ -194,8 +194,8 @@ export default class extends DisplayObject {
194
194
  g.name = currentLine.text[c];
195
195
  this._glyphs.push(g);
196
196
  }
197
- g.position.x = (currentLine.chars[c] + align) - ax;
198
- g.position.y = (currentLine.y + (charData.yOffset * scale)) - ay;
197
+ g.position.x = currentLine.chars[c] + align - ax;
198
+ g.position.y = currentLine.y + charData.yOffset * scale - ay;
199
199
  g.scale.set(scale);
200
200
  g.tint = this.tint;
201
201
  g.texture.requiresReTint = true;
@@ -333,5 +333,4 @@ export default class extends DisplayObject {
333
333
  this._data.base.scaleMode = SCALE_NEAREST;
334
334
  }
335
335
  }
336
-
337
336
  }
@@ -15,8 +15,18 @@ const STATE_UP = 'Up';
15
15
  const STATE_DISABLED = 'Disabled';
16
16
 
17
17
  export default class extends Image {
18
-
19
- constructor(game, x = 0, y = 0, key = null, callback = null, callbackContext = null, overFrame = null, outFrame = null, downFrame = null, upFrame = null) {
18
+ constructor(
19
+ game,
20
+ x = 0,
21
+ y = 0,
22
+ key = null,
23
+ callback = null,
24
+ callbackContext = null,
25
+ overFrame = null,
26
+ outFrame = null,
27
+ downFrame = null,
28
+ upFrame = null
29
+ ) {
20
30
  super(game, x, y, key, outFrame);
21
31
  this.type = BUTTON;
22
32
  this._onOverFrame = null;
@@ -125,7 +135,10 @@ export default class extends Image {
125
135
  }
126
136
 
127
137
  onInputOverHandler(sprite, pointer) {
128
- if (pointer.justReleased() && (this.justReleasedPreventsOver & pointer.pointerMode) === pointer.pointerMode) {
138
+ if (
139
+ pointer.justReleased() &&
140
+ (this.justReleasedPreventsOver & pointer.pointerMode) === pointer.pointerMode
141
+ ) {
129
142
  // If the Pointer was only just released then we don't fire an over event
130
143
  return;
131
144
  }
@@ -190,5 +203,4 @@ export default class extends Image {
190
203
  this.input.stop();
191
204
  }
192
205
  }
193
-
194
206
  }
@@ -7,7 +7,6 @@
7
7
  import { create, removeByCanvas } from './pool';
8
8
 
9
9
  export default class {
10
-
11
10
  constructor(width, height) {
12
11
  this.width = width;
13
12
  this.height = height;
@@ -32,5 +31,4 @@ export default class {
32
31
  destroy() {
33
32
  removeByCanvas(this.canvas);
34
33
  }
35
-
36
34
  }
@@ -4,25 +4,37 @@
4
4
  * @author Mat Groves http://matgroves.com/ @Doormat23
5
5
  * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
6
6
  */
7
- import { GEOM_POLYGON, GEOM_RECTANGLE, GEOM_CIRCLE, GEOM_ELLIPSE, GEOM_ROUNDED_RECTANGLE } from '../../core/const';
7
+ import {
8
+ GEOM_POLYGON,
9
+ GEOM_RECTANGLE,
10
+ GEOM_CIRCLE,
11
+ GEOM_ELLIPSE,
12
+ GEOM_ROUNDED_RECTANGLE,
13
+ } from '../../core/const';
8
14
 
9
15
  /**
10
16
  *
11
17
  * @param {object} graphics TBD
12
18
  */
13
19
  export function updateGraphicsTint(graphics) {
14
- if (graphics.tint === 0xFFFFFF) {
20
+ if (graphics.tint === 0xffffff) {
15
21
  return;
16
22
  }
17
- const tintR = (graphics.tint >> 16 & 0xFF) / 255;
18
- const tintG = (graphics.tint >> 8 & 0xFF) / 255;
19
- const tintB = (graphics.tint & 0xFF) / 255;
23
+ const tintR = ((graphics.tint >> 16) & 0xff) / 255;
24
+ const tintG = ((graphics.tint >> 8) & 0xff) / 255;
25
+ const tintB = (graphics.tint & 0xff) / 255;
20
26
  for (let i = 0; i < graphics.graphicsData.length; i += 1) {
21
27
  const data = graphics.graphicsData[i];
22
28
  const fillColor = data.fillColor | 0;
23
29
  const lineColor = data.lineColor | 0;
24
- data._fillTint = (((fillColor >> 16 & 0xFF) / 255 * tintR * 255 << 16) + ((fillColor >> 8 & 0xFF) / 255 * tintG * 255 << 8) + (fillColor & 0xFF) / 255 * tintB * 255);
25
- data._lineTint = (((lineColor >> 16 & 0xFF) / 255 * tintR * 255 << 16) + ((lineColor >> 8 & 0xFF) / 255 * tintG * 255 << 8) + (lineColor & 0xFF) / 255 * tintB * 255);
30
+ data._fillTint =
31
+ (((((fillColor >> 16) & 0xff) / 255) * tintR * 255) << 16) +
32
+ (((((fillColor >> 8) & 0xff) / 255) * tintG * 255) << 8) +
33
+ ((fillColor & 0xff) / 255) * tintB * 255;
34
+ data._lineTint =
35
+ (((((lineColor >> 16) & 0xff) / 255) * tintR * 255) << 16) +
36
+ (((((lineColor >> 8) & 0xff) / 255) * tintG * 255) << 8) +
37
+ ((lineColor & 0xff) / 255) * tintB * 255;
26
38
  }
27
39
  }
28
40
 
@@ -128,7 +140,7 @@ export function renderGraphics(graphics, context) {
128
140
  const width = shape.width;
129
141
  const height = shape.height;
130
142
  let radius = shape.radius;
131
- const maxRadius = Math.min(width, height) / 2 | 0;
143
+ const maxRadius = (Math.min(width, height) / 2) | 0;
132
144
  radius = radius > maxRadius ? maxRadius : radius;
133
145
  context.beginPath();
134
146
  context.moveTo(rx, ry + radius);
@@ -210,7 +222,7 @@ export function renderGraphicsMask(graphics, context) {
210
222
  const width = shape.width;
211
223
  const height = shape.height;
212
224
  let radius = shape.radius;
213
- const maxRadius = Math.min(width, height) / 2 | 0;
225
+ const maxRadius = (Math.min(width, height) / 2) | 0;
214
226
  radius = radius > maxRadius ? maxRadius : radius;
215
227
  context.moveTo(rx, ry + radius);
216
228
  context.lineTo(rx, ry + height - radius);
@@ -23,7 +23,7 @@ export function pushMask(maskData, renderSession) {
23
23
  transform.c * resolution,
24
24
  transform.d * resolution,
25
25
  transform.tx * resolution,
26
- transform.ty * resolution,
26
+ transform.ty * resolution
27
27
  );
28
28
  renderGraphicsMask(maskData, context);
29
29
  context.clip();
@@ -4,13 +4,33 @@
4
4
  * @author Mat Groves http://matgroves.com/ @Doormat23
5
5
  * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
6
6
  */
7
- import { RENDER_CANVAS, SCALE_LINEAR, BLEND_NORMAL, BLEND_ADD, BLEND_MULTIPLY, BLEND_SCREEN, BLEND_OVERLAY, BLEND_DARKEN, BLEND_LIGHTEN, BLEND_COLOR_DODGE, BLEND_COLOR_BURN, BLEND_HARD_LIGHT, BLEND_SOFT_LIGHT, BLEND_DIFFERENCE, BLEND_EXCLUSION, BLEND_HUE, BLEND_SATURATION, BLEND_COLOR, BLEND_LUMINOSITY, SCALE_NEAREST } from '../../core/const';
7
+ import {
8
+ RENDER_CANVAS,
9
+ SCALE_LINEAR,
10
+ BLEND_NORMAL,
11
+ BLEND_ADD,
12
+ BLEND_MULTIPLY,
13
+ BLEND_SCREEN,
14
+ BLEND_OVERLAY,
15
+ BLEND_DARKEN,
16
+ BLEND_LIGHTEN,
17
+ BLEND_COLOR_DODGE,
18
+ BLEND_COLOR_BURN,
19
+ BLEND_HARD_LIGHT,
20
+ BLEND_SOFT_LIGHT,
21
+ BLEND_DIFFERENCE,
22
+ BLEND_EXCLUSION,
23
+ BLEND_HUE,
24
+ BLEND_SATURATION,
25
+ BLEND_COLOR,
26
+ BLEND_LUMINOSITY,
27
+ SCALE_NEAREST,
28
+ } from '../../core/const';
8
29
  import { getSmoothingPrefix } from './util';
9
30
  import { detectCapabilities } from './tinter';
10
31
  import * as CanvasMaskManager from './masker';
11
32
 
12
33
  export default class {
13
-
14
34
  constructor(game) {
15
35
  detectCapabilities();
16
36
  this.type = RENDER_CANVAS;
@@ -78,7 +98,8 @@ export default class {
78
98
  this.view.style.height = this.height / this.resolution + 'px';
79
99
  }
80
100
  if (this.renderSession.smoothProperty) {
81
- this.context[this.renderSession.smoothProperty] = (this.renderSession.scaleMode === SCALE_LINEAR);
101
+ this.context[this.renderSession.smoothProperty] =
102
+ this.renderSession.scaleMode === SCALE_LINEAR;
82
103
  }
83
104
  }
84
105
 
@@ -96,22 +117,21 @@ export default class {
96
117
  const useNew = window.PhaserRegistry.CAN_CANVAS_USE_MULTIPLY;
97
118
  b[BLEND_NORMAL] = 'source-over';
98
119
  b[BLEND_ADD] = 'lighter';
99
- b[BLEND_MULTIPLY] = (useNew) ? 'multiply' : 'source-over';
100
- b[BLEND_SCREEN] = (useNew) ? 'screen' : 'source-over';
101
- b[BLEND_OVERLAY] = (useNew) ? 'overlay' : 'source-over';
102
- b[BLEND_DARKEN] = (useNew) ? 'darken' : 'source-over';
103
- b[BLEND_LIGHTEN] = (useNew) ? 'lighten' : 'source-over';
104
- b[BLEND_COLOR_DODGE] = (useNew) ? 'color-dodge' : 'source-over';
105
- b[BLEND_COLOR_BURN] = (useNew) ? 'color-burn' : 'source-over';
106
- b[BLEND_HARD_LIGHT] = (useNew) ? 'hard-light' : 'source-over';
107
- b[BLEND_SOFT_LIGHT] = (useNew) ? 'soft-light' : 'source-over';
108
- b[BLEND_DIFFERENCE] = (useNew) ? 'difference' : 'source-over';
109
- b[BLEND_EXCLUSION] = (useNew) ? 'exclusion' : 'source-over';
110
- b[BLEND_HUE] = (useNew) ? 'hue' : 'source-over';
111
- b[BLEND_SATURATION] = (useNew) ? 'saturation' : 'source-over';
112
- b[BLEND_COLOR] = (useNew) ? 'color' : 'source-over';
113
- b[BLEND_LUMINOSITY] = (useNew) ? 'luminosity' : 'source-over';
120
+ b[BLEND_MULTIPLY] = useNew ? 'multiply' : 'source-over';
121
+ b[BLEND_SCREEN] = useNew ? 'screen' : 'source-over';
122
+ b[BLEND_OVERLAY] = useNew ? 'overlay' : 'source-over';
123
+ b[BLEND_DARKEN] = useNew ? 'darken' : 'source-over';
124
+ b[BLEND_LIGHTEN] = useNew ? 'lighten' : 'source-over';
125
+ b[BLEND_COLOR_DODGE] = useNew ? 'color-dodge' : 'source-over';
126
+ b[BLEND_COLOR_BURN] = useNew ? 'color-burn' : 'source-over';
127
+ b[BLEND_HARD_LIGHT] = useNew ? 'hard-light' : 'source-over';
128
+ b[BLEND_SOFT_LIGHT] = useNew ? 'soft-light' : 'source-over';
129
+ b[BLEND_DIFFERENCE] = useNew ? 'difference' : 'source-over';
130
+ b[BLEND_EXCLUSION] = useNew ? 'exclusion' : 'source-over';
131
+ b[BLEND_HUE] = useNew ? 'hue' : 'source-over';
132
+ b[BLEND_SATURATION] = useNew ? 'saturation' : 'source-over';
133
+ b[BLEND_COLOR] = useNew ? 'color' : 'source-over';
134
+ b[BLEND_LUMINOSITY] = useNew ? 'luminosity' : 'source-over';
114
135
  window.PhaserRegistry.blendModesCanvas = b;
115
136
  }
116
-
117
137
  }
@@ -37,9 +37,29 @@ export function tintWithMultiply(texture, color, canvas) {
37
37
  context.fillStyle = '#' + ('00000' + (color | 0).toString(16)).substr(-6);
38
38
  context.fillRect(0, 0, crop.width, crop.height);
39
39
  context.globalCompositeOperation = 'multiply';
40
- context.drawImage(texture.baseTexture.source, crop.x, crop.y, crop.width, crop.height, 0, 0, crop.width, crop.height);
40
+ context.drawImage(
41
+ texture.baseTexture.source,
42
+ crop.x,
43
+ crop.y,
44
+ crop.width,
45
+ crop.height,
46
+ 0,
47
+ 0,
48
+ crop.width,
49
+ crop.height
50
+ );
41
51
  context.globalCompositeOperation = 'destination-atop';
42
- context.drawImage(texture.baseTexture.source, crop.x, crop.y, crop.width, crop.height, 0, 0, crop.width, crop.height);
52
+ context.drawImage(
53
+ texture.baseTexture.source,
54
+ crop.x,
55
+ crop.y,
56
+ crop.width,
57
+ crop.height,
58
+ 0,
59
+ 0,
60
+ crop.width,
61
+ crop.height
62
+ );
43
63
  }
44
64
 
45
65
  /**
@@ -54,7 +74,17 @@ export function tintWithPerPixel(texture, color, canvas) {
54
74
  canvas.width = crop.width;
55
75
  canvas.height = crop.height;
56
76
  context.globalCompositeOperation = 'copy';
57
- context.drawImage(texture.baseTexture.source, crop.x, crop.y, crop.width, crop.height, 0, 0, crop.width, crop.height);
77
+ context.drawImage(
78
+ texture.baseTexture.source,
79
+ crop.x,
80
+ crop.y,
81
+ crop.width,
82
+ crop.height,
83
+ 0,
84
+ 0,
85
+ crop.width,
86
+ crop.height
87
+ );
58
88
  const rgbValues = hex2rgb(color);
59
89
  const r = rgbValues[0];
60
90
  const g = rgbValues[1];
@@ -95,7 +125,12 @@ export function checkInverseAlpha() {
95
125
  // Get those values
96
126
  const s2 = canvas.context.getImageData(1, 0, 1, 1);
97
127
  // Compare and return
98
- return (s2.data[0] === s1.data[0] && s2.data[1] === s1.data[1] && s2.data[2] === s1.data[2] && s2.data[3] === s1.data[3]);
128
+ return (
129
+ s2.data[0] === s1.data[0] &&
130
+ s2.data[1] === s1.data[1] &&
131
+ s2.data[2] === s1.data[2] &&
132
+ s2.data[3] === s1.data[3]
133
+ );
99
134
  }
100
135
 
101
136
  /**
@@ -122,7 +157,7 @@ export function canUseNewCanvasBlendModes() {
122
157
  }
123
158
  const data = context.getImageData(2, 0, 1, 1).data;
124
159
  removeByCanvas(canvas);
125
- return (data[0] === 255 && data[1] === 0 && data[2] === 0);
160
+ return data[0] === 255 && data[1] === 0 && data[2] === 0;
126
161
  }
127
162
 
128
163
  /**
@@ -139,6 +174,8 @@ export function detectCapabilities() {
139
174
  window.PhaserRegistry.CAN_CANVAS_USE_MULTIPLY = canUseNewCanvasBlendModes();
140
175
  }
141
176
  if (!window.PhaserRegistry.CANVAS_TINT_METHOD) {
142
- window.PhaserRegistry.CANVAS_TINT_METHOD = window.PhaserRegistry.CAN_CANVAS_USE_MULTIPLY ? tintWithMultiply : tintWithPerPixel;
177
+ window.PhaserRegistry.CANVAS_TINT_METHOD = window.PhaserRegistry.CAN_CANVAS_USE_MULTIPLY
178
+ ? tintWithMultiply
179
+ : tintWithPerPixel;
143
180
  }
144
181
  }
@@ -18,7 +18,7 @@ import { create as createCanvas } from './pool';
18
18
  export function create(parent, width, height, id, skipPool) {
19
19
  width = width || 256;
20
20
  height = height || 256;
21
- const canvas = (skipPool) ? document.createElement('canvas') : createCanvas(parent, width, height);
21
+ const canvas = skipPool ? document.createElement('canvas') : createCanvas(parent, width, height);
22
22
  if (typeof id === 'string' && id !== '') {
23
23
  canvas.id = id;
24
24
  }