@vpmedia/phaser 1.17.0 → 1.18.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.
- package/README.md +1 -1
- package/package.json +3 -3
- package/src/phaser/core/animation.js +3 -2
- package/src/phaser/core/animation_manager.js +3 -2
- package/src/phaser/core/cache.js +1 -1
- package/src/phaser/core/const.js +66 -0
- package/src/phaser/core/device.js +87 -0
- package/src/phaser/core/dom.js +13 -8
- package/src/phaser/core/event_manager.js +2 -1
- package/src/phaser/core/factory.js +11 -11
- package/src/phaser/core/game.js +1 -0
- package/src/phaser/core/input_mspointer.js +6 -6
- package/src/phaser/core/input_pointer.js +1 -1
- package/src/phaser/core/scale_manager.js +41 -24
- package/src/phaser/core/scene_manager.js +10 -6
- package/src/phaser/core/sound_manager.js +14 -7
- package/src/phaser/core/sound_sprite.js +7 -4
- package/src/phaser/core/timer.js +33 -21
- package/src/phaser/core/timer_event.js +8 -6
- package/src/phaser/core/tween.js +65 -45
- package/src/phaser/core/tween_data.js +22 -15
- package/src/phaser/core/tween_manager.js +10 -6
- package/src/phaser/display/bitmap_text.js +7 -6
- package/src/phaser/display/canvas/pool.js +1 -1
- package/src/phaser/display/canvas/renderer.js +5 -4
- package/src/phaser/display/canvas/util.js +2 -2
- package/src/phaser/display/display_object.js +33 -16
- package/src/phaser/display/graphics.js +57 -36
- package/src/phaser/display/graphics_data.js +7 -7
- package/src/phaser/display/image.js +16 -11
- package/src/phaser/display/sprite_util.js +3 -2
- package/src/phaser/display/text.js +27 -14
- package/src/phaser/display/webgl/abstract_filter.js +2 -2
- package/src/phaser/display/webgl/base_texture.js +2 -2
- package/src/phaser/display/webgl/blend_manager.js +3 -2
- package/src/phaser/display/webgl/earcut_node.js +1 -1
- package/src/phaser/display/webgl/fast_sprite_batch.js +6 -6
- package/src/phaser/display/webgl/filter_manager.js +1 -1
- package/src/phaser/display/webgl/filter_texture.js +2 -2
- package/src/phaser/display/webgl/graphics_data.js +1 -1
- package/src/phaser/display/webgl/render_texture.js +7 -3
- package/src/phaser/display/webgl/renderer.js +9 -6
- package/src/phaser/display/webgl/shader/complex.js +1 -1
- package/src/phaser/display/webgl/shader/fast.js +1 -1
- package/src/phaser/display/webgl/shader/normal.js +2 -2
- package/src/phaser/display/webgl/shader/primitive.js +1 -1
- package/src/phaser/display/webgl/shader/strip.js +1 -1
- package/src/phaser/display/webgl/shader_manager.js +3 -3
- package/src/phaser/display/webgl/sprite_batch.js +9 -7
- package/src/phaser/display/webgl/stencil_manager.js +7 -7
- package/src/phaser/display/webgl/texture.js +8 -6
- package/types/phaser/core/animation.d.ts +5 -4
- package/types/phaser/core/animation.d.ts.map +1 -1
- package/types/phaser/core/animation_manager.d.ts +7 -6
- package/types/phaser/core/animation_manager.d.ts.map +1 -1
- package/types/phaser/core/cache.d.ts +2 -2
- package/types/phaser/core/cache.d.ts.map +1 -1
- package/types/phaser/core/const.d.ts +88 -22
- package/types/phaser/core/const.d.ts.map +1 -1
- package/types/phaser/core/device.d.ts +87 -0
- package/types/phaser/core/device.d.ts.map +1 -1
- package/types/phaser/core/dom.d.ts +19 -27
- package/types/phaser/core/dom.d.ts.map +1 -1
- package/types/phaser/core/event_manager.d.ts +4 -3
- package/types/phaser/core/event_manager.d.ts.map +1 -1
- package/types/phaser/core/factory.d.ts +15 -15
- package/types/phaser/core/factory.d.ts.map +1 -1
- package/types/phaser/core/game.d.ts +1 -0
- package/types/phaser/core/game.d.ts.map +1 -1
- package/types/phaser/core/input.d.ts +2 -2
- package/types/phaser/core/input.d.ts.map +1 -1
- package/types/phaser/core/input_mspointer.d.ts +13 -13
- package/types/phaser/core/input_mspointer.d.ts.map +1 -1
- package/types/phaser/core/input_pointer.d.ts +2 -2
- package/types/phaser/core/input_pointer.d.ts.map +1 -1
- package/types/phaser/core/scale_manager.d.ts +57 -40
- package/types/phaser/core/scale_manager.d.ts.map +1 -1
- package/types/phaser/core/scene_manager.d.ts +15 -10
- package/types/phaser/core/scene_manager.d.ts.map +1 -1
- package/types/phaser/core/sound_manager.d.ts +16 -9
- package/types/phaser/core/sound_manager.d.ts.map +1 -1
- package/types/phaser/core/sound_sprite.d.ts +10 -7
- package/types/phaser/core/sound_sprite.d.ts.map +1 -1
- package/types/phaser/core/timer.d.ts +41 -29
- package/types/phaser/core/timer.d.ts.map +1 -1
- package/types/phaser/core/timer_event.d.ts +12 -11
- package/types/phaser/core/timer_event.d.ts.map +1 -1
- package/types/phaser/core/tween.d.ts +79 -59
- package/types/phaser/core/tween.d.ts.map +1 -1
- package/types/phaser/core/tween_data.d.ts +26 -19
- package/types/phaser/core/tween_data.d.ts.map +1 -1
- package/types/phaser/core/tween_manager.d.ts +16 -12
- package/types/phaser/core/tween_manager.d.ts.map +1 -1
- package/types/phaser/display/bitmap_text.d.ts +10 -9
- package/types/phaser/display/bitmap_text.d.ts.map +1 -1
- package/types/phaser/display/canvas/buffer.d.ts +2 -2
- package/types/phaser/display/canvas/buffer.d.ts.map +1 -1
- package/types/phaser/display/canvas/pool.d.ts +2 -2
- package/types/phaser/display/canvas/pool.d.ts.map +1 -1
- package/types/phaser/display/canvas/renderer.d.ts +5 -4
- package/types/phaser/display/canvas/renderer.d.ts.map +1 -1
- package/types/phaser/display/canvas/util.d.ts +2 -2
- package/types/phaser/display/canvas/util.d.ts.map +1 -1
- package/types/phaser/display/display_object.d.ts +50 -33
- package/types/phaser/display/display_object.d.ts.map +1 -1
- package/types/phaser/display/graphics.d.ts +65 -47
- package/types/phaser/display/graphics.d.ts.map +1 -1
- package/types/phaser/display/graphics_data.d.ts +16 -16
- package/types/phaser/display/graphics_data.d.ts.map +1 -1
- package/types/phaser/display/image.d.ts +17 -18
- package/types/phaser/display/image.d.ts.map +1 -1
- package/types/phaser/display/sprite_util.d.ts +5 -4
- package/types/phaser/display/sprite_util.d.ts.map +1 -1
- package/types/phaser/display/text.d.ts +33 -55
- package/types/phaser/display/text.d.ts.map +1 -1
- package/types/phaser/display/webgl/abstract_filter.d.ts +3 -3
- package/types/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
- package/types/phaser/display/webgl/base_texture.d.ts +4 -4
- package/types/phaser/display/webgl/base_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/blend_manager.d.ts +6 -5
- package/types/phaser/display/webgl/blend_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/earcut_node.d.ts +3 -3
- package/types/phaser/display/webgl/earcut_node.d.ts.map +1 -1
- package/types/phaser/display/webgl/fast_sprite_batch.d.ts +12 -12
- package/types/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/webgl/filter_manager.d.ts +3 -3
- package/types/phaser/display/webgl/filter_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/filter_texture.d.ts +7 -7
- package/types/phaser/display/webgl/filter_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/graphics_data.d.ts +5 -5
- package/types/phaser/display/webgl/graphics_data.d.ts.map +1 -1
- package/types/phaser/display/webgl/render_texture.d.ts +9 -9
- package/types/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/renderer.d.ts +10 -7
- package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/complex.d.ts +11 -11
- package/types/phaser/display/webgl/shader/complex.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/fast.d.ts +15 -15
- package/types/phaser/display/webgl/shader/fast.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/normal.d.ts +11 -11
- package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/primitive.d.ts +12 -12
- package/types/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/strip.d.ts +12 -12
- package/types/phaser/display/webgl/shader/strip.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader_manager.d.ts +5 -5
- package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/sprite_batch.d.ts +16 -14
- package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/webgl/stencil_manager.d.ts +12 -12
- package/types/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/texture.d.ts +15 -12
- package/types/phaser/display/webgl/texture.d.ts.map +1 -1
package/src/phaser/core/tween.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Signal } from './signal';
|
|
2
2
|
import { TweenData } from './tween_data';
|
|
3
|
+
import { TweenManager } from './tween_manager';
|
|
4
|
+
import { DisplayObject } from '../display/display_object';
|
|
3
5
|
import * as MathUtils from '../util/math';
|
|
4
6
|
import { TWEEN_PENDING, TWEEN_RUNNING, TWEEN_COMPLETE, TWEEN_LOOPED } from './const';
|
|
5
7
|
import { Game } from './game';
|
|
@@ -7,9 +9,9 @@ import { Game } from './game';
|
|
|
7
9
|
export class Tween {
|
|
8
10
|
/**
|
|
9
11
|
* TBD.
|
|
10
|
-
* @param target - TBD.
|
|
12
|
+
* @param {DisplayObject} target - TBD.
|
|
11
13
|
* @param {Game} game - TBD.
|
|
12
|
-
* @param manager
|
|
14
|
+
* @param {TweenManager} manager - TBD.
|
|
13
15
|
*/
|
|
14
16
|
constructor(target, game, manager) {
|
|
15
17
|
this.game = game;
|
|
@@ -39,13 +41,14 @@ export class Tween {
|
|
|
39
41
|
|
|
40
42
|
/**
|
|
41
43
|
* TBD.
|
|
42
|
-
* @param properties
|
|
43
|
-
* @param duration - TBD.
|
|
44
|
-
* @param ease - TBD.
|
|
45
|
-
* @param autoStart
|
|
46
|
-
* @param delay - TBD.
|
|
47
|
-
* @param repeat
|
|
48
|
-
* @param yoyo
|
|
44
|
+
* @param {object} properties - TBD.
|
|
45
|
+
* @param {number} duration - TBD.
|
|
46
|
+
* @param {string} ease - TBD.
|
|
47
|
+
* @param {boolean} autoStart - TBD.
|
|
48
|
+
* @param {number} delay - TBD.
|
|
49
|
+
* @param {number} repeat - TBD.
|
|
50
|
+
* @param {boolean} yoyo - TBD.
|
|
51
|
+
* @returns {Tween} TBD.
|
|
49
52
|
*/
|
|
50
53
|
to(properties, duration = 1000, ease = 'Linear', autoStart = false, delay = 0, repeat = 0, yoyo = false) {
|
|
51
54
|
if (typeof ease === 'string' && this.manager.easeMap[ease]) {
|
|
@@ -63,13 +66,14 @@ export class Tween {
|
|
|
63
66
|
|
|
64
67
|
/**
|
|
65
68
|
* TBD.
|
|
66
|
-
* @param properties
|
|
67
|
-
* @param duration - TBD.
|
|
68
|
-
* @param ease - TBD.
|
|
69
|
-
* @param autoStart
|
|
70
|
-
* @param delay - TBD.
|
|
71
|
-
* @param repeat
|
|
72
|
-
* @param yoyo
|
|
69
|
+
* @param {object} properties - TBD.
|
|
70
|
+
* @param {number} duration - TBD.
|
|
71
|
+
* @param {string} ease - TBD.
|
|
72
|
+
* @param {boolean} autoStart - TBD.
|
|
73
|
+
* @param {number} delay - TBD.
|
|
74
|
+
* @param {number} repeat - TBD.
|
|
75
|
+
* @param {boolean} yoyo - TBD.
|
|
76
|
+
* @returns {Tween} TBD.
|
|
73
77
|
*/
|
|
74
78
|
from(properties, duration = 1000, ease = 'Linear', autoStart = false, delay = 0, repeat = 0, yoyo = false) {
|
|
75
79
|
if (typeof ease === 'string' && this.manager.easeMap[ease]) {
|
|
@@ -88,7 +92,8 @@ export class Tween {
|
|
|
88
92
|
|
|
89
93
|
/**
|
|
90
94
|
* TBD.
|
|
91
|
-
* @param index - TBD.
|
|
95
|
+
* @param {number} index - TBD.
|
|
96
|
+
* @returns {Tween} TBD.
|
|
92
97
|
*/
|
|
93
98
|
start(index = 0) {
|
|
94
99
|
if (this.game === null || this.target === null || this.timeline.length === 0 || this.isRunning) {
|
|
@@ -122,7 +127,8 @@ export class Tween {
|
|
|
122
127
|
|
|
123
128
|
/**
|
|
124
129
|
* TBD.
|
|
125
|
-
* @param complete
|
|
130
|
+
* @param {boolean} complete - TBD.
|
|
131
|
+
* @returns {Tween} TBD.
|
|
126
132
|
*/
|
|
127
133
|
stop(complete = false) {
|
|
128
134
|
this.isRunning = false;
|
|
@@ -141,9 +147,10 @@ export class Tween {
|
|
|
141
147
|
|
|
142
148
|
/**
|
|
143
149
|
* TBD.
|
|
144
|
-
* @param property
|
|
145
|
-
* @param value
|
|
146
|
-
* @param index - TBD.
|
|
150
|
+
* @param {string} property - TBD.
|
|
151
|
+
* @param {number} value - TBD.
|
|
152
|
+
* @param {number} index - TBD.
|
|
153
|
+
* @returns {Tween} TBD.
|
|
147
154
|
*/
|
|
148
155
|
updateTweenData(property, value, index = 0) {
|
|
149
156
|
if (this.timeline.length === 0) {
|
|
@@ -161,8 +168,9 @@ export class Tween {
|
|
|
161
168
|
|
|
162
169
|
/**
|
|
163
170
|
* TBD.
|
|
164
|
-
* @param duration - TBD.
|
|
165
|
-
* @param index - TBD.
|
|
171
|
+
* @param {number} duration - TBD.
|
|
172
|
+
* @param {number} index - TBD.
|
|
173
|
+
* @returns {Tween} TBD.
|
|
166
174
|
*/
|
|
167
175
|
delay(duration, index) {
|
|
168
176
|
return this.updateTweenData('delay', duration, index);
|
|
@@ -170,9 +178,10 @@ export class Tween {
|
|
|
170
178
|
|
|
171
179
|
/**
|
|
172
180
|
* TBD.
|
|
173
|
-
* @param total
|
|
174
|
-
* @param repeatDelay
|
|
175
|
-
* @param index - TBD.
|
|
181
|
+
* @param {number} total - TBD.
|
|
182
|
+
* @param {number} repeatDelay - TBD.
|
|
183
|
+
* @param {number} index - TBD.
|
|
184
|
+
* @returns {Tween} TBD.
|
|
176
185
|
*/
|
|
177
186
|
repeat(total, repeatDelay = 0, index = 0) {
|
|
178
187
|
this.updateTweenData('repeatCounter', total, index);
|
|
@@ -181,8 +190,9 @@ export class Tween {
|
|
|
181
190
|
|
|
182
191
|
/**
|
|
183
192
|
* TBD.
|
|
184
|
-
* @param duration - TBD.
|
|
185
|
-
* @param index - TBD.
|
|
193
|
+
* @param {number} duration - TBD.
|
|
194
|
+
* @param {number} index - TBD.
|
|
195
|
+
* @returns {Tween} TBD.
|
|
186
196
|
*/
|
|
187
197
|
repeatDelay(duration, index) {
|
|
188
198
|
return this.updateTweenData('repeatDelay', duration, index);
|
|
@@ -190,9 +200,10 @@ export class Tween {
|
|
|
190
200
|
|
|
191
201
|
/**
|
|
192
202
|
* TBD.
|
|
193
|
-
* @param enable
|
|
194
|
-
* @param yoyoDelay
|
|
195
|
-
* @param index - TBD.
|
|
203
|
+
* @param {boolean} enable - TBD.
|
|
204
|
+
* @param {number} yoyoDelay - TBD.
|
|
205
|
+
* @param {number} index - TBD.
|
|
206
|
+
* @returns {Tween} TBD.
|
|
196
207
|
*/
|
|
197
208
|
yoyo(enable, yoyoDelay = 0, index = 0) {
|
|
198
209
|
this.updateTweenData('yoyo', enable, index);
|
|
@@ -201,8 +212,9 @@ export class Tween {
|
|
|
201
212
|
|
|
202
213
|
/**
|
|
203
214
|
* TBD.
|
|
204
|
-
* @param duration - TBD.
|
|
205
|
-
* @param index - TBD.
|
|
215
|
+
* @param {number} duration - TBD.
|
|
216
|
+
* @param {number} index - TBD.
|
|
217
|
+
* @returns {Tween} TBD.
|
|
206
218
|
*/
|
|
207
219
|
yoyoDelay(duration, index) {
|
|
208
220
|
return this.updateTweenData('yoyoDelay', duration, index);
|
|
@@ -210,8 +222,9 @@ export class Tween {
|
|
|
210
222
|
|
|
211
223
|
/**
|
|
212
224
|
* TBD.
|
|
213
|
-
* @param ease - TBD.
|
|
214
|
-
* @param index - TBD.
|
|
225
|
+
* @param {string|Function} ease - TBD.
|
|
226
|
+
* @param {number} index - TBD.
|
|
227
|
+
* @returns {Tween} TBD.
|
|
215
228
|
*/
|
|
216
229
|
easing(ease, index) {
|
|
217
230
|
if (typeof ease === 'string' && this.manager.easeMap[ease]) {
|
|
@@ -222,9 +235,10 @@ export class Tween {
|
|
|
222
235
|
|
|
223
236
|
/**
|
|
224
237
|
* TBD.
|
|
225
|
-
* @param interpolation
|
|
226
|
-
* @param context
|
|
227
|
-
* @param index - TBD.
|
|
238
|
+
* @param interpolation - TBD.
|
|
239
|
+
* @param context - TBD.
|
|
240
|
+
* @param {number} index - TBD.
|
|
241
|
+
* @returns {Tween} TBD.
|
|
228
242
|
*/
|
|
229
243
|
interpolation(interpolation, context = MathUtils, index = 0) {
|
|
230
244
|
this.updateTweenData('interpolationFunction', interpolation, index);
|
|
@@ -233,7 +247,8 @@ export class Tween {
|
|
|
233
247
|
|
|
234
248
|
/**
|
|
235
249
|
* TBD.
|
|
236
|
-
* @param total
|
|
250
|
+
* @param {number} total - TBD.
|
|
251
|
+
* @returns {Tween} TBD.
|
|
237
252
|
*/
|
|
238
253
|
repeatAll(total = 0) {
|
|
239
254
|
this.repeatCounter = total;
|
|
@@ -242,7 +257,8 @@ export class Tween {
|
|
|
242
257
|
|
|
243
258
|
/**
|
|
244
259
|
* TBD.
|
|
245
|
-
* @param {...any} args
|
|
260
|
+
* @param {...any} args - TBD.
|
|
261
|
+
* @returns {Tween} TBD.
|
|
246
262
|
*/
|
|
247
263
|
chain(...args) {
|
|
248
264
|
let i = args.length;
|
|
@@ -259,7 +275,8 @@ export class Tween {
|
|
|
259
275
|
|
|
260
276
|
/**
|
|
261
277
|
* TBD.
|
|
262
|
-
* @param value
|
|
278
|
+
* @param {boolean} value - TBD.
|
|
279
|
+
* @returns {Tween} TBD.
|
|
263
280
|
*/
|
|
264
281
|
loop(value = true) {
|
|
265
282
|
this.repeatCounter = value ? -1 : 0;
|
|
@@ -269,7 +286,8 @@ export class Tween {
|
|
|
269
286
|
/**
|
|
270
287
|
* TBD.
|
|
271
288
|
* @param {Function} callback - TBD.
|
|
272
|
-
* @param callbackContext
|
|
289
|
+
* @param {object} callbackContext - TBD.
|
|
290
|
+
* @returns {Tween} TBD.
|
|
273
291
|
*/
|
|
274
292
|
onUpdateCallback(callback, callbackContext) {
|
|
275
293
|
this._onUpdateCallback = callback;
|
|
@@ -322,7 +340,8 @@ export class Tween {
|
|
|
322
340
|
|
|
323
341
|
/**
|
|
324
342
|
* TBD.
|
|
325
|
-
* @param time
|
|
343
|
+
* @param {number} time - TBD.
|
|
344
|
+
* @returns {boolean} TBD.
|
|
326
345
|
*/
|
|
327
346
|
update(time) {
|
|
328
347
|
if (this.pendingDelete || !this.target) {
|
|
@@ -404,8 +423,8 @@ export class Tween {
|
|
|
404
423
|
|
|
405
424
|
/**
|
|
406
425
|
* TBD.
|
|
407
|
-
* @param frameRate
|
|
408
|
-
* @param data
|
|
426
|
+
* @param {number} frameRate - TBD.
|
|
427
|
+
* @param data - TBD.
|
|
409
428
|
*/
|
|
410
429
|
generateData(frameRate = 60, data = []) {
|
|
411
430
|
if (this.game === null || this.target === null) {
|
|
@@ -435,6 +454,7 @@ export class Tween {
|
|
|
435
454
|
|
|
436
455
|
/**
|
|
437
456
|
* TBD.
|
|
457
|
+
* @returns {number} TBD.
|
|
438
458
|
*/
|
|
439
459
|
get totalDuration() {
|
|
440
460
|
let total = 0;
|
|
@@ -4,7 +4,7 @@ import { TWEEN_PENDING, TWEEN_RUNNING, TWEEN_COMPLETE, TWEEN_LOOPED } from './co
|
|
|
4
4
|
export class TweenData {
|
|
5
5
|
/**
|
|
6
6
|
* TBD.
|
|
7
|
-
* @param parent
|
|
7
|
+
* @param parent - TBD.
|
|
8
8
|
*/
|
|
9
9
|
constructor(parent) {
|
|
10
10
|
this.parent = parent;
|
|
@@ -35,12 +35,13 @@ export class TweenData {
|
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* TBD.
|
|
38
|
-
* @param properties
|
|
39
|
-
* @param duration - TBD.
|
|
40
|
-
* @param ease - TBD.
|
|
41
|
-
* @param delay - TBD.
|
|
42
|
-
* @param repeat
|
|
43
|
-
* @param yoyo
|
|
38
|
+
* @param {object} properties - TBD.
|
|
39
|
+
* @param {number} duration - TBD.
|
|
40
|
+
* @param {string} ease - TBD.
|
|
41
|
+
* @param {number} delay - TBD.
|
|
42
|
+
* @param {number} repeat - TBD.
|
|
43
|
+
* @param {boolean} yoyo - TBD.
|
|
44
|
+
* @returns {TweenData} TBD.
|
|
44
45
|
*/
|
|
45
46
|
to(properties, duration, ease, delay, repeat, yoyo) {
|
|
46
47
|
this.vEnd = properties;
|
|
@@ -55,12 +56,13 @@ export class TweenData {
|
|
|
55
56
|
|
|
56
57
|
/**
|
|
57
58
|
* TBD.
|
|
58
|
-
* @param properties
|
|
59
|
-
* @param duration - TBD.
|
|
60
|
-
* @param ease - TBD.
|
|
61
|
-
* @param delay - TBD.
|
|
62
|
-
* @param repeat
|
|
63
|
-
* @param yoyo
|
|
59
|
+
* @param {object} properties - TBD.
|
|
60
|
+
* @param {number} duration - TBD.
|
|
61
|
+
* @param {string} ease - TBD.
|
|
62
|
+
* @param {number} delay - TBD.
|
|
63
|
+
* @param {number} repeat - TBD.
|
|
64
|
+
* @param {boolean} yoyo - TBD.
|
|
65
|
+
* @returns {TweenData} TBD.
|
|
64
66
|
*/
|
|
65
67
|
from(properties, duration, ease, delay, repeat, yoyo) {
|
|
66
68
|
this.vEnd = properties;
|
|
@@ -75,6 +77,7 @@ export class TweenData {
|
|
|
75
77
|
|
|
76
78
|
/**
|
|
77
79
|
* TBD.
|
|
80
|
+
* @returns {TweenData} TBD.
|
|
78
81
|
*/
|
|
79
82
|
start() {
|
|
80
83
|
this.startTime = this.game.time.time + this.delay;
|
|
@@ -106,6 +109,7 @@ export class TweenData {
|
|
|
106
109
|
|
|
107
110
|
/**
|
|
108
111
|
* TBD.
|
|
112
|
+
* @returns {TweenData} TBD.
|
|
109
113
|
*/
|
|
110
114
|
loadValues() {
|
|
111
115
|
const keys = Object.keys(this.parent.properties);
|
|
@@ -142,7 +146,8 @@ export class TweenData {
|
|
|
142
146
|
|
|
143
147
|
/**
|
|
144
148
|
* TBD.
|
|
145
|
-
* @param time
|
|
149
|
+
* @param {number} time - TBD.
|
|
150
|
+
* @returns {number} TBD.
|
|
146
151
|
*/
|
|
147
152
|
update(time) {
|
|
148
153
|
if (!this.isRunning) {
|
|
@@ -184,7 +189,8 @@ export class TweenData {
|
|
|
184
189
|
|
|
185
190
|
/**
|
|
186
191
|
* TBD.
|
|
187
|
-
* @param frameRate
|
|
192
|
+
* @param {number} frameRate - TBD.
|
|
193
|
+
* @returns {object[]} TBD.
|
|
188
194
|
*/
|
|
189
195
|
generateData(frameRate) {
|
|
190
196
|
if (this.parent.reverse) {
|
|
@@ -232,6 +238,7 @@ export class TweenData {
|
|
|
232
238
|
|
|
233
239
|
/**
|
|
234
240
|
* TBD.
|
|
241
|
+
* @returns {number} TBD.
|
|
235
242
|
*/
|
|
236
243
|
repeat() {
|
|
237
244
|
// If not a yoyo and repeatCounter = 0 then we're done
|
|
@@ -94,6 +94,7 @@ export class TweenManager {
|
|
|
94
94
|
|
|
95
95
|
/**
|
|
96
96
|
* TBD.
|
|
97
|
+
* @returns {Tween[]} TBD.
|
|
97
98
|
*/
|
|
98
99
|
getAll() {
|
|
99
100
|
return this._tweens;
|
|
@@ -111,8 +112,8 @@ export class TweenManager {
|
|
|
111
112
|
|
|
112
113
|
/**
|
|
113
114
|
* TBD.
|
|
114
|
-
* @param obj
|
|
115
|
-
* @param children
|
|
115
|
+
* @param {object} obj - TBD.
|
|
116
|
+
* @param {object[]} children - TBD.
|
|
116
117
|
*/
|
|
117
118
|
removeFrom(obj, children) {
|
|
118
119
|
let i;
|
|
@@ -141,7 +142,7 @@ export class TweenManager {
|
|
|
141
142
|
|
|
142
143
|
/**
|
|
143
144
|
* TBD.
|
|
144
|
-
* @param tween
|
|
145
|
+
* @param {Tween} tween - TBD.
|
|
145
146
|
*/
|
|
146
147
|
add(tween) {
|
|
147
148
|
tween._manager = this;
|
|
@@ -150,7 +151,8 @@ export class TweenManager {
|
|
|
150
151
|
|
|
151
152
|
/**
|
|
152
153
|
* TBD.
|
|
153
|
-
* @param object
|
|
154
|
+
* @param {object} object - TBD.
|
|
155
|
+
* @returns {Tween} TBD.
|
|
154
156
|
*/
|
|
155
157
|
create(object) {
|
|
156
158
|
return new Tween(object, this.game, this);
|
|
@@ -158,7 +160,7 @@ export class TweenManager {
|
|
|
158
160
|
|
|
159
161
|
/**
|
|
160
162
|
* TBD.
|
|
161
|
-
* @param tween
|
|
163
|
+
* @param {Tween} tween - TBD.
|
|
162
164
|
*/
|
|
163
165
|
remove(tween) {
|
|
164
166
|
let i = this._tweens.indexOf(tween);
|
|
@@ -174,6 +176,7 @@ export class TweenManager {
|
|
|
174
176
|
|
|
175
177
|
/**
|
|
176
178
|
* TBD.
|
|
179
|
+
* @returns {boolean} TBD.
|
|
177
180
|
*/
|
|
178
181
|
update() {
|
|
179
182
|
const addTweens = this._add.length;
|
|
@@ -200,7 +203,8 @@ export class TweenManager {
|
|
|
200
203
|
|
|
201
204
|
/**
|
|
202
205
|
* TBD.
|
|
203
|
-
* @param object
|
|
206
|
+
* @param {object} object - TBD.
|
|
207
|
+
* @returns {boolean} TBD.
|
|
204
208
|
*/
|
|
205
209
|
isTweening(object) {
|
|
206
210
|
return this._tweens.some((tween) => tween.target === object);
|
|
@@ -70,7 +70,7 @@ export class BitmapText extends DisplayObject {
|
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* TBD.
|
|
73
|
-
* @param text - TBD.
|
|
73
|
+
* @param {string} text - TBD.
|
|
74
74
|
*/
|
|
75
75
|
setText(text) {
|
|
76
76
|
this.text = text;
|
|
@@ -78,9 +78,9 @@ export class BitmapText extends DisplayObject {
|
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
80
|
* TBD.
|
|
81
|
-
* @param data - TBD.
|
|
82
|
-
* @param scale - TBD.
|
|
83
|
-
* @param text - TBD.
|
|
81
|
+
* @param {object} data - TBD.
|
|
82
|
+
* @param {number} scale - TBD.
|
|
83
|
+
* @param {string} text - TBD.
|
|
84
84
|
* @returns {object} TBD.
|
|
85
85
|
*/
|
|
86
86
|
scanLine(data, scale, text) {
|
|
@@ -146,8 +146,8 @@ export class BitmapText extends DisplayObject {
|
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
* TBD.
|
|
149
|
-
* @param text - TBD.
|
|
150
|
-
* @param replace - TBD.
|
|
149
|
+
* @param {string} text - TBD.
|
|
150
|
+
* @param {string} replace - TBD.
|
|
151
151
|
* @returns {string} TBD.
|
|
152
152
|
*/
|
|
153
153
|
cleanText(text, replace = '') {
|
|
@@ -393,6 +393,7 @@ export class BitmapText extends DisplayObject {
|
|
|
393
393
|
|
|
394
394
|
/**
|
|
395
395
|
* TBD.
|
|
396
|
+
* @returns {number} TBD.
|
|
396
397
|
*/
|
|
397
398
|
get maxWidth() {
|
|
398
399
|
return this._maxWidth;
|
|
@@ -91,7 +91,7 @@ export function getFree() {
|
|
|
91
91
|
* @param {object} parent - TBD.
|
|
92
92
|
* @param {number} width - TBD.
|
|
93
93
|
* @param {number} height - TBD.
|
|
94
|
-
* @returns {
|
|
94
|
+
* @returns {HTMLCanvasElement} TBD.
|
|
95
95
|
*/
|
|
96
96
|
export function create(parent, width, height) {
|
|
97
97
|
if (parent === undefined) {
|
|
@@ -37,6 +37,7 @@ export class CanvasRenderer {
|
|
|
37
37
|
this.clearBeforeRender = game.config.clearBeforeRender;
|
|
38
38
|
this.transparent = game.config.transparent;
|
|
39
39
|
this.autoResize = false;
|
|
40
|
+
this.contextLost = false;
|
|
40
41
|
this.width = game.width * this.resolution;
|
|
41
42
|
this.height = game.height * this.resolution;
|
|
42
43
|
this.view = game.canvas;
|
|
@@ -59,7 +60,7 @@ export class CanvasRenderer {
|
|
|
59
60
|
|
|
60
61
|
/**
|
|
61
62
|
* TBD.
|
|
62
|
-
* @param root
|
|
63
|
+
* @param root - TBD.
|
|
63
64
|
*/
|
|
64
65
|
render(root) {
|
|
65
66
|
if (!this.context) {
|
|
@@ -84,7 +85,7 @@ export class CanvasRenderer {
|
|
|
84
85
|
|
|
85
86
|
/**
|
|
86
87
|
* TBD.
|
|
87
|
-
* @param removeView
|
|
88
|
+
* @param removeView - TBD.
|
|
88
89
|
*/
|
|
89
90
|
destroy(removeView = true) {
|
|
90
91
|
if (removeView && this.view.parent) {
|
|
@@ -116,8 +117,8 @@ export class CanvasRenderer {
|
|
|
116
117
|
|
|
117
118
|
/**
|
|
118
119
|
* TBD.
|
|
119
|
-
* @param displayObject
|
|
120
|
-
* @param context
|
|
120
|
+
* @param displayObject - TBD.
|
|
121
|
+
* @param context - TBD.
|
|
121
122
|
* @param matrix - TBD.
|
|
122
123
|
*/
|
|
123
124
|
renderDisplayObject(displayObject, context, matrix) {
|
|
@@ -40,7 +40,7 @@ export function setBackgroundColor(canvas, color) {
|
|
|
40
40
|
* @param {string} value - TBD.
|
|
41
41
|
* @returns {object} TBD.
|
|
42
42
|
*/
|
|
43
|
-
export function setTouchAction(canvas, value) {
|
|
43
|
+
export function setTouchAction(canvas, value = 'none') {
|
|
44
44
|
value = value || 'none';
|
|
45
45
|
canvas.style.msTouchAction = value;
|
|
46
46
|
canvas.style['ms-touch-action'] = value;
|
|
@@ -54,7 +54,7 @@ export function setTouchAction(canvas, value) {
|
|
|
54
54
|
* @param {string} value - TBD.
|
|
55
55
|
* @returns {object} TBD.
|
|
56
56
|
*/
|
|
57
|
-
export function setUserSelect(canvas, value) {
|
|
57
|
+
export function setUserSelect(canvas, value = 'none') {
|
|
58
58
|
value = value || 'none';
|
|
59
59
|
canvas.style['-webkit-touch-callout'] = value;
|
|
60
60
|
canvas.style['-webkit-user-select'] = value;
|
|
@@ -72,7 +72,8 @@ export class DisplayObject {
|
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
74
|
* TBD.
|
|
75
|
-
* @param child - TBD.
|
|
75
|
+
* @param {DisplayObject} child - TBD.
|
|
76
|
+
* @returns {DisplayObject} TBD.
|
|
76
77
|
*/
|
|
77
78
|
addChild(child) {
|
|
78
79
|
return this.addChildAt(child, this.children.length);
|
|
@@ -80,8 +81,10 @@ export class DisplayObject {
|
|
|
80
81
|
|
|
81
82
|
/**
|
|
82
83
|
* TBD.
|
|
83
|
-
* @param child - TBD.
|
|
84
|
+
* @param {DisplayObject} child - TBD.
|
|
84
85
|
* @param {number} index - TBD.
|
|
86
|
+
* @returns {DisplayObject} TBD.
|
|
87
|
+
* @throws Error.
|
|
85
88
|
*/
|
|
86
89
|
addChildAt(child, index) {
|
|
87
90
|
if (index >= 0 && index <= this.children.length) {
|
|
@@ -97,8 +100,9 @@ export class DisplayObject {
|
|
|
97
100
|
|
|
98
101
|
/**
|
|
99
102
|
* TBD.
|
|
100
|
-
* @param child - TBD.
|
|
101
|
-
* @param child2 - TBD.
|
|
103
|
+
* @param {DisplayObject} child - TBD.
|
|
104
|
+
* @param {DisplayObject} child2 - TBD.
|
|
105
|
+
* @throws Error.
|
|
102
106
|
*/
|
|
103
107
|
swapChildren(child, child2) {
|
|
104
108
|
if (child === child2) {
|
|
@@ -115,7 +119,9 @@ export class DisplayObject {
|
|
|
115
119
|
|
|
116
120
|
/**
|
|
117
121
|
* TBD.
|
|
118
|
-
* @param child - TBD.
|
|
122
|
+
* @param {DisplayObject} child - TBD.
|
|
123
|
+
* @returns {number} TBD.
|
|
124
|
+
* @throws Error.
|
|
119
125
|
*/
|
|
120
126
|
getChildIndex(child) {
|
|
121
127
|
const index = this.children.indexOf(child);
|
|
@@ -127,8 +133,9 @@ export class DisplayObject {
|
|
|
127
133
|
|
|
128
134
|
/**
|
|
129
135
|
* TBD.
|
|
130
|
-
* @param child - TBD.
|
|
136
|
+
* @param {DisplayObject} child - TBD.
|
|
131
137
|
* @param {number} index - TBD.
|
|
138
|
+
* @throws Error.
|
|
132
139
|
*/
|
|
133
140
|
setChildIndex(child, index) {
|
|
134
141
|
if (index < 0 || index >= this.children.length) {
|
|
@@ -142,6 +149,8 @@ export class DisplayObject {
|
|
|
142
149
|
/**
|
|
143
150
|
* TBD.
|
|
144
151
|
* @param {number} index - TBD.
|
|
152
|
+
* @returns {DisplayObject} TBD.
|
|
153
|
+
* @throws Error.
|
|
145
154
|
*/
|
|
146
155
|
getChildAt(index) {
|
|
147
156
|
if (index < 0 || index >= this.children.length) {
|
|
@@ -156,7 +165,8 @@ export class DisplayObject {
|
|
|
156
165
|
|
|
157
166
|
/**
|
|
158
167
|
* TBD.
|
|
159
|
-
* @param child - TBD.
|
|
168
|
+
* @param {DisplayObject} child - TBD.
|
|
169
|
+
* @returns {DisplayObject} TBD.
|
|
160
170
|
*/
|
|
161
171
|
removeChild(child) {
|
|
162
172
|
const index = this.children.indexOf(child);
|
|
@@ -169,6 +179,7 @@ export class DisplayObject {
|
|
|
169
179
|
/**
|
|
170
180
|
* TBD.
|
|
171
181
|
* @param {number} index - TBD.
|
|
182
|
+
* @returns {DisplayObject} TBD.
|
|
172
183
|
*/
|
|
173
184
|
removeChildAt(index) {
|
|
174
185
|
const child = this.getChildAt(index);
|
|
@@ -183,6 +194,8 @@ export class DisplayObject {
|
|
|
183
194
|
* TBD.
|
|
184
195
|
* @param {number} beginIndex - TBD.
|
|
185
196
|
* @param {number} endIndex - TBD.
|
|
197
|
+
* @returns {DisplayObject[]} TBD.
|
|
198
|
+
* @throws Error.
|
|
186
199
|
*/
|
|
187
200
|
removeChildren(beginIndex, endIndex) {
|
|
188
201
|
if (beginIndex === undefined) {
|
|
@@ -208,7 +221,8 @@ export class DisplayObject {
|
|
|
208
221
|
|
|
209
222
|
/**
|
|
210
223
|
* TBD.
|
|
211
|
-
* @param parent - TBD.
|
|
224
|
+
* @param {DisplayObject} parent - TBD.
|
|
225
|
+
* @returns {DisplayObject} TBD.
|
|
212
226
|
*/
|
|
213
227
|
updateTransform(parent) {
|
|
214
228
|
if (!parent && !this.parent) {
|
|
@@ -295,7 +309,8 @@ export class DisplayObject {
|
|
|
295
309
|
|
|
296
310
|
/**
|
|
297
311
|
* TBD.
|
|
298
|
-
* @param targetCoordinateSpace - TBD.
|
|
312
|
+
* @param {DisplayObject} targetCoordinateSpace - TBD.
|
|
313
|
+
* @returns {Rectangle} TBD.
|
|
299
314
|
*/
|
|
300
315
|
getBounds(targetCoordinateSpace) {
|
|
301
316
|
const isTargetCoordinateSpaceDisplayObject = targetCoordinateSpace && targetCoordinateSpace.contains !== undefined;
|
|
@@ -404,7 +419,7 @@ export class DisplayObject {
|
|
|
404
419
|
|
|
405
420
|
/**
|
|
406
421
|
* TBD.
|
|
407
|
-
* @param child - TBD.
|
|
422
|
+
* @param {DisplayObject} child - TBD.
|
|
408
423
|
* @returns {boolean} TBD.
|
|
409
424
|
*/
|
|
410
425
|
contains(child) {
|
|
@@ -419,7 +434,7 @@ export class DisplayObject {
|
|
|
419
434
|
|
|
420
435
|
/**
|
|
421
436
|
* TBD.
|
|
422
|
-
* @param renderSession - TBD.
|
|
437
|
+
* @param {object} renderSession - TBD.
|
|
423
438
|
*/
|
|
424
439
|
renderWebGL(renderSession) {
|
|
425
440
|
if (!this.visible || this.alpha <= 0) {
|
|
@@ -453,7 +468,7 @@ export class DisplayObject {
|
|
|
453
468
|
|
|
454
469
|
/**
|
|
455
470
|
* TBD.
|
|
456
|
-
* @param renderSession - TBD.
|
|
471
|
+
* @param {object} renderSession - TBD.
|
|
457
472
|
*/
|
|
458
473
|
renderCanvas(renderSession) {
|
|
459
474
|
if (!this.visible || this.alpha <= 0) {
|
|
@@ -501,7 +516,8 @@ export class DisplayObject {
|
|
|
501
516
|
|
|
502
517
|
/**
|
|
503
518
|
* TBD.
|
|
504
|
-
* @param position - TBD.
|
|
519
|
+
* @param {Point} position - TBD.
|
|
520
|
+
* @returns {Point} TBD.
|
|
505
521
|
*/
|
|
506
522
|
toGlobal(position) {
|
|
507
523
|
this.updateTransform();
|
|
@@ -510,8 +526,9 @@ export class DisplayObject {
|
|
|
510
526
|
|
|
511
527
|
/**
|
|
512
528
|
* TBD.
|
|
513
|
-
* @param position - TBD.
|
|
514
|
-
* @param from - TBD.
|
|
529
|
+
* @param {Point} position - TBD.
|
|
530
|
+
* @param {DisplayObject} from - TBD.
|
|
531
|
+
* @returns {Point} TBD.
|
|
515
532
|
*/
|
|
516
533
|
toLocal(position, from) {
|
|
517
534
|
if (from) {
|
|
@@ -523,7 +540,7 @@ export class DisplayObject {
|
|
|
523
540
|
|
|
524
541
|
/**
|
|
525
542
|
* TBD.
|
|
526
|
-
* @param renderSession - TBD.
|
|
543
|
+
* @param {object} renderSession - TBD.
|
|
527
544
|
*/
|
|
528
545
|
renderCachedSprite(renderSession) {
|
|
529
546
|
if (!this._cachedSprite) {
|