@vpmedia/phaser 1.68.0 → 1.70.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 (105) hide show
  1. package/README.md +1 -1
  2. package/package.json +6 -5
  3. package/src/phaser/core/animation_parser.js +4 -4
  4. package/src/phaser/core/const.js +13 -0
  5. package/src/phaser/core/device_util.js +18 -18
  6. package/src/phaser/core/frame_util.js +4 -4
  7. package/src/phaser/core/loader_parser.js +32 -32
  8. package/src/phaser/core/scale_manager.js +2 -2
  9. package/src/phaser/core/sound_manager.js +5 -1
  10. package/src/phaser/core/tween.js +4 -2
  11. package/src/phaser/core/tween_data.js +4 -4
  12. package/src/phaser/core/tween_easing.js +62 -62
  13. package/src/phaser/core/tween_manager.js +1 -1
  14. package/src/phaser/display/bitmap_text.js +2 -2
  15. package/src/phaser/display/canvas/graphics.js +7 -7
  16. package/src/phaser/display/canvas/masker.js +4 -4
  17. package/src/phaser/display/canvas/pool.js +14 -14
  18. package/src/phaser/display/canvas/tinter.js +14 -16
  19. package/src/phaser/display/canvas/util.js +18 -18
  20. package/src/phaser/display/graphics_data_util.js +2 -2
  21. package/src/phaser/display/sprite_util.js +10 -10
  22. package/src/phaser/display/text.js +2 -2
  23. package/src/phaser/display/webgl/graphics.js +24 -24
  24. package/src/phaser/display/webgl/mask_manager.js +4 -4
  25. package/src/phaser/display/webgl/shader/complex.js +2 -2
  26. package/src/phaser/display/webgl/shader/fast.js +2 -2
  27. package/src/phaser/display/webgl/shader/normal.js +2 -2
  28. package/src/phaser/display/webgl/shader/primitive.js +2 -2
  29. package/src/phaser/display/webgl/shader/strip.js +2 -2
  30. package/src/phaser/display/webgl/texture_util.js +4 -4
  31. package/src/phaser/display/webgl/util.js +13 -13
  32. package/src/phaser/geom/util/circle.js +15 -15
  33. package/src/phaser/geom/util/ellipse.js +2 -2
  34. package/src/phaser/geom/util/line.js +11 -11
  35. package/src/phaser/geom/util/matrix.js +6 -6
  36. package/src/phaser/geom/util/point.js +42 -42
  37. package/src/phaser/geom/util/polygon.js +2 -2
  38. package/src/phaser/geom/util/rectangle.js +33 -33
  39. package/src/phaser/geom/util/rounded_rectangle.js +2 -2
  40. package/src/phaser/util/math.js +47 -63
  41. package/types/phaser/core/animation_parser.d.ts +0 -17
  42. package/types/phaser/core/animation_parser.d.ts.map +1 -1
  43. package/types/phaser/core/const.d.ts +12 -0
  44. package/types/phaser/core/const.d.ts.map +1 -1
  45. package/types/phaser/core/device_util.d.ts +2 -43
  46. package/types/phaser/core/device_util.d.ts.map +1 -1
  47. package/types/phaser/core/frame_util.d.ts +0 -12
  48. package/types/phaser/core/frame_util.d.ts.map +1 -1
  49. package/types/phaser/core/loader_parser.d.ts +0 -30
  50. package/types/phaser/core/loader_parser.d.ts.map +1 -1
  51. package/types/phaser/core/sound_manager.d.ts +1 -0
  52. package/types/phaser/core/sound_manager.d.ts.map +1 -1
  53. package/types/phaser/core/tween.d.ts +4 -4
  54. package/types/phaser/core/tween.d.ts.map +1 -1
  55. package/types/phaser/core/tween_data.d.ts +6 -6
  56. package/types/phaser/core/tween_data.d.ts.map +1 -1
  57. package/types/phaser/core/tween_easing.d.ts +0 -155
  58. package/types/phaser/core/tween_easing.d.ts.map +1 -1
  59. package/types/phaser/core/tween_manager.d.ts +41 -72
  60. package/types/phaser/core/tween_manager.d.ts.map +1 -1
  61. package/types/phaser/display/canvas/graphics.d.ts +0 -14
  62. package/types/phaser/display/canvas/graphics.d.ts.map +1 -1
  63. package/types/phaser/display/canvas/masker.d.ts +0 -9
  64. package/types/phaser/display/canvas/masker.d.ts.map +1 -1
  65. package/types/phaser/display/canvas/pool.d.ts +0 -32
  66. package/types/phaser/display/canvas/pool.d.ts.map +1 -1
  67. package/types/phaser/display/canvas/tinter.d.ts +2 -36
  68. package/types/phaser/display/canvas/tinter.d.ts.map +1 -1
  69. package/types/phaser/display/canvas/util.d.ts +0 -60
  70. package/types/phaser/display/canvas/util.d.ts.map +1 -1
  71. package/types/phaser/display/graphics_data_util.d.ts +0 -5
  72. package/types/phaser/display/graphics_data_util.d.ts.map +1 -1
  73. package/types/phaser/display/sprite_util.d.ts +0 -29
  74. package/types/phaser/display/sprite_util.d.ts.map +1 -1
  75. package/types/phaser/display/webgl/graphics.d.ts +0 -65
  76. package/types/phaser/display/webgl/graphics.d.ts.map +1 -1
  77. package/types/phaser/display/webgl/mask_manager.d.ts +0 -10
  78. package/types/phaser/display/webgl/mask_manager.d.ts.map +1 -1
  79. package/types/phaser/display/webgl/shader/complex.d.ts.map +1 -1
  80. package/types/phaser/display/webgl/shader/fast.d.ts.map +1 -1
  81. package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -1
  82. package/types/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
  83. package/types/phaser/display/webgl/shader/strip.d.ts.map +1 -1
  84. package/types/phaser/display/webgl/texture_util.d.ts +0 -12
  85. package/types/phaser/display/webgl/texture_util.d.ts.map +1 -1
  86. package/types/phaser/display/webgl/util.d.ts +7 -46
  87. package/types/phaser/display/webgl/util.d.ts.map +1 -1
  88. package/types/phaser/geom/util/circle.d.ts +0 -47
  89. package/types/phaser/geom/util/circle.d.ts.map +1 -1
  90. package/types/phaser/geom/util/ellipse.d.ts +0 -7
  91. package/types/phaser/geom/util/ellipse.d.ts.map +1 -1
  92. package/types/phaser/geom/util/line.d.ts +0 -36
  93. package/types/phaser/geom/util/line.d.ts.map +1 -1
  94. package/types/phaser/geom/util/matrix.d.ts +0 -14
  95. package/types/phaser/geom/util/matrix.d.ts.map +1 -1
  96. package/types/phaser/geom/util/point.d.ts +0 -137
  97. package/types/phaser/geom/util/point.d.ts.map +1 -1
  98. package/types/phaser/geom/util/polygon.d.ts +0 -6
  99. package/types/phaser/geom/util/polygon.d.ts.map +1 -1
  100. package/types/phaser/geom/util/rectangle.d.ts +0 -106
  101. package/types/phaser/geom/util/rectangle.d.ts.map +1 -1
  102. package/types/phaser/geom/util/rounded_rectangle.d.ts +0 -6
  103. package/types/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
  104. package/types/phaser/util/math.d.ts +3 -134
  105. package/types/phaser/util/math.d.ts.map +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @vpmedia/phaser
