melonjs 14.5.0 → 15.1.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 (315) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +6 -6
  3. package/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +1 -1
  4. package/dist/melonjs.mjs/_virtual/arraymultimap.js +1 -1
  5. package/dist/melonjs.mjs/_virtual/earcut.js +1 -1
  6. package/dist/melonjs.mjs/_virtual/howler.js +1 -1
  7. package/dist/melonjs.mjs/_virtual/index.js +7 -3
  8. package/dist/melonjs.mjs/_virtual/index2.js +1 -1
  9. package/dist/melonjs.mjs/_virtual/multimap.js +1 -1
  10. package/dist/melonjs.mjs/_virtual/setmultimap.js +1 -1
  11. package/dist/melonjs.mjs/application/application.js +27 -17
  12. package/dist/melonjs.mjs/application/header.js +6 -5
  13. package/dist/melonjs.mjs/application/resize.js +20 -20
  14. package/dist/melonjs.mjs/application/settings.js +1 -1
  15. package/dist/melonjs.mjs/audio/audio.js +18 -20
  16. package/dist/melonjs.mjs/camera/camera2d.js +10 -10
  17. package/dist/melonjs.mjs/const.js +1 -1
  18. package/dist/melonjs.mjs/entity/entity.js +4 -4
  19. package/dist/melonjs.mjs/geometries/ellipse.js +6 -6
  20. package/dist/melonjs.mjs/geometries/line.js +9 -9
  21. package/dist/melonjs.mjs/geometries/path2d.js +56 -56
  22. package/dist/melonjs.mjs/geometries/point.js +2 -2
  23. package/dist/melonjs.mjs/geometries/poly.js +29 -29
  24. package/dist/melonjs.mjs/geometries/rectangle.js +8 -8
  25. package/dist/melonjs.mjs/geometries/roundrect.js +6 -6
  26. package/dist/melonjs.mjs/index.js +8 -6
  27. package/dist/melonjs.mjs/input/gamepad.js +30 -30
  28. package/dist/melonjs.mjs/input/input.js +2 -2
  29. package/dist/melonjs.mjs/input/keyboard.js +15 -15
  30. package/dist/melonjs.mjs/input/pointer.js +2 -2
  31. package/dist/melonjs.mjs/input/pointerevent.js +59 -59
  32. package/dist/melonjs.mjs/lang/console.js +3 -3
  33. package/dist/melonjs.mjs/lang/deprecated.js +2 -2
  34. package/dist/melonjs.mjs/level/level.js +9 -9
  35. package/dist/melonjs.mjs/level/tiled/TMXGroup.js +3 -3
  36. package/dist/melonjs.mjs/level/tiled/TMXLayer.js +31 -31
  37. package/dist/melonjs.mjs/level/tiled/TMXObject.js +8 -8
  38. package/dist/melonjs.mjs/level/tiled/TMXTile.js +8 -8
  39. package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +19 -19
  40. package/dist/melonjs.mjs/level/tiled/TMXTileset.js +15 -15
  41. package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +3 -3
  42. package/dist/melonjs.mjs/level/tiled/TMXUtils.js +46 -41
  43. package/dist/melonjs.mjs/level/tiled/constants.js +1 -1
  44. package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +30 -30
  45. package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +21 -21
  46. package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +10 -10
  47. package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +2 -2
  48. package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +6 -6
  49. package/dist/melonjs.mjs/level/tiled/renderer/autodetect.js +1 -1
  50. package/dist/melonjs.mjs/loader/cache.js +1 -1
  51. package/dist/melonjs.mjs/loader/loader.js +7 -7
  52. package/dist/melonjs.mjs/loader/loadingscreen.js +2 -2
  53. package/dist/melonjs.mjs/loader/melonjs_logo.png.js +1 -1
  54. package/dist/melonjs.mjs/loader/parser.js +13 -13
  55. package/dist/melonjs.mjs/loader/settings.js +3 -3
  56. package/dist/melonjs.mjs/math/color.js +25 -24
  57. package/dist/melonjs.mjs/math/math.js +2 -2
  58. package/dist/melonjs.mjs/math/matrix2.js +22 -22
  59. package/dist/melonjs.mjs/math/matrix3.js +52 -52
  60. package/dist/melonjs.mjs/math/observable_vector2.js +12 -12
  61. package/dist/melonjs.mjs/math/observable_vector3.js +22 -22
  62. package/dist/melonjs.mjs/math/vector2.js +11 -11
  63. package/dist/melonjs.mjs/math/vector3.js +21 -21
  64. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/arraymultimap.js +45 -0
  65. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/multimap.js +130 -0
  66. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/arraymultimap.js +1 -1
  67. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/index.js +1 -1
  68. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/multimap.js +1 -1
  69. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/setmultimap.js +1 -1
  70. package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +1 -1
  71. package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +2 -2
  72. package/dist/melonjs.mjs/node_modules/eventemitter3/index2.js +1 -1
  73. package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +1 -1
  74. package/dist/melonjs.mjs/particles/emitter.js +5 -5
  75. package/dist/melonjs.mjs/particles/particle.js +8 -8
  76. package/dist/melonjs.mjs/particles/settings.js +3 -3
  77. package/dist/melonjs.mjs/physics/body.js +17 -17
  78. package/dist/melonjs.mjs/physics/bounds.js +12 -12
  79. package/dist/melonjs.mjs/physics/collision.js +3 -3
  80. package/dist/melonjs.mjs/physics/detector.js +14 -14
  81. package/dist/melonjs.mjs/physics/quadtree.js +19 -19
  82. package/dist/melonjs.mjs/physics/response.js +1 -1
  83. package/dist/melonjs.mjs/physics/sat.js +60 -60
  84. package/dist/melonjs.mjs/physics/world.js +4 -4
  85. package/dist/melonjs.mjs/plugin/plugin.js +11 -11
  86. package/dist/melonjs.mjs/renderable/collectable.js +2 -2
  87. package/dist/melonjs.mjs/renderable/colorlayer.js +1 -1
  88. package/dist/melonjs.mjs/renderable/container.js +77 -59
  89. package/dist/melonjs.mjs/renderable/dragndrop.js +5 -5
  90. package/dist/melonjs.mjs/renderable/imagelayer.js +7 -6
  91. package/dist/melonjs.mjs/renderable/light2d.js +6 -6
  92. package/dist/melonjs.mjs/renderable/nineslicesprite.js +12 -12
  93. package/dist/melonjs.mjs/renderable/renderable.js +35 -13
  94. package/dist/melonjs.mjs/renderable/sprite.js +25 -25
  95. package/dist/melonjs.mjs/renderable/trigger.js +11 -9
  96. package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +97 -27
  97. package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +25 -25
  98. package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +83 -65
  99. package/dist/melonjs.mjs/state/stage.js +7 -7
  100. package/dist/melonjs.mjs/state/state.js +15 -15
  101. package/dist/melonjs.mjs/system/device.js +3 -3
  102. package/dist/melonjs.mjs/system/dom.js +1 -1
  103. package/dist/melonjs.mjs/system/event.js +2 -2
  104. package/dist/melonjs.mjs/system/platform.js +1 -1
  105. package/dist/melonjs.mjs/system/pooling.js +9 -9
  106. package/dist/melonjs.mjs/system/save.js +6 -6
  107. package/dist/melonjs.mjs/system/timer.js +16 -12
  108. package/dist/melonjs.mjs/text/bitmaptext.js +20 -20
  109. package/dist/melonjs.mjs/text/bitmaptextdata.js +22 -22
  110. package/dist/melonjs.mjs/text/glyph.js +3 -3
  111. package/dist/melonjs.mjs/text/text.js +63 -92
  112. package/dist/melonjs.mjs/text/textmetrics.js +15 -15
  113. package/dist/melonjs.mjs/text/textstyle.js +4 -6
  114. package/dist/melonjs.mjs/tweens/easing.js +4 -4
  115. package/dist/melonjs.mjs/tweens/interpolation.js +8 -8
  116. package/dist/melonjs.mjs/tweens/tween.js +11 -11
  117. package/dist/melonjs.mjs/utils/agent.js +6 -6
  118. package/dist/melonjs.mjs/utils/array.js +4 -4
  119. package/dist/melonjs.mjs/utils/file.js +1 -1
  120. package/dist/melonjs.mjs/utils/function.js +5 -5
  121. package/dist/melonjs.mjs/utils/string.js +3 -3
  122. package/dist/melonjs.mjs/utils/utils.js +16 -16
  123. package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +41 -119
  124. package/dist/melonjs.mjs/video/renderer.js +70 -14
  125. package/dist/melonjs.mjs/video/texture/atlas.js +39 -45
  126. package/dist/melonjs.mjs/video/texture/cache.js +9 -10
  127. package/dist/melonjs.mjs/video/texture/canvas_texture.js +63 -3
  128. package/dist/melonjs.mjs/video/utils/autodetect.js +1 -1
  129. package/dist/melonjs.mjs/video/video.js +2 -2
  130. package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +23 -19
  131. package/dist/melonjs.mjs/video/webgl/compositors/compositor.js +80 -80
  132. package/dist/melonjs.mjs/video/webgl/compositors/primitive_compositor.js +77 -0
  133. package/dist/melonjs.mjs/video/webgl/compositors/quad_compositor.js +252 -0
  134. package/dist/melonjs.mjs/video/webgl/compositors/webgl_compositor.js +1 -1
  135. package/dist/melonjs.mjs/video/webgl/glshader.js +7 -7
  136. package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +1 -1
  137. package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +2 -2
  138. package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +1 -1
  139. package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +2 -2
  140. package/dist/melonjs.mjs/video/webgl/utils/attributes.js +2 -2
  141. package/dist/melonjs.mjs/video/webgl/utils/precision.js +1 -1
  142. package/dist/melonjs.mjs/video/webgl/utils/program.js +7 -7
  143. package/dist/melonjs.mjs/video/webgl/utils/string.js +1 -1
  144. package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +4 -4
  145. package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +188 -181
  146. package/dist/melonjs.module.js +25040 -25193
  147. package/dist/types/application/application.d.ts +11 -8
  148. package/dist/types/audio/audio.d.ts +3 -3
  149. package/dist/types/entity/entity.d.ts +1 -1
  150. package/dist/types/index.d.ts +7 -4
  151. package/dist/types/input/input.d.ts +1 -1
  152. package/dist/types/input/keyboard.d.ts +1 -1
  153. package/dist/types/input/pointerevent.d.ts +6 -6
  154. package/dist/types/level/level.d.ts +2 -2
  155. package/dist/types/level/tiled/TMXLayer.d.ts +4 -4
  156. package/dist/types/level/tiled/TMXTileMap.d.ts +2 -2
  157. package/dist/types/level/tiled/TMXUtils.d.ts +5 -4
  158. package/dist/types/loader/loader.d.ts +2 -2
  159. package/dist/types/loader/settings.d.ts +2 -2
  160. package/dist/types/particles/emitter.d.ts +1 -1
  161. package/dist/types/physics/collision.d.ts +1 -1
  162. package/dist/types/physics/detector.d.ts +1 -1
  163. package/dist/types/plugin/plugin.d.ts +2 -2
  164. package/dist/types/renderable/container.d.ts +21 -17
  165. package/dist/types/renderable/renderable.d.ts +6 -0
  166. package/dist/types/renderable/sprite.d.ts +11 -11
  167. package/dist/types/renderable/trigger.d.ts +1 -1
  168. package/dist/types/renderable/ui/uibaseelement.d.ts +28 -6
  169. package/dist/types/renderable/ui/uispriteelement.d.ts +12 -14
  170. package/dist/types/renderable/ui/uitextbutton.d.ts +52 -12
  171. package/dist/types/state/stage.d.ts +1 -1
  172. package/dist/types/system/device.d.ts +1 -1
  173. package/dist/types/system/pooling.d.ts +3 -3
  174. package/dist/types/system/timer.d.ts +5 -5
  175. package/dist/types/text/bitmaptext.d.ts +1 -1
  176. package/dist/types/text/text.d.ts +7 -21
  177. package/dist/types/text/textstyle.d.ts +1 -1
  178. package/dist/types/utils/array.d.ts +2 -2
  179. package/dist/types/video/canvas/canvas_renderer.d.ts +8 -81
  180. package/dist/types/video/renderer.d.ts +48 -4
  181. package/dist/types/video/texture/atlas.d.ts +3 -3
  182. package/dist/types/video/texture/canvas_texture.d.ts +40 -0
  183. package/dist/types/video/webgl/buffer/vertex.d.ts +3 -3
  184. package/dist/types/video/webgl/compositors/compositor.d.ts +38 -32
  185. package/dist/types/video/webgl/compositors/primitive_compositor.d.ts +22 -0
  186. package/dist/types/video/webgl/compositors/quad_compositor.d.ts +72 -0
  187. package/dist/types/video/webgl/glshader.d.ts +1 -1
  188. package/dist/types/video/webgl/webgl_renderer.d.ts +47 -37
  189. package/package.json +16 -17
  190. package/src/application/application.js +26 -16
  191. package/src/application/header.js +5 -4
  192. package/src/application/resize.js +19 -19
  193. package/src/audio/audio.js +17 -19
  194. package/src/camera/camera2d.js +9 -9
  195. package/src/entity/entity.js +3 -3
  196. package/src/geometries/ellipse.js +5 -5
  197. package/src/geometries/line.js +8 -8
  198. package/src/geometries/path2d.js +55 -55
  199. package/src/geometries/point.js +1 -1
  200. package/src/geometries/poly.js +28 -28
  201. package/src/geometries/rectangle.js +7 -7
  202. package/src/geometries/roundrect.js +5 -5
  203. package/src/index.js +9 -4
  204. package/src/input/gamepad.js +29 -29
  205. package/src/input/input.js +1 -1
  206. package/src/input/keyboard.js +14 -14
  207. package/src/input/pointer.js +1 -1
  208. package/src/input/pointerevent.js +52 -52
  209. package/src/lang/console.js +2 -2
  210. package/src/lang/deprecated.js +1 -1
  211. package/src/level/level.js +8 -8
  212. package/src/level/tiled/TMXGroup.js +2 -2
  213. package/src/level/tiled/TMXLayer.js +30 -30
  214. package/src/level/tiled/TMXObject.js +7 -7
  215. package/src/level/tiled/TMXTile.js +7 -7
  216. package/src/level/tiled/TMXTileMap.js +18 -18
  217. package/src/level/tiled/TMXTileset.js +14 -14
  218. package/src/level/tiled/TMXTilesetGroup.js +2 -2
  219. package/src/level/tiled/TMXUtils.js +45 -40
  220. package/src/level/tiled/renderer/TMXHexagonalRenderer.js +29 -29
  221. package/src/level/tiled/renderer/TMXIsometricRenderer.js +20 -20
  222. package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +9 -9
  223. package/src/level/tiled/renderer/TMXRenderer.js +1 -1
  224. package/src/level/tiled/renderer/TMXStaggeredRenderer.js +5 -5
  225. package/src/loader/loader.js +6 -6
  226. package/src/loader/loadingscreen.js +1 -1
  227. package/src/loader/parser.js +12 -12
  228. package/src/loader/settings.js +2 -2
  229. package/src/math/color.js +24 -23
  230. package/src/math/math.js +1 -1
  231. package/src/math/matrix2.js +21 -21
  232. package/src/math/matrix3.js +51 -51
  233. package/src/math/observable_vector2.js +11 -11
  234. package/src/math/observable_vector3.js +21 -21
  235. package/src/math/vector2.js +10 -10
  236. package/src/math/vector3.js +20 -20
  237. package/src/particles/emitter.js +4 -4
  238. package/src/particles/particle.js +7 -7
  239. package/src/particles/settings.js +2 -2
  240. package/src/physics/body.js +16 -16
  241. package/src/physics/bounds.js +11 -11
  242. package/src/physics/collision.js +2 -2
  243. package/src/physics/detector.js +13 -13
  244. package/src/physics/quadtree.js +18 -18
  245. package/src/physics/sat.js +59 -59
  246. package/src/physics/world.js +3 -3
  247. package/src/plugin/plugin.js +8 -8
  248. package/src/polyfill/index.js +0 -2
  249. package/src/renderable/collectable.js +1 -1
  250. package/src/renderable/container.js +76 -58
  251. package/src/renderable/dragndrop.js +4 -4
  252. package/src/renderable/imagelayer.js +6 -5
  253. package/src/renderable/light2d.js +5 -5
  254. package/src/renderable/nineslicesprite.js +11 -11
  255. package/src/renderable/renderable.js +34 -12
  256. package/src/renderable/sprite.js +24 -24
  257. package/src/renderable/trigger.js +10 -8
  258. package/src/renderable/ui/uibaseelement.js +96 -26
  259. package/src/renderable/ui/uispriteelement.js +24 -24
  260. package/src/renderable/ui/uitextbutton.js +85 -67
  261. package/src/state/stage.js +6 -6
  262. package/src/state/state.js +14 -14
  263. package/src/system/device.js +2 -2
  264. package/src/system/event.js +1 -1
  265. package/src/system/pooling.js +8 -8
  266. package/src/system/save.js +5 -5
  267. package/src/system/timer.js +15 -11
  268. package/src/text/bitmaptext.js +19 -19
  269. package/src/text/bitmaptextdata.js +21 -21
  270. package/src/text/glyph.js +2 -2
  271. package/src/text/text.js +62 -91
  272. package/src/text/textmetrics.js +14 -14
  273. package/src/text/textstyle.js +3 -5
  274. package/src/tweens/easing.js +3 -3
  275. package/src/tweens/interpolation.js +7 -7
  276. package/src/tweens/tween.js +10 -10
  277. package/src/utils/agent.js +5 -5
  278. package/src/utils/array.js +3 -3
  279. package/src/utils/function.js +4 -4
  280. package/src/utils/string.js +2 -2
  281. package/src/utils/utils.js +15 -15
  282. package/src/video/canvas/canvas_renderer.js +39 -117
  283. package/src/video/renderer.js +68 -12
  284. package/src/video/texture/atlas.js +38 -44
  285. package/src/video/texture/cache.js +6 -6
  286. package/src/video/texture/canvas_texture.js +62 -2
  287. package/src/video/video.js +1 -1
  288. package/src/video/webgl/buffer/vertex.js +22 -18
  289. package/src/video/webgl/compositors/compositor.js +79 -80
  290. package/src/video/webgl/compositors/primitive_compositor.js +68 -0
  291. package/src/video/webgl/compositors/{webgl_compositor.js → quad_compositor.js} +52 -109
  292. package/src/video/webgl/glshader.js +6 -6
  293. package/src/video/webgl/shaders/primitive.vert +2 -5
  294. package/src/video/webgl/shaders/quad.vert +3 -1
  295. package/src/video/webgl/utils/attributes.js +1 -1
  296. package/src/video/webgl/utils/program.js +6 -6
  297. package/src/video/webgl/utils/uniforms.js +3 -3
  298. package/src/video/webgl/webgl_renderer.js +186 -179
  299. package/dist/melonjs.mjs/_virtual/make-built-in.js +0 -10
  300. package/dist/melonjs.mjs/_virtual/object-define-property.js +0 -10
  301. package/dist/melonjs.mjs/_virtual/object-get-own-property-descriptor.js +0 -10
  302. package/dist/melonjs.mjs/_virtual/object-get-own-property-names.js +0 -10
  303. package/dist/melonjs.mjs/_virtual/object-get-own-property-symbols.js +0 -10
  304. package/dist/melonjs.mjs/_virtual/object-property-is-enumerable.js +0 -10
  305. package/dist/melonjs.mjs/_virtual/shared.js +0 -10
  306. package/dist/melonjs.mjs/game.js +0 -29
  307. package/dist/melonjs.mjs/polyfill/console.js +0 -18
  308. package/dist/melonjs.mjs/polyfill/performance.js +0 -27
  309. package/dist/melonjs.mjs/polyfill/requestAnimationFrame.js +0 -46
  310. package/dist/melonjs.mjs/polyfill/roundrect.js +0 -242
  311. package/dist/melonjs.mjs/renderable/re_container.js +0 -1016
  312. package/dist/melonjs.mjs/video/utils/resize.js +0 -116
  313. package/dist/melonjs.mjs/video/webgl/webgl_compositor.js +0 -494
  314. package/src/polyfill/performance.js +0 -20
  315. package/src/polyfill/requestAnimationFrame.js +0 -39