2
2
 
3
- [![npm version](https://badge.fury.io/js/@vpmedia%2Fphaser.svg?v=1.68.0)](https://badge.fury.io/js/@vpmedia%2Fphaser)
3
+ [![npm version](https://badge.fury.io/js/@vpmedia%2Fphaser.svg?v=1.70.0)](https://badge.fury.io/js/@vpmedia%2Fphaser)
4
4
  [![Node.js CI](https://github.com/vpmedia/phaser/actions/workflows/ci.yml/badge.svg)](https://github.com/vpmedia/phaser/actions/workflows/ci.yml)
5
5
 
6
6
  @vpmedia/phaser is the modern ECMAScript port of the popular Phaser game engine v2.6.2.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vpmedia/phaser",
3
- "version": "1.68.0",
3
+ "version": "1.70.0",
4
4
  "description": "@vpmedia/phaser is the modern ECMAScript port of the popular Phaser game engine v2.6.2",
5
5
  "author": "Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)",
6
6
  "license": "MIT",
@@ -22,6 +22,10 @@
22
22
  "main": "./src/index.js",
23
23
  "types": "./types/index.d.ts",
24
24
  "type": "module",
25
+ "dependencies": {
26
+ "@vpmedia/simplify": "^1.14.0",
27
+ "uuid": "^11.0.3"
28
+ },
25
29
  "devDependencies": {
26
30
  "@eslint/js": "^9.15.0",
27
31
  "@jest/globals": "^29.7.0",
@@ -48,8 +52,5 @@
48
52
  "> 0.5%",
49
53
  "not dead",
50
54
  "not op_mini all"
51
- ],
52
- "dependencies": {
53
- "@vpmedia/simplify": "^1.14.0"
54
- }
55
+ ]
55
56
  }
@@ -12,7 +12,7 @@ import { FrameData } from './frame_data.js';
12
12
  * @param {number} spacing - TBD.
13
13
  * @returns {object} TBD.
14
14
  */
15
- export function spriteSheet(game, key, frameWidth, frameHeight, frameMax, margin, spacing) {
15
+ export const spriteSheet = (game, key, frameWidth, frameHeight, frameMax, margin, spacing) => {
16
16
  let img = key;
17
17
  if (typeof key === 'string') {
18
18
  img = game.cache.getImage(key);
@@ -54,7 +54,7 @@ export function spriteSheet(game, key, frameWidth, frameHeight, frameMax, margin
54
54
  }
55
55
  }
56
56
  return data;
57
- }
57
+ };
58
58
 
59
59
  /**
60
60
  * TBD.
@@ -62,7 +62,7 @@ export function spriteSheet(game, key, frameWidth, frameHeight, frameMax, margin
62
62
  * @param {object} json - TBD.
63
63
  * @returns {object} TBD.
64
64
  */
65
- export function JSONDataHash(game, json) {
65
+ export const JSONDataHash = (game, json) => {
66
66
  if (!json.frames) {
67
67
  game.logger.warn('JSONDataHash: Invalid Texture Atlas JSON given, missing frames object', json);
68
68
  return null;
@@ -93,4 +93,4 @@ export function JSONDataHash(game, json) {
93
93
  i += 1;
94
94
  }
95
95
  return data;
96
- }
96
+ };
@@ -146,6 +146,19 @@ export const RENDER_CANVAS = 1;
146
146
  * @type {number}
147
147
  */
148
148
  export const RENDER_WEBGL = 2;
149
+ // audio modes
150
+ /**
151
+ * @type {number}
152
+ */
153
+ export const AUDIO_DISABLED = 0;
154
+ /**
155
+ * @type {number}
156
+ */
157
+ export const AUDIO_STANDARD = 1;
158
+ /**
159
+ * @type {number}
160
+ */
161
+ export const AUDIO_WEBKIT = 2;
149
162
  // pointer modes
150
163
  /**
151
164
  * @type {number}
@@ -9,15 +9,15 @@ const logger = new Logger('device');
9
9
  * @param {string} type - TBD.
10
10
  * @returns {boolean} TBD.
11
11
  */
12
- export function canPlayAudio(device, type) {
12
+ export const canPlayAudio = (device, type) => {
13
13
  return device.supportedAudioFormats[type] === true;
14
- }
14
+ };
15
15
 
16
16
  /**
17
17
  * TBD.
18
18
  * @param {Device} device - TBD.
19
19
  */
20
- export function checkOS(device) {
20
+ export const checkOS = (device) => {
21
21
  const ua = navigator.userAgent;
22
22
  if (/Android/.test(ua)) {
23
23
  device.android = true;
@@ -48,13 +48,13 @@ export function checkOS(device) {
48
48
  if (device.android || device.iOS || device.windowsPhone || (/Windows NT/i.test(ua) && /Touch/i.test(ua))) {
49
49
  device.desktop = false;
50
50
  }
51
- }
51
+ };
52
52
 
53
53
  /**
54
54
  * TBD.
55
55
  * @param {Device} device - TBD.
56
56
  */
57
- export function checkInput(device) {
57
+ export const checkInput = (device) => {
58
58
  if (
59
59
  'ontouchstart' in document.documentElement ||
60
60
  (window.navigator.maxTouchPoints && window.navigator.maxTouchPoints >= 1)
@@ -68,13 +68,13 @@ export function checkInput(device) {
68
68
  if ('onwheel' in window || 'WheelEvent' in window) {
69
69
  device.wheelEvent = 'wheel';
70
70
  }
71
- }
71
+ };
72
72
 
73
73
  /**
74
74
  * TBD.
75
75
  * @param {Device} device - TBD.
76
76
  */
77
- export function checkFullScreenSupport(device) {
77
+ export const checkFullScreenSupport = (device) => {
78
78
  const fs = [
79
79
  'requestFullscreen',
80
80
  'requestFullScreen',
@@ -114,13 +114,13 @@ export function checkFullScreenSupport(device) {
114
114
  device.fullscreenKeyboard = true;
115
115
  }
116
116
  }
117
- }
117
+ };
118
118
 
119
119
  /**
120
120
  * TBD.
121
121
  * @param {Device} device - TBD.
122
122
  */
123
- export function checkBrowser(device) {
123
+ export const checkBrowser = (device) => {
124
124
  const ua = navigator.userAgent;
125
125
  if (/Edge\/\d+/.test(ua)) {
126
126
  device.edge = true;
@@ -131,7 +131,7 @@ export function checkBrowser(device) {
131
131
  } else if (/Safari\/(\d+)/.test(ua) && !device.windowsPhone) {
132
132
  device.safari = true;
133
133
  }
134
- }
134
+ };
135
135
 
136
136
  /**
137
137
  * Check for codec support.
@@ -175,7 +175,7 @@ export const isMediaSourceTypeSupported = (type) => {
175
175
  * @see https://developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements
176
176
  * @see https://bit.ly/iphoneoscodecs
177
177
  */
178
- export function checkAudio(device) {
178
+ export const checkAudio = (device) => {
179
179
  const audioElement = document.createElement('audio');
180
180
  const formats = [
181
181
  { type: 'ogg', codecs: ['audio/ogg; codecs="vorbis"'] },
@@ -194,13 +194,13 @@ export function checkAudio(device) {
194
194
  }
195
195
  }
196
196
  }
197
- }
197
+ };
198
198
 
199
199
  /**
200
200
  * TBD.
201
201
  * @param {Device} device - TBD.
202
202
  */
203
- export function checkImage(device) {
203
+ export const checkImage = (device) => {
204
204
  try {
205
205
  const avif = new Image();
206
206
  avif.src =
@@ -222,25 +222,25 @@ export function checkImage(device) {
222
222
  const typedError = error instanceof Error ? error : new Error(String(error));
223
223
  logger.exception('checkImage error with webp', typedError);
224
224
  }
225
- }
225
+ };
226
226
 
227
227
  /**
228
228
  * TBD.
229
229
  * @param {Device} device - TBD.
230
230
  */
231
- export function initialize(device) {
231
+ export const initialize = (device) => {
232
232
  checkOS(device);
233
233
  checkBrowser(device);
234
234
  checkAudio(device);
235
235
  // checkImage(device);
236
236
  checkFullScreenSupport(device);
237
237
  checkInput(device);
238
- }
238
+ };
239
239
 
240
240
  /**
241
241
  * TBD.
242
242
  * @returns {Device} TBD.
243
243
  */
244
- export function createDevice() {
244
+ export const createDevice = () => {
245
245
  return new Device();
246
- }
246
+ };
@@ -7,11 +7,11 @@ import { FrameData } from './frame_data.js';
7
7
  * @param {Frame} output - TBD.
8
8
  * @returns {Frame} TBD.
9
9
  */
10
- export function cloneFrame(frame, output = null) {
10
+ export const cloneFrame = (frame, output = null) => {
11
11
  const result = output || new Frame(frame.index, frame.x, frame.y, frame.width, frame.height);
12
12
  result.initialize(frame.index, frame.x, frame.y, frame.width, frame.height);
13
13
  return result;
14
- }
14
+ };
15
15
 
16
16
  /**
17
17
  * TBD.
@@ -19,10 +19,10 @@ export function cloneFrame(frame, output = null) {
19
19
  * @param {FrameData} output - TBD.
20
20
  * @returns {FrameData} TBD.
21
21
  */
22
- export function cloneFrameData(frameData, output = null) {
22
+ export const cloneFrameData = (frameData, output = null) => {
23
23
  const result = output || new FrameData();
24
24
  for (let i = 0; i < frameData.total; i += 1) {
25
25
  result.addFrame(frameData.getFrame(i).clone());
26
26
  }
27
27
  return result;
28
- }
28
+ };
@@ -7,13 +7,13 @@ import { Rectangle } from '../geom/rectangle.js';
7
7
  * @param {object} bitmapFontData - TBD.
8
8
  * @returns {object} TBD.
9
9
  */
10
- export function finalizeBitmapFont(baseTexture, bitmapFontData) {
10
+ export const finalizeBitmapFont = (baseTexture, bitmapFontData) => {
11
11
  Object.keys(bitmapFontData.chars).forEach((charCode) => {
12
12
  const letter = bitmapFontData.chars[charCode];
13
13
  letter.texture = new Texture(baseTexture, new Rectangle(letter.x, letter.y, letter.width, letter.height));
14
14
  });
15
15
  return bitmapFontData;
16
- }
16
+ };
17
17
 
18
18
  /**
19
19
  * TBD.
@@ -23,37 +23,37 @@ export function finalizeBitmapFont(baseTexture, bitmapFontData) {
23
23
  * @param {number} ySpacing - TBD.
24
24
  * @returns {object} TBD.
25
25
  */
26
- export function xmlBitmapFont(xml, baseTexture, xSpacing, ySpacing) {
26
+ export const xmlBitmapFont = (xml, baseTexture, xSpacing, ySpacing) => {
27
27
  const data = {};
28
28
  const info = xml.getElementsByTagName('info')[0];
29
29
  const common = xml.getElementsByTagName('common')[0];
30
30
  data.font = info.getAttribute('face');
31
- data.size = parseInt(info.getAttribute('size'), 10);
32
- data.lineHeight = parseInt(common.getAttribute('lineHeight'), 10) + ySpacing;
31
+ data.size = Number.parseInt(info.getAttribute('size'), 10);
32
+ data.lineHeight = Number.parseInt(common.getAttribute('lineHeight'), 10) + ySpacing;
33
33
  data.chars = {};
34
34
  const letters = xml.getElementsByTagName('char');
35
35
  for (let i = 0; i < letters.length; i += 1) {
36
- const charCode = parseInt(letters[i].getAttribute('id'), 10);
36
+ const charCode = Number.parseInt(letters[i].getAttribute('id'), 10);
37
37
  data.chars[charCode] = {
38
- x: parseInt(letters[i].getAttribute('x'), 10),
39
- y: parseInt(letters[i].getAttribute('y'), 10),
40
- width: parseInt(letters[i].getAttribute('width'), 10),
41
- height: parseInt(letters[i].getAttribute('height'), 10),
42
- xOffset: parseInt(letters[i].getAttribute('xoffset'), 10),
43
- yOffset: parseInt(letters[i].getAttribute('yoffset'), 10),
44
- xAdvance: parseInt(letters[i].getAttribute('xadvance'), 10) + xSpacing,
38
+ x: Number.parseInt(letters[i].getAttribute('x'), 10),
39
+ y: Number.parseInt(letters[i].getAttribute('y'), 10),
40
+ width: Number.parseInt(letters[i].getAttribute('width'), 10),
41
+ height: Number.parseInt(letters[i].getAttribute('height'), 10),
42
+ xOffset: Number.parseInt(letters[i].getAttribute('xoffset'), 10),
43
+ yOffset: Number.parseInt(letters[i].getAttribute('yoffset'), 10),
44
+ xAdvance: Number.parseInt(letters[i].getAttribute('xadvance'), 10) + xSpacing,
45
45
  kerning: {},
46
46
  };
47
47
  }
48
48
  const kernings = xml.getElementsByTagName('kerning');
49
49
  for (let i = 0; i < kernings.length; i += 1) {
50
- const first = parseInt(kernings[i].getAttribute('first'), 10);
51
- const second = parseInt(kernings[i].getAttribute('second'), 10);
52
- const amount = parseInt(kernings[i].getAttribute('amount'), 10);
50
+ const first = Number.parseInt(kernings[i].getAttribute('first'), 10);
51
+ const second = Number.parseInt(kernings[i].getAttribute('second'), 10);
52
+ const amount = Number.parseInt(kernings[i].getAttribute('amount'), 10);
53
53
  data.chars[second].kerning[first] = amount;
54
54
  }
55
55
  return finalizeBitmapFont(baseTexture, data);
56
- }
56
+ };
57
57
 
58
58
  /**
59
59
  * TBD.
@@ -63,9 +63,9 @@ export function xmlBitmapFont(xml, baseTexture, xSpacing, ySpacing) {
63
63
  * @param {number} ySpacing - TBD.
64
64
  * @returns {object} TBD.
65
65
  */
66
- export function bitmapFont(xml, baseTexture, xSpacing, ySpacing) {
66
+ export const bitmapFont = (xml, baseTexture, xSpacing, ySpacing) => {
67
67
  return xmlBitmapFont(xml, baseTexture, xSpacing, ySpacing);
68
- }
68
+ };
69
69
 
70
70
  /**
71
71
  * TBD.
@@ -75,30 +75,30 @@ export function bitmapFont(xml, baseTexture, xSpacing, ySpacing) {
75
75
  * @param {number} ySpacing - TBD.
76
76
  * @returns {object} TBD.
77
77
  */
78
- export function jsonBitmapFont(json, baseTexture, xSpacing, ySpacing) {
78
+ export const jsonBitmapFont = (json, baseTexture, xSpacing, ySpacing) => {
79
79
  const data = {
80
80
  font: json.font.info._face,
81
- size: parseInt(json.font.info._size, 10),
82
- lineHeight: parseInt(json.font.common._lineHeight, 10) + ySpacing,
81
+ size: Number.parseInt(json.font.info._size, 10),
82
+ lineHeight: Number.parseInt(json.font.common._lineHeight, 10) + ySpacing,
83
83
  chars: {},
84
84
  };
85
85
  json.font.chars.char.forEach((letter) => {
86
- const charCode = parseInt(letter._id, 10);
86
+ const charCode = Number.parseInt(letter._id, 10);
87
87
  data.chars[charCode] = {
88
- x: parseInt(letter._x, 10),
89
- y: parseInt(letter._y, 10),
90
- width: parseInt(letter._width, 10),
91
- height: parseInt(letter._height, 10),
92
- xOffset: parseInt(letter._xoffset, 10),
93
- yOffset: parseInt(letter._yoffset, 10),
94
- xAdvance: parseInt(letter._xadvance, 10) + xSpacing,
88
+ x: Number.parseInt(letter._x, 10),
89
+ y: Number.parseInt(letter._y, 10),
90
+ width: Number.parseInt(letter._width, 10),
91
+ height: Number.parseInt(letter._height, 10),
92
+ xOffset: Number.parseInt(letter._xoffset, 10),
93
+ yOffset: Number.parseInt(letter._yoffset, 10),
94
+ xAdvance: Number.parseInt(letter._xadvance, 10) + xSpacing,
95
95
  kerning: {},
96
96
  };
97
97
  });
98
98
  if (json.font.kernings && json.font.kernings.kerning) {
99
99
  json.font.kernings.kerning.forEach((kerning) => {
100
- data.chars[kerning._second].kerning[kerning._first] = parseInt(kerning._amount, 10);
100
+ data.chars[kerning._second].kerning[kerning._first] = Number.parseInt(kerning._amount, 10);
101
101
  });
102
102
  }
103
103
  return finalizeBitmapFont(baseTexture, data);
104
- }
104
+ };
@@ -197,14 +197,14 @@ export class ScaleManager {
197
197
  newWidth = width;
198
198
  } else {
199
199
  // Percentage based
200
- this.parentScaleFactor.x = parseInt(width, 10) / 100;
200
+ this.parentScaleFactor.x = Number.parseInt(width, 10) / 100;
201
201
  newWidth = rect.width * this.parentScaleFactor.x;
202
202
  }
203
203
  if (typeof height === 'number') {
204
204
  newHeight = height;
205
205
  } else {
206
206
  // Percentage based
207
- this.parentScaleFactor.y = parseInt(height, 10) / 100;
207
+ this.parentScaleFactor.y = Number.parseInt(height, 10) / 100;
208
208
  newHeight = rect.height * this.parentScaleFactor.y;
209
209
  }
210
210
  newWidth = Math.floor(newWidth);
@@ -5,6 +5,7 @@ import {
5
5
  PAGE_LIFECYCLE_STATE_CHANGE_EVENT,
6
6
  } from '@vpmedia/simplify';
7
7
  import { ArraySet } from './array_set.js';
8
+ import { AUDIO_DISABLED, AUDIO_STANDARD, AUDIO_WEBKIT } from './const.js';
8
9
  import { Signal } from './signal.js';
9
10
  import { Sound } from './sound.js';
10
11
  import { SoundSprite } from './sound_sprite.js';
@@ -21,9 +22,10 @@ export class SoundManager {
21
22
  this.context = null;
22
23
  this.baseLatency = 0; // https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/baseLatency
23
24
  this.noAudio = false;
25
+ this.type = AUDIO_DISABLED;
24
26
  this.connectToMaster = true;
25
27
  this.isLocked = false;
26
- this.muteOnPause = true;
28
+ // this.muteOnPause = true;
27
29
  this._codeMuted = false;
28
30
  this._muted = false;
29
31
  this._unlockSource = null;
@@ -47,6 +49,7 @@ export class SoundManager {
47
49
  if (window.AudioContext) {
48
50
  try {
49
51
  this.context = new window.AudioContext();
52
+ this.type = AUDIO_STANDARD;
50
53
  } catch (error) {
51
54
  this.context = null;
52
55
  this.noAudio = true;
@@ -56,6 +59,7 @@ export class SoundManager {
56
59
  } else if (window.webkitAudioContext) {
57
60
  try {
58
61
  this.context = new window.webkitAudioContext();
62
+ this.type = AUDIO_WEBKIT;
59
63
  } catch (error) {
60
64
  this.context = null;
61
65
  this.noAudio = true;
@@ -40,7 +40,7 @@ export class Tween {
40
40
  * TBD.
41
41
  * @param {object} properties - TBD.
42
42
  * @param {number} duration - TBD.
43
- * @param {string} ease - TBD.
43
+ * @param {string | Function} ease - TBD.
44
44
  * @param {boolean} autoStart - TBD.
45
45
  * @param {number} delay - TBD.
46
46
  * @param {number} repeat - TBD.
@@ -54,6 +54,7 @@ export class Tween {
54
54
  if (this.isRunning) {
55
55
  return this;
56
56
  }
57
+ // @ts-ignore
57
58
  this.timeline.push(new TweenData(this).to(properties, duration, ease, delay, repeat, yoyo));
58
59
  if (autoStart) {
59
60
  this.start();
@@ -65,7 +66,7 @@ export class Tween {
65
66
  * TBD.
66
67
  * @param {object} properties - TBD.
67
68
  * @param {number} duration - TBD.
68
- * @param {string} ease - TBD.
69
+ * @param {string | Function} ease - TBD.
69
70
  * @param {boolean} autoStart - TBD.
70
71
  * @param {number} delay - TBD.
71
72
  * @param {number} repeat - TBD.
@@ -80,6 +81,7 @@ export class Tween {
80
81
  this.game.logger.warn('Tween.from cannot be called after Tween.start');
81
82
  return this;
82
83
  }
84
+ // @ts-ignore
83
85
  this.timeline.push(new TweenData(this).from(properties, duration, ease, delay, repeat, yoyo));
84
86
  if (autoStart) {
85
87
  this.start();
@@ -26,7 +26,7 @@ export class TweenData {
26
26
  this.delay = 0;
27
27
  this.dt = 0;
28
28
  this.startTime = null;
29
- this.easingFunction = 'Linear';
29
+ this.easingFunction = (k) => k;
30
30
  this.interpolationFunction = MathUtils.linearInterpolation;
31
31
  this.interpolationContext = MathUtils;
32
32
  this.isRunning = false;
@@ -37,7 +37,7 @@ export class TweenData {
37
37
  * TBD.
38
38
  * @param {object} properties - TBD.
39
39
  * @param {number} duration - TBD.
40
- * @param {string} ease - TBD.
40
+ * @param {(number) => number} ease - TBD.
41
41
  * @param {number} delay - TBD.
42
42
  * @param {number} repeat - TBD.
43
43
  * @param {boolean} yoyo - TBD.
@@ -58,7 +58,7 @@ export class TweenData {
58
58
  * TBD.
59
59
  * @param {object} properties - TBD.
60
60
  * @param {number} duration - TBD.
61
- * @param {string} ease - TBD.
61
+ * @param {(number) => number} ease - TBD.
62
62
  * @param {number} delay - TBD.
63
63
  * @param {number} repeat - TBD.
64
64
  * @param {boolean} yoyo - TBD.
@@ -131,7 +131,7 @@ export class TweenData {
131
131
  if (typeof this.vEnd[property] !== 'undefined') {
132
132
  if (typeof this.vEnd[property] === 'string') {
133
133
  // Parses relative end values with start as base (e.g.: +10, -3)
134
- this.vEnd[property] = this.vStart[property] + parseFloat(this.vEnd[property], 10);
134
+ this.vEnd[property] = this.vStart[property] + Number.parseFloat(this.vEnd[property]);
135
135
  }
136
136
  this.parent.properties[property] = this.vEnd[property];
137
137
  } else {