@@ -8,7 +8,7 @@ const capChars = ["M", "N", "B", "D", "C", "E", "F", "K", "A", "G", "H", "I", "J
8
8
  * @ignore
9
9
  */
10
10
  function getValueFromPair(string, pattern) {
11
- var value = string.match(pattern);
11
+ let value = string.match(pattern);
12
12
  if (!value) {
13
13
  throw new Error("Could not find pattern " + pattern + " in string: " + string);
14
14
  }
@@ -25,8 +25,8 @@ function getValueFromPair(string, pattern) {
25
25
  * @returns {Glyph}
26
26
  */
27
27
  function getFirstGlyph(glyphs) {
28
- var keys = Object.keys(glyphs);
29
- for (var i = 0; i < keys.length; i++) {
28
+ let keys = Object.keys(glyphs);
29
+ for (let i = 0; i < keys.length; i++) {
30
30
  if (keys[i] > 32) {
31
31
  return glyphs[keys[i]];
32
32
  }
@@ -42,8 +42,8 @@ function getFirstGlyph(glyphs) {
42
42
  * @param {object} glyphs - the map of glyphs, each key is a char code
43
43
  */
44
44
  function createSpaceGlyph(glyphs) {
45
- var spaceCharCode = " ".charCodeAt(0);
46
- var glyph = glyphs[spaceCharCode];
45
+ let spaceCharCode = " ".charCodeAt(0);
46
+ let glyph = glyphs[spaceCharCode];
47
47
  if (!glyph) {
48
48
  glyph = new Glyph();
49
49
  glyph.id = spaceCharCode;
@@ -102,12 +102,12 @@ function createSpaceGlyph(glyphs) {
102
102
  if (!fontData) {
103
103
  throw new Error("File containing font data was empty, cannot load the bitmap font.");
104
104
  }
105
- var lines = fontData.split(/\r\n|\n/);
106
- var padding = fontData.match(/padding\=\d+,\d+,\d+,\d+/g);
105
+ let lines = fontData.split(/\r\n|\n/);
106
+ let padding = fontData.match(/padding\=\d+,\d+,\d+,\d+/g);
107
107
  if (!padding) {
108
108
  throw new Error("Padding not found in first line");
109
109
  }
110
- var paddingValues = padding[0].split("=")[1].split(",");
110
+ let paddingValues = padding[0].split("=")[1].split(",");
111
111
  this.padTop = parseFloat(paddingValues[0]);
112
112
  this.padLeft = parseFloat(paddingValues[1]);
113
113
  this.padBottom = parseFloat(paddingValues[2]);
@@ -115,24 +115,24 @@ function createSpaceGlyph(glyphs) {
115
115
 
116
116
  this.lineHeight = parseFloat(getValueFromPair(lines[1], /lineHeight\=\d+/g));
117
117
 
118
- var baseLine = parseFloat(getValueFromPair(lines[1], /base\=\d+/g));
118
+ let baseLine = parseFloat(getValueFromPair(lines[1], /base\=\d+/g));
119
119
 
120
- var padY = this.padTop + this.padBottom;
120
+ let padY = this.padTop + this.padBottom;
121
121
 
122
- var glyph = null;
122
+ let glyph = null;
123
123
 
124
- var i;
124
+ let i;
125
125
 
126
126
  for (i = 4; i < lines.length; i++) {
127
- var line = lines[i];
128
- var characterValues = line.split(/=|\s+/);
127
+ let line = lines[i];
128
+ let characterValues = line.split(/=|\s+/);
129
129
  if (!line || /^kernings/.test(line)) {
130
130
  continue;
131
131
  }
132
132
  if (/^kerning\s/.test(line)) {
133
- var first = parseFloat(characterValues[2]);
134
- var second = parseFloat(characterValues[4]);
135
- var amount = parseFloat(characterValues[6]);
133
+ let first = parseFloat(characterValues[2]);
134
+ let second = parseFloat(characterValues[4]);
135
+ let amount = parseFloat(characterValues[6]);
136
136
 
137
137
  glyph = this.glyphs[first];
138
138
  if (glyph !== null && typeof glyph !== "undefined") {
@@ -141,7 +141,7 @@ function createSpaceGlyph(glyphs) {
141
141
  } else {
142
142
  glyph = new Glyph();
143
143
 
144
- var ch = parseFloat(characterValues[2]);
144
+ let ch = parseFloat(characterValues[2]);
145
145
  glyph.id = ch;
146
146
  glyph.x = parseFloat(characterValues[4]);
147
147
  glyph.y = parseFloat(characterValues[6]);
@@ -163,16 +163,16 @@ function createSpaceGlyph(glyphs) {
163
163
 
164
164
  createSpaceGlyph(this.glyphs);
165
165
 
166
- var capGlyph = null;
166
+ let capGlyph = null;
167
167
  for (i = 0; i < capChars.length; i++) {
168
- var capChar = capChars[i];
168
+ let capChar = capChars[i];
169
169
  capGlyph = this.glyphs[capChar.charCodeAt(0)];
170
170
  if (capGlyph) {
171
171
  break;
172
172
  }
173
173
  }
174
174
  if (!capGlyph) {
175
- for (var charCode in this.glyphs) {
175
+ for (let charCode in this.glyphs) {
176
176
  if (this.glyphs.hasOwnProperty(charCode)) {
177
177
  glyph = this.glyphs[charCode];
178
178
  if (glyph.height === 0 || glyph.width === 0) {
package/src/text/glyph.js CHANGED
@@ -32,7 +32,7 @@ const PAGE_SIZE = 1 << LOG2_PAGE_SIZE;
32
32
  */
33
33
  getKerning(ch) {
34
34
  if (this.kerning) {
35
- var page = this.kerning[ch >>> LOG2_PAGE_SIZE];
35
+ let page = this.kerning[ch >>> LOG2_PAGE_SIZE];
36
36
  if (page) {
37
37
  return page[ch & PAGE_SIZE - 1] || 0;
38
38
  }
@@ -47,7 +47,7 @@ const PAGE_SIZE = 1 << LOG2_PAGE_SIZE;
47
47
  if (!this.kerning) {
48
48
  this.kerning = {};
49
49
  }
50
- var page = this.kerning[ch >>> LOG2_PAGE_SIZE];
50
+ let page = this.kerning[ch >>> LOG2_PAGE_SIZE];
51
51
  if (typeof page === "undefined") {
52
52
  this.kerning[ch >>> LOG2_PAGE_SIZE] = {};
53
53
  page = this.kerning[ch >>> LOG2_PAGE_SIZE];
package/src/text/text.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import Color from "./../math/color.js";
2
- import WebGLRenderer from "./../video/webgl/webgl_renderer.js";
3
2
  import { renderer as globalRenderer } from "./../video/video.js";
4
3
  import pool from "./../system/pooling.js";
5
4
  import Renderable from "./../renderable/renderable.js";
@@ -19,18 +18,6 @@ import TextMetrics from "./textmetrics.js";
19
18
  const runits = ["ex", "em", "pt", "px"];
20
19
  const toPX = [12, 24, 0.75, 1];
21
20
 
22
- // return a valid 2d context for Text rendering/styling
23
- var getContext2d = function (renderer, text) {
24
- if (text.offScreenCanvas === true) {
25
- return text.canvasTexture.context;
26
- } else {
27
- if (typeof renderer === "undefined") {
28
- renderer = globalRenderer;
29
- }
30
- return renderer.getFontContext();
31
- }
32
- };
33
-
34
21
  /**
35
22
  * @classdesc
36
23
  * a generic system font object.
@@ -45,16 +32,15 @@ var getContext2d = function (renderer, text) {
45
32
  * @param {number|string} settings.size - size, or size + suffix (px, em, pt)
46
33
  * @param {Color|string} [settings.fillStyle="#000000"] - a CSS color value
47
34
  * @param {Color|string} [settings.strokeStyle="#000000"] - a CSS color value
48
- * @param {number} [settings.lineWidth=1] - line width, in pixels, when drawing stroke
35
+ * @param {number} [settings.lineWidth=0] - line width, in pixels, when drawing stroke
49
36
  * @param {string} [settings.textAlign="left"] - horizontal text alignment
50
37
  * @param {string} [settings.textBaseline="top"] - the text baseline
51
38
  * @param {number} [settings.lineHeight=1.0] - line spacing height
52
39
  * @param {Vector2d} [settings.anchorPoint={x:0.0, y:0.0}] - anchor point to draw the text at
53
- * @param {boolean} [settings.offScreenCanvas=false] - whether to draw the font to an individual "cache" texture first
54
40
  * @param {number} [settings.wordWrapWidth] - the maximum length in CSS pixel for a single segment of text
55
41
  * @param {(string|string[])} [settings.text=""] - a string, or an array of strings
56
42
  * @example
57
- * var font = new me.Text(0, 0, {font: "Arial", size: 8, fillStyle: this.color});
43
+ * let font = new me.Text(0, 0, {font: "Arial", size: 8, fillStyle: this.color});
58
44
  */
59
45
  constructor(x, y, settings) {
60
46
  // call the parent constructor
@@ -105,9 +91,9 @@ var getContext2d = function (renderer, text) {
105
91
  * sets the current line width, in pixels, when drawing stroke
106
92
  * @public
107
93
  * @type {number}
108
- * @default 1
94
+ * @default 0
109
95
  */
110
- this.lineWidth = settings.lineWidth || 1;
96
+ this.lineWidth = settings.lineWidth || 0;
111
97
 
112
98
  /**
113
99
  * Set the default text alignment (or justification),<br>
@@ -136,16 +122,6 @@ var getContext2d = function (renderer, text) {
136
122
  */
137
123
  this.lineHeight = settings.lineHeight || 1.0;
138
124
 
139
- /**
140
- * whether to draw the font to a indidividual offscreen canvas texture first <br>
141
- * Note: this will improve performances when using WebGL, but will impact
142
- * memory consumption as every text element will have its own canvas texture
143
- * @public
144
- * @type {boolean}
145
- * @default false
146
- */
147
- this.offScreenCanvas = false;
148
-
149
125
  /**
150
126
  * the maximum length in CSS pixel for a single segment of text.
151
127
  * (use -1 to disable word wrapping)
@@ -192,10 +168,9 @@ var getContext2d = function (renderer, text) {
192
168
  this.italic();
193
169
  }
194
170
 
195
- if (settings.offScreenCanvas === true) {
196
- this.offScreenCanvas = true;
197
- this.canvasTexture = pool.pull("CanvasTexture", 2, 2, { offscreenCanvas: true });
198
- }
171
+ // the canvas Texture used to render this text
172
+ // XXX: offscreenCanvas is currently disabled for text rendering due to issue in WebGL mode
173
+ this.canvasTexture = pool.pull("CanvasTexture", 2, 2, { offscreenCanvas: false });
199
174
 
200
175
  // instance to text metrics functions
201
176
  this.metrics = new TextMetrics(this);
@@ -235,7 +210,7 @@ var getContext2d = function (renderer, text) {
235
210
  */
236
211
  setFont(font, size = 10) {
237
212
  // font name and type
238
- var font_names = font.split(",").map((value) => {
213
+ let font_names = font.split(",").map((value) => {
239
214
  value = value.trim();
240
215
  return (
241
216
  !/(^".*"$)|(^'.*'$)/.test(value)
@@ -248,7 +223,7 @@ var getContext2d = function (renderer, text) {
248
223
  size += "px";
249
224
  } else /* string */ {
250
225
  // extract the units and convert if necessary
251
- var CSSval = size.match(/([-+]?[\d.]*)(.*)/);
226
+ let CSSval = size.match(/([-+]?[\d.]*)(.*)/);
252
227
  this.fontSize = parseFloat(CSSval[1]);
253
228
  if (CSSval[2]) {
254
229
  this.fontSize *= toPX[runits.indexOf(CSSval[2])];
@@ -271,7 +246,7 @@ var getContext2d = function (renderer, text) {
271
246
  * @returns {Text} this object for chaining
272
247
  */
273
248
  setText(value = "") {
274
- var bounds = this.getBounds();
249
+ let bounds = this.getBounds();
275
250
 
276
251
  // set the next text
277
252
  if (this._text.toString() !== value.toString()) {
@@ -284,38 +259,38 @@ var getContext2d = function (renderer, text) {
284
259
 
285
260
  // word wrap if necessary
286
261
  if (this._text.length > 0 && this.wordWrapWidth > 0) {
287
- this._text = this.metrics.wordWrap(this._text, this.wordWrapWidth, getContext2d(globalRenderer, this));
262
+ this._text = this.metrics.wordWrap(this._text, this.wordWrapWidth, this.canvasTexture.context);
288
263
  }
289
264
 
290
265
  // calculcate the text size and update the bounds accordingly
291
- bounds.addBounds(this.metrics.measureText(this._text, getContext2d(globalRenderer, this)), true);
266
+ bounds.addBounds(this.metrics.measureText(this._text, this.canvasTexture.context), true);
292
267
 
293
268
  // update the offScreenCanvas texture if required
294
- if (this.offScreenCanvas === true) {
295
- var width = Math.ceil(this.metrics.width),
296
- height = Math.ceil(this.metrics.height);
297
-
298
- if (globalRenderer instanceof WebGLRenderer) {
299
- // invalidate the previous corresponding texture so that it can reuploaded once changed
300
- this.glTextureUnit = globalRenderer.cache.getUnit(globalRenderer.cache.get(this.canvasTexture.canvas));
301
- globalRenderer.currentCompositor.unbindTexture2D(null, this.glTextureUnit);
302
-
303
- if (globalRenderer.WebGLVersion === 1) {
304
- // round size to next Pow2
305
- width = nextPowerOfTwo(this.metrics.width);
306
- height = nextPowerOfTwo(this.metrics.height);
307
- }
308
- }
309
-
310
- // resize the cache canvas if necessary
311
- if (this.canvasTexture.width < width || this.canvasTexture.height < height) {
312
- this.canvasTexture.resize(width, height);
269
+ let width = Math.ceil(this.metrics.width),
270
+ height = Math.ceil(this.metrics.height);
271
+
272
+ if (typeof globalRenderer.gl !== "undefined") {
273
+ // make sure the right compositor is active
274
+ globalRenderer.setCompositor("quad");
275
+ // invalidate the previous corresponding texture so that it can reuploaded once changed
276
+ this.glTextureUnit = globalRenderer.cache.getUnit(globalRenderer.cache.get(this.canvasTexture.canvas));
277
+ globalRenderer.currentCompositor.unbindTexture2D(null, this.glTextureUnit);
278
+
279
+ if (globalRenderer.WebGLVersion === 1) {
280
+ // round size to next Pow2
281
+ width = nextPowerOfTwo(this.metrics.width);
282
+ height = nextPowerOfTwo(this.metrics.height);
313
283
  }
284
+ }
314
285
 
315
- this.canvasTexture.clear();
316
- this._drawFont(this.canvasTexture.context, this._text, this.pos.x - this.metrics.x, this.pos.y - this.metrics.y, false);
286
+ // resize the cache canvas if necessary
287
+ if (this.canvasTexture.width < width || this.canvasTexture.height < height) {
288
+ this.canvasTexture.resize(width, height);
317
289
  }
318
290
 
291
+ this.canvasTexture.clear();
292
+ this._drawFont(this.canvasTexture.context, this._text, this.pos.x - this.metrics.x, this.pos.y - this.metrics.y);
293
+
319
294
  this.isDirty = true;
320
295
 
321
296
  return this;
@@ -328,7 +303,7 @@ var getContext2d = function (renderer, text) {
328
303
  * @returns {TextMetrics} a TextMetrics object defining the dimensions of the given piece of text
329
304
  */
330
305
  measureText(renderer, text = this._text) {
331
- return this.metrics.measureText(text, getContext2d(renderer, this));
306
+ return this.metrics.measureText(text, this.canvasTexture.context);
332
307
  }
333
308
 
334
309
 
@@ -338,9 +313,8 @@ var getContext2d = function (renderer, text) {
338
313
  * @param {string} [text]
339
314
  * @param {number} [x]
340
315
  * @param {number} [y]
341
- * @param {boolean} [stroke=false] - draw stroke the the text if true
342
316
  */
343
- draw(renderer, text, x = this.pos.x, y = this.pos.y, stroke = false) {
317
+ draw(renderer, text, x = this.pos.x, y = this.pos.y) {
344
318
  // "hacky patch" for backward compatibilty
345
319
  if (typeof this.ancestor === "undefined") {
346
320
 
@@ -354,21 +328,18 @@ var getContext2d = function (renderer, text) {
354
328
  // update text cache
355
329
  this.setText(text);
356
330
 
357
- x = this.metrics.x;
358
- y = this.metrics.y;
359
-
360
331
  // save the previous context
361
332
  renderer.save();
362
333
 
363
334
  // apply the defined alpha value
364
335
  renderer.setGlobalAlpha(renderer.globalAlpha() * this.getOpacity());
365
336
 
366
- } else {
367
- // added directly to an object container
368
- x = this.pos.x;
369
- y = this.pos.y;
370
337
  }
371
338
 
339
+ // adjust x,y position based on the bounding box
340
+ x = this.metrics.x;
341
+ y = this.metrics.y;
342
+
372
343
  // clamp to pixel grid if required
373
344
  if (renderer.settings.subPixel === false) {
374
345
  x = ~~x;
@@ -376,12 +347,7 @@ var getContext2d = function (renderer, text) {
376
347
  }
377
348
 
378
349
  // draw the text
379
- if (this.offScreenCanvas === true) {
380
- renderer.drawImage(this.canvasTexture.canvas, x, y);
381
- } else {
382
- renderer.drawFont(this._drawFont(renderer.getFontContext(), this._text, x, y, stroke));
383
- }
384
-
350
+ renderer.drawImage(this.canvasTexture.canvas, x, y);
385
351
 
386
352
  // for backward compatibilty
387
353
  if (typeof this.ancestor === "undefined") {
@@ -391,28 +357,33 @@ var getContext2d = function (renderer, text) {
391
357
  }
392
358
 
393
359
  /**
394
- * draw a stroke text at the specified coord, as defined <br>
395
- * by the `lineWidth` and `fillStroke` properties. <br>
396
- * Note : using drawStroke is not recommended for performance reasons
360
+ * draw a stroke text at the specified coord, as defined by the `lineWidth` and `fillStroke` properties.
361
+ * @deprecated since 15.0.0
397
362
  * @param {CanvasRenderer|WebGLRenderer} renderer - Reference to the destination renderer instance
398
363
  * @param {string} text
399
364
  * @param {number} x
400
365
  * @param {number} y
401
366
  */
402
367
  drawStroke(renderer, text, x, y) {
403
- this.draw(renderer, text, x, y, true);
368
+ this.draw(renderer, text, x, y);
404
369
  }
405
370
 
406
371
  /**
407
372
  * @ignore
408
373
  */
409
- _drawFont(context, text, x, y, stroke = false) {
410
- setContextStyle(context, this, stroke);
374
+ _drawFont(context, text, x, y) {
375
+ setContextStyle(context, this);
411
376
 
412
- for (var i = 0; i < text.length; i++) {
413
- var string = text[i].trimEnd();
377
+ for (let i = 0; i < text.length; i++) {
378
+ let string = text[i].trimEnd();
414
379
  // draw the string
415
- context[stroke ? "strokeText" : "fillText"](string, x, y);
380
+ if (this.fillStyle.alpha > 0) {
381
+ context.fillText(string, x, y);
382
+ }
383
+ // stroke the text
384
+ if (this.lineWidth > 0 && this.strokeStyle.alpha > 0) {
385
+ context.strokeText(string, x, y);
386
+ }
416
387
  // add leading space
417
388
  y += this.metrics.lineHeight();
418
389
  }
@@ -424,15 +395,15 @@ var getContext2d = function (renderer, text) {
424
395
  * @ignore
425
396
  */
426
397
  destroy() {
427
- if (this.offScreenCanvas === true) {
428
- if (globalRenderer instanceof WebGLRenderer) {
429
- globalRenderer.currentCompositor.deleteTexture2D(globalRenderer.currentCompositor.getTexture2D(this.glTextureUnit));
430
- this.glTextureUnit = undefined;
431
- }
432
- globalRenderer.cache.delete(this.canvasTexture.canvas);
433
- pool.push(this.canvasTexture);
434
- this.canvasTexture = undefined;
398
+ if (typeof globalRenderer.gl !== "undefined") {
399
+ // make sure the right compositor is active
400
+ globalRenderer.setCompositor("quad");
401
+ globalRenderer.currentCompositor.deleteTexture2D(globalRenderer.currentCompositor.getTexture2D(this.glTextureUnit));
402
+ this.glTextureUnit = undefined;
435
403
  }
404
+ globalRenderer.cache.delete(this.canvasTexture.canvas);
405
+ pool.push(this.canvasTexture);
406
+ this.canvasTexture = undefined;
436
407
  pool.push(this.fillStyle);
437
408
  pool.push(this.strokeStyle);
438
409
  this.fillStyle = this.strokeStyle = undefined;
@@ -50,14 +50,14 @@ import setContextStyle from "./textstyle.js";
50
50
  if (this.ancestor instanceof Text) {
51
51
  return context.measureText(text).width;
52
52
  } else { // it's a BitmapText
53
- var characters = text.split("");
54
- var width = 0;
55
- var lastGlyph = null;
56
- for (var i = 0; i < characters.length; i++) {
57
- var ch = characters[i].charCodeAt(0);
58
- var glyph = this.ancestor.fontData.glyphs[ch];
53
+ let characters = text.split("");
54
+ let width = 0;
55
+ let lastGlyph = null;
56
+ for (let i = 0; i < characters.length; i++) {
57
+ let ch = characters[i].charCodeAt(0);
58
+ let glyph = this.ancestor.fontData.glyphs[ch];
59
59
  if (typeof glyph !== "undefined") {
60
- var kerning = (lastGlyph && lastGlyph.kerning) ? lastGlyph.getKerning(ch) : 0;
60
+ let kerning = (lastGlyph && lastGlyph.kerning) ? lastGlyph.getKerning(ch) : 0;
61
61
  width += (glyph.xadvance + kerning) * this.ancestor.fontScale.x;
62
62
  lastGlyph = glyph;
63
63
  }
@@ -73,7 +73,7 @@ import setContextStyle from "./textstyle.js";
73
73
  * @returns {TextMetrics} this
74
74
  */
75
75
  measureText(text, context) {
76
- var strings;
76
+ let strings;
77
77
 
78
78
  if (!Array.isArray(text)) {
79
79
  strings = ("" + text).split("\n");
@@ -92,7 +92,7 @@ import setContextStyle from "./textstyle.js";
92
92
  // compute the bounding box size
93
93
  this.width = this.height = 0;
94
94
 
95
- for (var i = 0; i < strings.length; i++) {
95
+ for (let i = 0; i < strings.length; i++) {
96
96
  this.width = Math.max(this.lineWidth(strings[i].trimEnd(), context), this.width);
97
97
  this.height += this.lineHeight();
98
98
  }
@@ -123,9 +123,9 @@ import setContextStyle from "./textstyle.js";
123
123
  * @returns {string[]} an array of string representing wrapped text
124
124
  */
125
125
  wordWrap(text, width, context) {
126
- var words;
127
- var currentLine = "";
128
- var output = [];
126
+ let words;
127
+ let currentLine = "";
128
+ let output = [];
129
129
 
130
130
  if (Array.isArray(text)) {
131
131
  // join into a single string
@@ -143,8 +143,8 @@ import setContextStyle from "./textstyle.js";
143
143
  }
144
144
 
145
145
  for (let i = 0; i < words.length; i++) {
146
- var word = words[i];
147
- var lineWidth = this.lineWidth(currentLine + word + " ", context);
146
+ let word = words[i];
147
+ let lineWidth = this.lineWidth(currentLine + word + " ", context);
148
148
  if (lineWidth < width) {
149
149
  // add the word to the current line
150
150
  currentLine += word + " ";
@@ -2,13 +2,11 @@
2
2
  * apply the current text style to the given context
3
3
  * @ignore
4
4
  */
5
- export default function setContextStyle(context, style, stroke = false) {
5
+ export default function setContextStyle(context, style) {
6
6
  context.font = style.font;
7
7
  context.fillStyle = style.fillStyle.toRGBA();
8
- if (stroke === true) {
9
- context.strokeStyle = style.strokeStyle.toRGBA();
10
- context.lineWidth = style.lineWidth;
11
- }
8
+ context.strokeStyle = style.strokeStyle.toRGBA();
9
+ context.lineWidth = style.lineWidth;
12
10
  context.textAlign = style.textAlign;
13
11
  context.textBaseline = style.textBaseline;
14
12
  }
@@ -263,21 +263,21 @@ export let Easing = {
263
263
  /** @ignore */
264
264
  In: function ( k ) {
265
265
 
266
- var s = 1.70158;
266
+ const s = 1.70158;
267
267
  return k * k * ( ( s + 1 ) * k - s );
268
268
 
269
269
  },
270
270
  /** @ignore */
271
271
  Out: function ( k ) {
272
272
 
273
- var s = 1.70158;
273
+ const s = 1.70158;
274
274
  return --k * k * ( ( s + 1 ) * k + s ) + 1;
275
275
 
276
276
  },
277
277
  /** @ignore */
278
278
  InOut: function ( k ) {
279
279
 
280
- var s = 1.70158 * 1.525;
280
+ const s = 1.70158 * 1.525;
281
281
  if ( ( k *= 2 ) < 1 ) return 0.5 * ( k * k * ( ( s + 1 ) * k - s ) );
282
282
  return 0.5 * ( ( k -= 2 ) * k * ( ( s + 1 ) * k + s ) + 2 );
283
283
 
@@ -20,7 +20,7 @@ export let Interpolation = {
20
20
  /** @ignore */
21
21
  Linear: function ( v, k ) {
22
22
 
23
- var m = v.length - 1, f = m * k, i = Math.floor( f ), fn = Interpolation.Utils.Linear;
23
+ let m = v.length - 1, f = m * k, i = Math.floor( f ), fn = Interpolation.Utils.Linear;
24
24
 
25
25
  if ( k < 0 ) return fn( v[ 0 ], v[ 1 ], f );
26
26
  if ( k > 1 ) return fn( v[ m ], v[ m - 1 ], m - f );
@@ -31,7 +31,7 @@ export let Interpolation = {
31
31
  /** @ignore */
32
32
  Bezier: function ( v, k ) {
33
33
 
34
- var b = 0, n = v.length - 1, pw = Math.pow, bn = Interpolation.Utils.Bernstein, i;
34
+ let b = 0, n = v.length - 1, pw = Math.pow, bn = Interpolation.Utils.Bernstein, i;
35
35
 
36
36
  for ( i = 0; i <= n; i++ ) {
37
37
  b += pw( 1 - k, n - i ) * pw( k, i ) * v[ i ] * bn( n, i );
@@ -43,7 +43,7 @@ export let Interpolation = {
43
43
  /** @ignore */
44
44
  CatmullRom: function ( v, k ) {
45
45
 
46
- var m = v.length - 1, f = m * k, i = Math.floor( f ), fn = Interpolation.Utils.CatmullRom;
46
+ let m = v.length - 1, f = m * k, i = Math.floor( f ), fn = Interpolation.Utils.CatmullRom;
47
47
 
48
48
  if ( v[ 0 ] === v[ m ] ) {
49
49
 
@@ -72,18 +72,18 @@ export let Interpolation = {
72
72
  /** @ignore */
73
73
  Bernstein: function ( n, i ) {
74
74
 
75
- var fc = Interpolation.Utils.Factorial;
75
+ let fc = Interpolation.Utils.Factorial;
76
76
  return fc( n ) / fc( i ) / fc( n - i );
77
77
 
78
78
  },
79
79
  /* @ignore */
80
80
  Factorial: ( function () {
81
81
 
82
- var a = [ 1 ];
82
+ let a = [ 1 ];
83
83
 
84
84
  return function ( n ) {
85
85
 
86
- var s = 1, i;
86
+ let s = 1, i;
87
87
  if ( a[ n ] ) return a[ n ];
88
88
  for ( i = n; i > 1; i-- ) s *= i;
89
89
  a[ n ] = s;
@@ -95,7 +95,7 @@ export let Interpolation = {
95
95
  /** @ignore */
96
96
  CatmullRom: function ( p0, p1, p2, p3, t ) {
97
97
 
98
- var v0 = ( p2 - p0 ) * 0.5, v1 = ( p3 - p1 ) * 0.5, t2 = t * t, t3 = t * t2;
98
+ let v0 = ( p2 - p0 ) * 0.5, v1 = ( p3 - p1 ) * 0.5, t2 = t * t, t3 = t * t2;
99
99
  return ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1;
100
100
  }
101
101
  }
@@ -82,7 +82,7 @@ import { Interpolation } from "./interpolation.js";
82
82
  this.isRenderable = false;
83
83
 
84
84
  // Set all starting values present on the target object
85
- for ( var field in object ) {
85
+ for ( let field in object ) {
86
86
  if (typeof object !== "object") {
87
87
  this._valuesStart[ field ] = parseFloat(object[field]);
88
88
  }
@@ -174,7 +174,7 @@ import { Interpolation } from "./interpolation.js";
174
174
 
175
175
  this._startTime = time + this._delayTime;
176
176
 
177
- for ( var property in this._valuesEnd ) {
177
+ for ( let property in this._valuesEnd ) {
178
178
 
179
179
  // check if an Array was provided as property value
180
180
  if ( this._valuesEnd[ property ] instanceof Array ) {
@@ -350,9 +350,9 @@ import { Interpolation } from "./interpolation.js";
350
350
  // the original Tween implementation expect
351
351
  // a timestamp and not a time delta
352
352
  this._tweenTimeTracker = (game.lastUpdate > this._tweenTimeTracker) ? game.lastUpdate : this._tweenTimeTracker + dt;
353
- var time = this._tweenTimeTracker;
353
+ let time = this._tweenTimeTracker;
354
354
 
355
- var property;
355
+ let property;
356
356
 
357
357
  if ( time < this._startTime ) {
358
358
 
@@ -372,15 +372,15 @@ import { Interpolation } from "./interpolation.js";
372
372
 
373
373
  }
374
374
 
375
- var elapsed = ( time - this._startTime ) / this._duration;
375
+ let elapsed = ( time - this._startTime ) / this._duration;
376
376
  elapsed = elapsed > 1 ? 1 : elapsed;
377
377
 
378
- var value = this._easingFunction( elapsed );
378
+ let value = this._easingFunction( elapsed );
379
379
 
380
380
  for ( property in this._valuesEnd ) {
381
381
 
382
- var start = this._valuesStart[ property ] || 0;
383
- var end = this._valuesEnd[ property ];
382
+ let start = this._valuesStart[ property ] || 0;
383
+ let end = this._valuesEnd[ property ];
384
384
 
385
385
  if ( end instanceof Array ) {
386
386
 
@@ -424,7 +424,7 @@ import { Interpolation } from "./interpolation.js";
424
424
  }
425
425
 
426
426
  if (this._yoyo) {
427
- var tmp = this._valuesStartRepeat[ property ];
427
+ let tmp = this._valuesStartRepeat[ property ];
428
428
  this._valuesStartRepeat[ property ] = this._valuesEnd[ property ];
429
429
  this._valuesEnd[ property ] = tmp;
430
430
  }
@@ -450,7 +450,7 @@ import { Interpolation } from "./interpolation.js";
450
450
 
451
451
  }
452
452
 
453
- for ( var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i ++ ) {
453
+ for ( let i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i ++ ) {
454
454
 
455
455
  this._chainedTweens[ i ].start( time );
456
456