@vpmedia/phaser 1.116.0 → 1.117.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/dist/index.js +56 -96
- package/dist/index.js.map +1 -1
- package/dist/phaser/core/animation.d.ts.map +1 -1
- package/dist/phaser/core/animation_manager.d.ts +15 -14
- package/dist/phaser/core/animation_manager.d.ts.map +1 -1
- package/dist/phaser/core/animation_parser.d.ts.map +1 -1
- package/dist/phaser/core/array_set.d.ts.map +1 -1
- package/dist/phaser/core/cache.d.ts +10 -9
- package/dist/phaser/core/cache.d.ts.map +1 -1
- package/dist/phaser/core/device_util.d.ts.map +1 -1
- package/dist/phaser/core/dom.d.ts.map +1 -1
- package/dist/phaser/core/factory.d.ts.map +1 -1
- package/dist/phaser/core/game.d.ts.map +1 -1
- package/dist/phaser/core/input.d.ts +16 -16
- package/dist/phaser/core/input.d.ts.map +1 -1
- package/dist/phaser/core/input_handler.d.ts +11 -13
- package/dist/phaser/core/input_handler.d.ts.map +1 -1
- package/dist/phaser/core/input_mouse.d.ts.map +1 -1
- package/dist/phaser/core/input_mspointer.d.ts.map +1 -1
- package/dist/phaser/core/input_pointer.d.ts +19 -8
- package/dist/phaser/core/input_pointer.d.ts.map +1 -1
- package/dist/phaser/core/input_touch.d.ts.map +1 -1
- package/dist/phaser/core/loader.d.ts.map +1 -1
- package/dist/phaser/core/raf.d.ts.map +1 -1
- package/dist/phaser/core/scale_manager.d.ts +37 -12
- package/dist/phaser/core/scale_manager.d.ts.map +1 -1
- package/dist/phaser/core/scene.d.ts.map +1 -1
- package/dist/phaser/core/scene_manager.d.ts.map +1 -1
- package/dist/phaser/core/signal.d.ts.map +1 -1
- package/dist/phaser/core/signal_binding.d.ts.map +1 -1
- package/dist/phaser/core/sound.d.ts +2 -2
- package/dist/phaser/core/sound.d.ts.map +1 -1
- package/dist/phaser/core/sound_manager.d.ts +24 -22
- package/dist/phaser/core/sound_manager.d.ts.map +1 -1
- package/dist/phaser/core/sound_sprite.d.ts.map +1 -1
- package/dist/phaser/core/stage.d.ts.map +1 -1
- package/dist/phaser/core/time.d.ts.map +1 -1
- package/dist/phaser/core/timer.d.ts +1 -1
- package/dist/phaser/core/timer.d.ts.map +1 -1
- package/dist/phaser/core/tween.d.ts.map +1 -1
- package/dist/phaser/core/tween_data.d.ts +26 -26
- package/dist/phaser/core/tween_data.d.ts.map +1 -1
- package/dist/phaser/core/tween_manager.d.ts.map +1 -1
- package/dist/phaser/core/world.d.ts.map +1 -1
- package/dist/phaser/display/bitmap_text.d.ts.map +1 -1
- package/dist/phaser/display/button.d.ts.map +1 -1
- package/dist/phaser/display/canvas/buffer.d.ts.map +1 -1
- package/dist/phaser/display/canvas/graphics.d.ts.map +1 -1
- package/dist/phaser/display/canvas/masker.d.ts.map +1 -1
- package/dist/phaser/display/canvas/pool.d.ts.map +1 -1
- package/dist/phaser/display/canvas/renderer.d.ts.map +1 -1
- package/dist/phaser/display/canvas/tinter.d.ts +3 -2
- package/dist/phaser/display/canvas/tinter.d.ts.map +1 -1
- package/dist/phaser/display/canvas/util.d.ts.map +1 -1
- package/dist/phaser/display/display_object.d.ts.map +1 -1
- package/dist/phaser/display/graphics.d.ts.map +1 -1
- package/dist/phaser/display/graphics_data.d.ts.map +1 -1
- package/dist/phaser/display/graphics_data_util.d.ts.map +1 -1
- package/dist/phaser/display/group.d.ts.map +1 -1
- package/dist/phaser/display/image.d.ts +2 -2
- package/dist/phaser/display/image.d.ts.map +1 -1
- package/dist/phaser/display/sprite_util.d.ts.map +1 -1
- package/dist/phaser/display/text.d.ts.map +1 -1
- package/dist/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
- package/dist/phaser/display/webgl/base_texture.d.ts +12 -10
- package/dist/phaser/display/webgl/base_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/blend_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/earcut.d.ts.map +1 -1
- package/dist/phaser/display/webgl/fast_sprite_batch.d.ts +13 -12
- package/dist/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/webgl/filter_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/filter_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/graphics.d.ts +9 -7
- package/dist/phaser/display/webgl/graphics.d.ts.map +1 -1
- package/dist/phaser/display/webgl/graphics_data.d.ts.map +1 -1
- package/dist/phaser/display/webgl/mask_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/renderer.d.ts +12 -10
- package/dist/phaser/display/webgl/renderer.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/normal.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/texture.d.ts +18 -33
- package/dist/phaser/display/webgl/texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/texture_util.d.ts.map +1 -1
- package/dist/phaser/display/webgl/util.d.ts.map +1 -1
- package/dist/phaser/geom/circle.d.ts.map +1 -1
- package/dist/phaser/geom/ellipse.d.ts.map +1 -1
- package/dist/phaser/geom/line.d.ts.map +1 -1
- package/dist/phaser/geom/matrix.d.ts +1 -1
- package/dist/phaser/geom/matrix.d.ts.map +1 -1
- package/dist/phaser/geom/point.d.ts.map +1 -1
- package/dist/phaser/geom/polygon.d.ts.map +1 -1
- package/dist/phaser/geom/rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/rounded_rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/util/circle.d.ts.map +1 -1
- package/dist/phaser/geom/util/ellipse.d.ts.map +1 -1
- package/dist/phaser/geom/util/line.d.ts +5 -4
- package/dist/phaser/geom/util/line.d.ts.map +1 -1
- package/dist/phaser/geom/util/matrix.d.ts.map +1 -1
- package/dist/phaser/geom/util/point.d.ts.map +1 -1
- package/dist/phaser/geom/util/polygon.d.ts.map +1 -1
- package/dist/phaser/geom/util/rectangle.d.ts +10 -1
- package/dist/phaser/geom/util/rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/phaser/core/animation.ts +20 -20
- package/src/phaser/core/animation_manager.ts +27 -24
- package/src/phaser/core/animation_parser.ts +2 -2
- package/src/phaser/core/array_set.ts +7 -7
- package/src/phaser/core/cache.ts +55 -51
- package/src/phaser/core/device_util.ts +13 -13
- package/src/phaser/core/dom.ts +26 -22
- package/src/phaser/core/factory.ts +6 -6
- package/src/phaser/core/game.ts +10 -10
- package/src/phaser/core/input.ts +36 -38
- package/src/phaser/core/input_handler.ts +90 -93
- package/src/phaser/core/input_mouse.ts +19 -19
- package/src/phaser/core/input_mspointer.ts +15 -15
- package/src/phaser/core/input_pointer.ts +37 -28
- package/src/phaser/core/input_touch.ts +17 -17
- package/src/phaser/core/loader.ts +52 -52
- package/src/phaser/core/loader_parser.ts +3 -3
- package/src/phaser/core/raf.ts +3 -3
- package/src/phaser/core/scale_manager.ts +86 -67
- package/src/phaser/core/scene.ts +7 -7
- package/src/phaser/core/scene_manager.ts +16 -16
- package/src/phaser/core/signal.ts +29 -19
- package/src/phaser/core/signal_binding.ts +4 -4
- package/src/phaser/core/sound.ts +17 -17
- package/src/phaser/core/sound_manager.ts +71 -72
- package/src/phaser/core/sound_sprite.ts +1 -1
- package/src/phaser/core/stage.ts +7 -7
- package/src/phaser/core/time.ts +16 -16
- package/src/phaser/core/timer.ts +36 -26
- package/src/phaser/core/tween.ts +23 -23
- package/src/phaser/core/tween_data.ts +41 -37
- package/src/phaser/core/tween_manager.ts +11 -11
- package/src/phaser/core/world.ts +1 -1
- package/src/phaser/display/bitmap_text.ts +13 -13
- package/src/phaser/display/button.ts +13 -13
- package/src/phaser/display/canvas/buffer.ts +3 -3
- package/src/phaser/display/canvas/graphics.ts +3 -3
- package/src/phaser/display/canvas/masker.ts +2 -2
- package/src/phaser/display/canvas/pool.ts +6 -6
- package/src/phaser/display/canvas/renderer.ts +6 -6
- package/src/phaser/display/canvas/tinter.ts +39 -8
- package/src/phaser/display/canvas/util.ts +15 -9
- package/src/phaser/display/display_object.ts +38 -38
- package/src/phaser/display/graphics.ts +30 -30
- package/src/phaser/display/graphics_data.ts +1 -1
- package/src/phaser/display/graphics_data_util.ts +1 -1
- package/src/phaser/display/group.ts +16 -16
- package/src/phaser/display/image.ts +30 -26
- package/src/phaser/display/sprite_util.ts +12 -4
- package/src/phaser/display/text.ts +55 -55
- package/src/phaser/display/webgl/abstract_filter.ts +1 -1
- package/src/phaser/display/webgl/base_texture.ts +22 -18
- package/src/phaser/display/webgl/blend_manager.ts +3 -3
- package/src/phaser/display/webgl/earcut.ts +3 -3
- package/src/phaser/display/webgl/fast_sprite_batch.ts +26 -24
- package/src/phaser/display/webgl/filter_manager.ts +7 -7
- package/src/phaser/display/webgl/filter_texture.ts +3 -3
- package/src/phaser/display/webgl/graphics.ts +43 -41
- package/src/phaser/display/webgl/graphics_data.ts +2 -2
- package/src/phaser/display/webgl/mask_manager.ts +2 -2
- package/src/phaser/display/webgl/render_texture.ts +6 -6
- package/src/phaser/display/webgl/renderer.ts +20 -25
- package/src/phaser/display/webgl/shader/normal.ts +3 -3
- package/src/phaser/display/webgl/shader_manager.ts +2 -2
- package/src/phaser/display/webgl/sprite_batch.ts +9 -9
- package/src/phaser/display/webgl/stencil_manager.ts +4 -4
- package/src/phaser/display/webgl/texture.ts +23 -42
- package/src/phaser/display/webgl/texture_util.ts +2 -2
- package/src/phaser/display/webgl/util.ts +11 -7
- package/src/phaser/geom/circle.ts +21 -21
- package/src/phaser/geom/ellipse.ts +7 -7
- package/src/phaser/geom/line.ts +29 -29
- package/src/phaser/geom/matrix.ts +13 -13
- package/src/phaser/geom/point.ts +36 -30
- package/src/phaser/geom/polygon.ts +6 -6
- package/src/phaser/geom/rectangle.ts +42 -42
- package/src/phaser/geom/rounded_rectangle.ts +2 -2
- package/src/phaser/geom/util/circle.ts +7 -7
- package/src/phaser/geom/util/ellipse.ts +1 -1
- package/src/phaser/geom/util/line.ts +13 -5
- package/src/phaser/geom/util/matrix.ts +3 -3
- package/src/phaser/geom/util/point.ts +20 -20
- package/src/phaser/geom/util/polygon.ts +1 -1
- package/src/phaser/geom/util/rectangle.ts +34 -17
- package/src/phaser/geom/util/rounded_rectangle.ts +1 -1
package/src/phaser/core/timer.ts
CHANGED
|
@@ -68,7 +68,7 @@ export class Timer {
|
|
|
68
68
|
callback: Function,
|
|
69
69
|
callbackContext: unknown | null = null,
|
|
70
70
|
args: any = []
|
|
71
|
-
) {
|
|
71
|
+
): TimerEvent {
|
|
72
72
|
const roundedDelay = Math.round(delay);
|
|
73
73
|
let tick = roundedDelay;
|
|
74
74
|
if (this._now === 0) {
|
|
@@ -91,7 +91,12 @@ export class Timer {
|
|
|
91
91
|
* @param {...any} args - Arguments to pass to the callback function.
|
|
92
92
|
* @returns {TimerEvent} The created TimerEvent.
|
|
93
93
|
*/
|
|
94
|
-
public add(
|
|
94
|
+
public add(
|
|
95
|
+
delay: number,
|
|
96
|
+
callback: Function,
|
|
97
|
+
callbackContext: unknown | null = null,
|
|
98
|
+
...args: unknown[]
|
|
99
|
+
): TimerEvent {
|
|
95
100
|
return this.create(delay, false, 0, callback, callbackContext, args);
|
|
96
101
|
}
|
|
97
102
|
|
|
@@ -102,9 +107,9 @@ export class Timer {
|
|
|
102
107
|
* @param {...T} args - Arguments to pass to the resolve function.
|
|
103
108
|
* @returns {Promise<T | T[]>} The created Promise.
|
|
104
109
|
*/
|
|
105
|
-
public wait(delay: number, ...args: unknown[]) {
|
|
106
|
-
return new Promise((resolve) => {
|
|
107
|
-
this.create(delay, false, 0, () => {
|
|
110
|
+
public wait(delay: number, ...args: unknown[]): Promise<unknown> {
|
|
111
|
+
return new Promise((resolve): void => {
|
|
112
|
+
this.create(delay, false, 0, (): void => {
|
|
108
113
|
resolve(args.length <= 1 ? args[0] : args);
|
|
109
114
|
});
|
|
110
115
|
});
|
|
@@ -125,7 +130,7 @@ export class Timer {
|
|
|
125
130
|
callback: Function,
|
|
126
131
|
callbackContext: unknown | null = null,
|
|
127
132
|
...args: unknown[]
|
|
128
|
-
) {
|
|
133
|
+
): TimerEvent {
|
|
129
134
|
return this.create(delay, false, repeatCount, callback, callbackContext, args);
|
|
130
135
|
}
|
|
131
136
|
|
|
@@ -137,7 +142,12 @@ export class Timer {
|
|
|
137
142
|
* @param {...any} args - Arguments to pass to the callback function.
|
|
138
143
|
* @returns {TimerEvent} The created TimerEvent.
|
|
139
144
|
*/
|
|
140
|
-
public loop(
|
|
145
|
+
public loop(
|
|
146
|
+
delay: number,
|
|
147
|
+
callback: Function,
|
|
148
|
+
callbackContext: unknown | null = null,
|
|
149
|
+
...args: unknown[]
|
|
150
|
+
): TimerEvent {
|
|
141
151
|
return this.create(delay, true, 0, callback, callbackContext, args);
|
|
142
152
|
}
|
|
143
153
|
|
|
@@ -145,7 +155,7 @@ export class Timer {
|
|
|
145
155
|
* Starts the timer.
|
|
146
156
|
* @param {number} delay - The delay in milliseconds before starting (optional).
|
|
147
157
|
*/
|
|
148
|
-
public start(delay = 0) {
|
|
158
|
+
public start(delay = 0): void {
|
|
149
159
|
if (this.running) {
|
|
150
160
|
return;
|
|
151
161
|
}
|
|
@@ -160,7 +170,7 @@ export class Timer {
|
|
|
160
170
|
* Stops the timer.
|
|
161
171
|
* @param {boolean} clearEvents - Whether to clear all events (default: true).
|
|
162
172
|
*/
|
|
163
|
-
public stop(clearEvents = true) {
|
|
173
|
+
public stop(clearEvents = true): void {
|
|
164
174
|
this.running = false;
|
|
165
175
|
if (clearEvents) {
|
|
166
176
|
this.events.length = 0;
|
|
@@ -172,7 +182,7 @@ export class Timer {
|
|
|
172
182
|
* @param {TimerEvent | null | undefined} event - The TimerEvent to remove.
|
|
173
183
|
* @returns {boolean} True if the event was removed, false otherwise.
|
|
174
184
|
*/
|
|
175
|
-
public remove(event: TimerEvent | null | undefined) {
|
|
185
|
+
public remove(event: TimerEvent | null | undefined): boolean {
|
|
176
186
|
for (const candidate of this.events) {
|
|
177
187
|
if (candidate === event) {
|
|
178
188
|
candidate.pendingDelete = true;
|
|
@@ -185,7 +195,7 @@ export class Timer {
|
|
|
185
195
|
/**
|
|
186
196
|
* Orders the timer events by their next tick time.
|
|
187
197
|
*/
|
|
188
|
-
public order() {
|
|
198
|
+
public order(): void {
|
|
189
199
|
if (this.events.length > 0) {
|
|
190
200
|
// Sort the events so the one with the lowest tick is first
|
|
191
201
|
this.events.sort(this.sortHandler);
|
|
@@ -202,7 +212,7 @@ export class Timer {
|
|
|
202
212
|
* @param {TimerEvent} b - Second TimerEvent to compare.
|
|
203
213
|
* @returns {number} Comparison result (-1, 0, or 1).
|
|
204
214
|
*/
|
|
205
|
-
public sortHandler(a: TimerEvent, b: TimerEvent) {
|
|
215
|
+
public sortHandler(a: TimerEvent, b: TimerEvent): 1 | -1 | 0 {
|
|
206
216
|
if (a.tick < b.tick) {
|
|
207
217
|
return -1;
|
|
208
218
|
} else if (a.tick > b.tick) {
|
|
@@ -214,7 +224,7 @@ export class Timer {
|
|
|
214
224
|
/**
|
|
215
225
|
* Clears pending events from the timer.
|
|
216
226
|
*/
|
|
217
|
-
public clearPendingEvents() {
|
|
227
|
+
public clearPendingEvents(): void {
|
|
218
228
|
this._i = this.events.length;
|
|
219
229
|
while (this._i) {
|
|
220
230
|
this._i -= 1;
|
|
@@ -231,7 +241,7 @@ export class Timer {
|
|
|
231
241
|
* @param {number} time - The current time in milliseconds.
|
|
232
242
|
* @returns {boolean} True if the timer should continue running, false if it should be destroyed.
|
|
233
243
|
*/
|
|
234
|
-
public update(time: number) {
|
|
244
|
+
public update(time: number): boolean {
|
|
235
245
|
if (this.paused) {
|
|
236
246
|
return true;
|
|
237
247
|
}
|
|
@@ -293,7 +303,7 @@ export class Timer {
|
|
|
293
303
|
/**
|
|
294
304
|
* Pauses the timer.
|
|
295
305
|
*/
|
|
296
|
-
public pause() {
|
|
306
|
+
public pause(): void {
|
|
297
307
|
if (!this.running) {
|
|
298
308
|
return;
|
|
299
309
|
}
|
|
@@ -308,7 +318,7 @@ export class Timer {
|
|
|
308
318
|
/**
|
|
309
319
|
* Internal pause method for the timer.
|
|
310
320
|
*/
|
|
311
|
-
public _pause() {
|
|
321
|
+
public _pause(): void {
|
|
312
322
|
if (this.paused || !this.running) {
|
|
313
323
|
return;
|
|
314
324
|
}
|
|
@@ -320,7 +330,7 @@ export class Timer {
|
|
|
320
330
|
* Adjusts timer events when time has jumped (e.g., when tab is switched).
|
|
321
331
|
* @param {number} baseTime - The time to adjust from.
|
|
322
332
|
*/
|
|
323
|
-
public adjustEvents(baseTime: number) {
|
|
333
|
+
public adjustEvents(baseTime: number): void {
|
|
324
334
|
for (const event of this.events) {
|
|
325
335
|
if (!event.pendingDelete) {
|
|
326
336
|
// Work out how long there would have been from when the game paused until the events next tick
|
|
@@ -343,7 +353,7 @@ export class Timer {
|
|
|
343
353
|
/**
|
|
344
354
|
* Resumes the timer.
|
|
345
355
|
*/
|
|
346
|
-
public resume() {
|
|
356
|
+
public resume(): void {
|
|
347
357
|
if (!this.paused) {
|
|
348
358
|
return;
|
|
349
359
|
}
|
|
@@ -358,7 +368,7 @@ export class Timer {
|
|
|
358
368
|
/**
|
|
359
369
|
* Internal resume method for the timer.
|
|
360
370
|
*/
|
|
361
|
-
public _resume() {
|
|
371
|
+
public _resume(): void {
|
|
362
372
|
if (this._codePaused) {
|
|
363
373
|
return;
|
|
364
374
|
}
|
|
@@ -368,7 +378,7 @@ export class Timer {
|
|
|
368
378
|
/**
|
|
369
379
|
* Removes all events from the timer.
|
|
370
380
|
*/
|
|
371
|
-
public removeAll() {
|
|
381
|
+
public removeAll(): void {
|
|
372
382
|
this.onComplete.removeAll();
|
|
373
383
|
this.events.length = 0;
|
|
374
384
|
this._len = 0;
|
|
@@ -378,7 +388,7 @@ export class Timer {
|
|
|
378
388
|
/**
|
|
379
389
|
* Destroys the timer and cleans up resources.
|
|
380
390
|
*/
|
|
381
|
-
public destroy() {
|
|
391
|
+
public destroy(): void {
|
|
382
392
|
this.onComplete.removeAll();
|
|
383
393
|
this.running = false;
|
|
384
394
|
this.events = [];
|
|
@@ -390,7 +400,7 @@ export class Timer {
|
|
|
390
400
|
* Gets the next tick time for the timer.
|
|
391
401
|
* @returns {number} The next tick time in milliseconds.
|
|
392
402
|
*/
|
|
393
|
-
public get next() {
|
|
403
|
+
public get next(): number {
|
|
394
404
|
return this.nextTick;
|
|
395
405
|
}
|
|
396
406
|
|
|
@@ -398,7 +408,7 @@ export class Timer {
|
|
|
398
408
|
* Gets the duration until the next event.
|
|
399
409
|
* @returns {number} The duration in milliseconds.
|
|
400
410
|
*/
|
|
401
|
-
public get duration() {
|
|
411
|
+
public get duration(): number {
|
|
402
412
|
if (this.running && this.nextTick > this._now) {
|
|
403
413
|
return this.nextTick - this._now;
|
|
404
414
|
}
|
|
@@ -409,7 +419,7 @@ export class Timer {
|
|
|
409
419
|
* Gets the number of active events in the timer.
|
|
410
420
|
* @returns {number} The number of events.
|
|
411
421
|
*/
|
|
412
|
-
public get length() {
|
|
422
|
+
public get length(): number {
|
|
413
423
|
return this.events.length;
|
|
414
424
|
}
|
|
415
425
|
|
|
@@ -417,7 +427,7 @@ export class Timer {
|
|
|
417
427
|
* Gets the elapsed time since the timer started.
|
|
418
428
|
* @returns {number} The elapsed time in milliseconds.
|
|
419
429
|
*/
|
|
420
|
-
public get ms() {
|
|
430
|
+
public get ms(): number {
|
|
421
431
|
if (this.running) {
|
|
422
432
|
return this._now - this._started - this._pauseTotal;
|
|
423
433
|
}
|
|
@@ -428,7 +438,7 @@ export class Timer {
|
|
|
428
438
|
* Gets the elapsed time in seconds since the timer started.
|
|
429
439
|
* @returns {number} The elapsed time in seconds.
|
|
430
440
|
*/
|
|
431
|
-
public get seconds() {
|
|
441
|
+
public get seconds(): number {
|
|
432
442
|
if (this.running) {
|
|
433
443
|
return this.ms * 0.001;
|
|
434
444
|
}
|
package/src/phaser/core/tween.ts
CHANGED
|
@@ -98,7 +98,7 @@ export class Tween {
|
|
|
98
98
|
delay = 0,
|
|
99
99
|
repeat = 0,
|
|
100
100
|
yoyo = false
|
|
101
|
-
) {
|
|
101
|
+
): this {
|
|
102
102
|
if (typeof ease === 'string' && this.manager.easeMap[ease]) {
|
|
103
103
|
ease = this.manager.easeMap[ease];
|
|
104
104
|
}
|
|
@@ -131,7 +131,7 @@ export class Tween {
|
|
|
131
131
|
delay = 0,
|
|
132
132
|
repeat = 0,
|
|
133
133
|
yoyo = false
|
|
134
|
-
) {
|
|
134
|
+
): this {
|
|
135
135
|
if (typeof ease === 'string' && this.manager.easeMap[ease]) {
|
|
136
136
|
ease = this.manager.easeMap[ease];
|
|
137
137
|
}
|
|
@@ -151,7 +151,7 @@ export class Tween {
|
|
|
151
151
|
* @param {number} index - The index to start from in the timeline.
|
|
152
152
|
* @returns {Tween} This Tween object for chaining.
|
|
153
153
|
*/
|
|
154
|
-
public start(index = 0) {
|
|
154
|
+
public start(index = 0): this {
|
|
155
155
|
if (this.game === null || this.target === null || this.timeline.length === 0 || this.isRunning) {
|
|
156
156
|
return this;
|
|
157
157
|
}
|
|
@@ -186,7 +186,7 @@ export class Tween {
|
|
|
186
186
|
* @param {boolean} complete - Whether to dispatch the complete event.
|
|
187
187
|
* @returns {Tween} This Tween object for chaining.
|
|
188
188
|
*/
|
|
189
|
-
public stop(complete = false) {
|
|
189
|
+
public stop(complete = false): this {
|
|
190
190
|
this.isRunning = false;
|
|
191
191
|
this._onUpdateCallback = null;
|
|
192
192
|
this._onUpdateCallbackContext = null;
|
|
@@ -208,7 +208,7 @@ export class Tween {
|
|
|
208
208
|
* @param {number} index - The index in the timeline to update.
|
|
209
209
|
* @returns {Tween} This Tween object for chaining.
|
|
210
210
|
*/
|
|
211
|
-
public updateTweenData(property: string, value: any, index = 0) {
|
|
211
|
+
public updateTweenData(property: string, value: any, index = 0): this {
|
|
212
212
|
if (this.timeline.length === 0) {
|
|
213
213
|
return this;
|
|
214
214
|
}
|
|
@@ -228,7 +228,7 @@ export class Tween {
|
|
|
228
228
|
* @param {number} index - The index in the timeline to apply the delay to.
|
|
229
229
|
* @returns {Tween} This Tween object for chaining.
|
|
230
230
|
*/
|
|
231
|
-
public delay(duration: number, index: number) {
|
|
231
|
+
public delay(duration: number, index: number): this {
|
|
232
232
|
return this.updateTweenData('delay', duration, index);
|
|
233
233
|
}
|
|
234
234
|
|
|
@@ -239,7 +239,7 @@ export class Tween {
|
|
|
239
239
|
* @param {number} index - The index in the timeline to apply the repeat to.
|
|
240
240
|
* @returns {Tween} This Tween object for chaining.
|
|
241
241
|
*/
|
|
242
|
-
public repeat(total: number, repeatDelay = 0, index = 0) {
|
|
242
|
+
public repeat(total: number, repeatDelay = 0, index = 0): this {
|
|
243
243
|
this.updateTweenData('repeatCounter', total, index);
|
|
244
244
|
return this.updateTweenData('repeatDelay', repeatDelay, index);
|
|
245
245
|
}
|
|
@@ -250,7 +250,7 @@ export class Tween {
|
|
|
250
250
|
* @param {number} index - The index in the timeline to apply the delay to.
|
|
251
251
|
* @returns {Tween} This Tween object for chaining.
|
|
252
252
|
*/
|
|
253
|
-
public repeatDelay(duration: number, index: number) {
|
|
253
|
+
public repeatDelay(duration: number, index: number): this {
|
|
254
254
|
return this.updateTweenData('repeatDelay', duration, index);
|
|
255
255
|
}
|
|
256
256
|
|
|
@@ -261,7 +261,7 @@ export class Tween {
|
|
|
261
261
|
* @param {number} index - The index in the timeline to apply yoyo to.
|
|
262
262
|
* @returns {Tween} This Tween object for chaining.
|
|
263
263
|
*/
|
|
264
|
-
public yoyo(enable: boolean, yoyoDelay = 0, index = 0) {
|
|
264
|
+
public yoyo(enable: boolean, yoyoDelay = 0, index = 0): this {
|
|
265
265
|
this.updateTweenData('yoyo', enable, index);
|
|
266
266
|
return this.updateTweenData('yoyoDelay', yoyoDelay, index);
|
|
267
267
|
}
|
|
@@ -272,7 +272,7 @@ export class Tween {
|
|
|
272
272
|
* @param {number} index - The index in the timeline to apply the delay to.
|
|
273
273
|
* @returns {Tween} This Tween object for chaining.
|
|
274
274
|
*/
|
|
275
|
-
public yoyoDelay(duration: number, index: number) {
|
|
275
|
+
public yoyoDelay(duration: number, index: number): this {
|
|
276
276
|
return this.updateTweenData('yoyoDelay', duration, index);
|
|
277
277
|
}
|
|
278
278
|
|
|
@@ -282,7 +282,7 @@ export class Tween {
|
|
|
282
282
|
* @param {number} index - The index in the timeline to apply easing to.
|
|
283
283
|
* @returns {Tween} This Tween object for chaining.
|
|
284
284
|
*/
|
|
285
|
-
public easing(ease: string | Function, index: number) {
|
|
285
|
+
public easing(ease: string | Function, index: number): this {
|
|
286
286
|
if (typeof ease === 'string' && this.manager.easeMap[ease]) {
|
|
287
287
|
ease = this.manager.easeMap[ease];
|
|
288
288
|
}
|
|
@@ -296,7 +296,7 @@ export class Tween {
|
|
|
296
296
|
* @param {number} index - The index in the timeline to apply interpolation to.
|
|
297
297
|
* @returns {Tween} This Tween object for chaining.
|
|
298
298
|
*/
|
|
299
|
-
public interpolation(interpolation: Function, context: unknown = MathUtils, index = 0) {
|
|
299
|
+
public interpolation(interpolation: Function, context: unknown = MathUtils, index = 0): this {
|
|
300
300
|
this.updateTweenData('interpolationFunction', interpolation, index);
|
|
301
301
|
return this.updateTweenData('interpolationContext', context, index);
|
|
302
302
|
}
|
|
@@ -306,7 +306,7 @@ export class Tween {
|
|
|
306
306
|
* @param {number} total - The number of times to repeat (-1 for infinite).
|
|
307
307
|
* @returns {Tween} This Tween object for chaining.
|
|
308
308
|
*/
|
|
309
|
-
public repeatAll(total = 0) {
|
|
309
|
+
public repeatAll(total = 0): this {
|
|
310
310
|
this.repeatCounter = total;
|
|
311
311
|
return this;
|
|
312
312
|
}
|
|
@@ -316,7 +316,7 @@ export class Tween {
|
|
|
316
316
|
* @param {...any} args - The tweens to chain.
|
|
317
317
|
* @returns {Tween} This Tween object for chaining.
|
|
318
318
|
*/
|
|
319
|
-
public chain(...args: Tween[]) {
|
|
319
|
+
public chain(...args: Tween[]): this {
|
|
320
320
|
let i = args.length;
|
|
321
321
|
while (i) {
|
|
322
322
|
i -= 1;
|
|
@@ -334,7 +334,7 @@ export class Tween {
|
|
|
334
334
|
* @param {boolean} value - Whether to loop infinitely.
|
|
335
335
|
* @returns {Tween} This Tween object for chaining.
|
|
336
336
|
*/
|
|
337
|
-
public loop(value = true) {
|
|
337
|
+
public loop(value = true): this {
|
|
338
338
|
this.repeatCounter = value ? -1 : 0;
|
|
339
339
|
return this;
|
|
340
340
|
}
|
|
@@ -345,7 +345,7 @@ export class Tween {
|
|
|
345
345
|
* @param {object} callbackContext - The context in which to call the callback.
|
|
346
346
|
* @returns {Tween} This Tween object for chaining.
|
|
347
347
|
*/
|
|
348
|
-
public onUpdateCallback(callback: Function, callbackContext: unknown) {
|
|
348
|
+
public onUpdateCallback(callback: Function, callbackContext: unknown): this {
|
|
349
349
|
this._onUpdateCallback = callback;
|
|
350
350
|
this._onUpdateCallbackContext = callbackContext;
|
|
351
351
|
return this;
|
|
@@ -354,7 +354,7 @@ export class Tween {
|
|
|
354
354
|
/**
|
|
355
355
|
* Pauses the tween.
|
|
356
356
|
*/
|
|
357
|
-
public pause() {
|
|
357
|
+
public pause(): void {
|
|
358
358
|
this.isPaused = true;
|
|
359
359
|
this._codePaused = true;
|
|
360
360
|
this._pausedTime = this.game.time.time;
|
|
@@ -363,7 +363,7 @@ export class Tween {
|
|
|
363
363
|
/**
|
|
364
364
|
* Internal method to pause the tween.
|
|
365
365
|
*/
|
|
366
|
-
public _pause() {
|
|
366
|
+
public _pause(): void {
|
|
367
367
|
if (!this._codePaused) {
|
|
368
368
|
this.isPaused = true;
|
|
369
369
|
this._pausedTime = this.game.time.time;
|
|
@@ -373,13 +373,13 @@ export class Tween {
|
|
|
373
373
|
/**
|
|
374
374
|
* Resumes the tween.
|
|
375
375
|
*/
|
|
376
|
-
public resume() {
|
|
376
|
+
public resume(): void {
|
|
377
377
|
if (this.isPaused) {
|
|
378
378
|
this.isPaused = false;
|
|
379
379
|
this._codePaused = false;
|
|
380
380
|
for (const tweenData of this.timeline) {
|
|
381
381
|
if (!tweenData.isRunning) {
|
|
382
|
-
tweenData.startTime
|
|
382
|
+
tweenData.startTime = (tweenData.startTime ?? 0) + (this.game.time.time - this._pausedTime);
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
385
|
}
|
|
@@ -388,7 +388,7 @@ export class Tween {
|
|
|
388
388
|
/**
|
|
389
389
|
* Internal method to resume the tween.
|
|
390
390
|
*/
|
|
391
|
-
public _resume() {
|
|
391
|
+
public _resume(): void {
|
|
392
392
|
if (!this._codePaused) {
|
|
393
393
|
this.resume();
|
|
394
394
|
}
|
|
@@ -399,7 +399,7 @@ export class Tween {
|
|
|
399
399
|
* @param {number} time - The current game time.
|
|
400
400
|
* @returns {boolean} True if the tween should continue running, false if it's complete.
|
|
401
401
|
*/
|
|
402
|
-
public update(time: number) {
|
|
402
|
+
public update(time: number): boolean {
|
|
403
403
|
if (this.pendingDelete || !this.target) {
|
|
404
404
|
return false;
|
|
405
405
|
}
|
|
@@ -513,7 +513,7 @@ export class Tween {
|
|
|
513
513
|
* Gets the total duration of all timeline entries.
|
|
514
514
|
* @returns {number} The total duration in milliseconds.
|
|
515
515
|
*/
|
|
516
|
-
public get totalDuration() {
|
|
516
|
+
public get totalDuration(): number {
|
|
517
517
|
let total = 0;
|
|
518
518
|
for (const tweenData of this.timeline) {
|
|
519
519
|
total += tweenData.duration;
|
|
@@ -4,31 +4,31 @@ import { TWEEN_COMPLETE, TWEEN_LOOPED, TWEEN_PENDING, TWEEN_RUNNING } from './co
|
|
|
4
4
|
import type { Tween } from './tween.js';
|
|
5
5
|
|
|
6
6
|
export class TweenData {
|
|
7
|
-
public parent!:
|
|
7
|
+
public parent!: Tween;
|
|
8
8
|
public game!: Game;
|
|
9
|
-
public vStart!: any
|
|
10
|
-
public vStartCache!: any
|
|
11
|
-
public vEnd!: any
|
|
12
|
-
public vEndCache!: any
|
|
13
|
-
public duration!:
|
|
14
|
-
public percent!:
|
|
15
|
-
public value!:
|
|
16
|
-
public repeatCounter!:
|
|
17
|
-
public repeatDelay!:
|
|
18
|
-
public repeatTotal!:
|
|
19
|
-
public interpolate!:
|
|
20
|
-
public yoyo!:
|
|
21
|
-
public yoyoDelay!:
|
|
22
|
-
public inReverse!:
|
|
23
|
-
public delay!:
|
|
24
|
-
public dt!:
|
|
25
|
-
public startTime!:
|
|
26
|
-
public easingFunction!:
|
|
27
|
-
public interpolationFunction!:
|
|
28
|
-
public interpolationContext!:
|
|
29
|
-
public isRunning!:
|
|
30
|
-
public isFrom!:
|
|
31
|
-
public yoyoCounter!:
|
|
9
|
+
public vStart!: Record<string, any>;
|
|
10
|
+
public vStartCache!: Record<string, any>;
|
|
11
|
+
public vEnd!: Record<string, any>;
|
|
12
|
+
public vEndCache!: Record<string, any>;
|
|
13
|
+
public duration!: number;
|
|
14
|
+
public percent!: number;
|
|
15
|
+
public value!: number;
|
|
16
|
+
public repeatCounter!: number;
|
|
17
|
+
public repeatDelay!: number;
|
|
18
|
+
public repeatTotal!: number;
|
|
19
|
+
public interpolate!: boolean;
|
|
20
|
+
public yoyo!: boolean;
|
|
21
|
+
public yoyoDelay!: number;
|
|
22
|
+
public inReverse!: boolean;
|
|
23
|
+
public delay!: number;
|
|
24
|
+
public dt!: number;
|
|
25
|
+
public startTime!: number | null;
|
|
26
|
+
public easingFunction!: (k: number) => number;
|
|
27
|
+
public interpolationFunction!: Function;
|
|
28
|
+
public interpolationContext!: unknown;
|
|
29
|
+
public isRunning!: boolean;
|
|
30
|
+
public isFrom!: boolean;
|
|
31
|
+
public yoyoCounter!: number;
|
|
32
32
|
/**
|
|
33
33
|
* Creates a new TweenData instance.
|
|
34
34
|
* @param {Tween} parent - The parent Tween instance.
|
|
@@ -53,7 +53,7 @@ export class TweenData {
|
|
|
53
53
|
this.delay = 0;
|
|
54
54
|
this.dt = 0;
|
|
55
55
|
this.startTime = null;
|
|
56
|
-
this.easingFunction = (k: number) => k;
|
|
56
|
+
this.easingFunction = (k: number): number => k;
|
|
57
57
|
this.interpolationFunction = MathUtils.linearInterpolation;
|
|
58
58
|
this.interpolationContext = MathUtils;
|
|
59
59
|
this.isRunning = false;
|
|
@@ -70,7 +70,7 @@ export class TweenData {
|
|
|
70
70
|
* @param {boolean} yoyo - Whether to reverse the tween on each repeat.
|
|
71
71
|
* @returns {TweenData} This TweenData object for chaining.
|
|
72
72
|
*/
|
|
73
|
-
public to(properties: any, duration: number, ease: any, delay: number, repeat: number, yoyo: boolean) {
|
|
73
|
+
public to(properties: any, duration: number, ease: any, delay: number, repeat: number, yoyo: boolean): this {
|
|
74
74
|
this.vEnd = properties;
|
|
75
75
|
this.duration = duration;
|
|
76
76
|
this.easingFunction = ease;
|
|
@@ -91,7 +91,7 @@ export class TweenData {
|
|
|
91
91
|
* @param {boolean} yoyo - Whether to reverse the tween on each repeat.
|
|
92
92
|
* @returns {TweenData} This TweenData object for chaining.
|
|
93
93
|
*/
|
|
94
|
-
public from(properties: any, duration: number, ease: any, delay: number, repeat: number, yoyo: boolean) {
|
|
94
|
+
public from(properties: any, duration: number, ease: any, delay: number, repeat: number, yoyo: boolean): this {
|
|
95
95
|
this.vEnd = properties;
|
|
96
96
|
this.duration = duration;
|
|
97
97
|
this.easingFunction = ease;
|
|
@@ -106,7 +106,7 @@ export class TweenData {
|
|
|
106
106
|
* Starts the tween.
|
|
107
107
|
* @returns {TweenData} This TweenData object for chaining.
|
|
108
108
|
*/
|
|
109
|
-
public start() {
|
|
109
|
+
public start(): this {
|
|
110
110
|
this.startTime = this.game.time.time + this.delay;
|
|
111
111
|
if (this.parent.reverse) {
|
|
112
112
|
this.dt = this.duration;
|
|
@@ -124,7 +124,7 @@ export class TweenData {
|
|
|
124
124
|
for (const property of keys) {
|
|
125
125
|
this.vStart[property] = this.vEndCache[property];
|
|
126
126
|
this.vEnd[property] = this.vStartCache[property];
|
|
127
|
-
this.parent.target[property] = this.vStart[property];
|
|
127
|
+
(this.parent.target as unknown as Record<string, any>)[property] = this.vStart[property];
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
this.value = 0;
|
|
@@ -137,7 +137,7 @@ export class TweenData {
|
|
|
137
137
|
* Loads the tween values from the parent object.
|
|
138
138
|
* @returns {TweenData} This TweenData object for chaining.
|
|
139
139
|
*/
|
|
140
|
-
public loadValues() {
|
|
140
|
+
public loadValues(): this {
|
|
141
141
|
const keys = Object.keys(this.parent.properties);
|
|
142
142
|
for (const property of keys) {
|
|
143
143
|
// Load the property from the parent object
|
|
@@ -174,14 +174,14 @@ export class TweenData {
|
|
|
174
174
|
* @param {number} time - The current time in milliseconds.
|
|
175
175
|
* @returns {number} The tween status (TWEEN_PENDING, TWEEN_RUNNING, or TWEEN_COMPLETE).
|
|
176
176
|
*/
|
|
177
|
-
public update(time: number) {
|
|
177
|
+
public update(time: number): 1 | 0 | 3 | 2 {
|
|
178
178
|
if (!this.isRunning) {
|
|
179
|
-
if (time >= this.startTime) {
|
|
179
|
+
if (time >= (this.startTime ?? 0)) {
|
|
180
180
|
this.isRunning = true;
|
|
181
181
|
} else {
|
|
182
182
|
return TWEEN_PENDING;
|
|
183
183
|
}
|
|
184
|
-
} else if (time < this.startTime) {
|
|
184
|
+
} else if (time < (this.startTime ?? 0)) {
|
|
185
185
|
// Is Running, but is waiting to repeat
|
|
186
186
|
return TWEEN_RUNNING;
|
|
187
187
|
}
|
|
@@ -200,9 +200,13 @@ export class TweenData {
|
|
|
200
200
|
const start = this.vStart[property];
|
|
201
201
|
const end = this.vEnd[property];
|
|
202
202
|
if (Array.isArray(end)) {
|
|
203
|
-
this.parent.target[property] = this.interpolationFunction.call(
|
|
203
|
+
(this.parent.target as unknown as Record<string, any>)[property] = this.interpolationFunction.call(
|
|
204
|
+
this.interpolationContext,
|
|
205
|
+
end,
|
|
206
|
+
this.value
|
|
207
|
+
);
|
|
204
208
|
} else {
|
|
205
|
-
this.parent.target[property] = start + (end - start) * this.value;
|
|
209
|
+
(this.parent.target as unknown as Record<string, any>)[property] = start + (end - start) * this.value;
|
|
206
210
|
}
|
|
207
211
|
}
|
|
208
212
|
if ((!this.parent.reverse && this.percent === 1) || (this.parent.reverse && this.percent === 0)) {
|
|
@@ -216,7 +220,7 @@ export class TweenData {
|
|
|
216
220
|
* @param {number} frameRate - The frame rate to generate data for.
|
|
217
221
|
* @returns {object[]} An array of tween data points.
|
|
218
222
|
*/
|
|
219
|
-
public generateData(frameRate: number) {
|
|
223
|
+
public generateData(frameRate: number): Record<string, number>[] {
|
|
220
224
|
if (this.parent.reverse) {
|
|
221
225
|
this.dt = this.duration;
|
|
222
226
|
} else {
|
|
@@ -263,7 +267,7 @@ export class TweenData {
|
|
|
263
267
|
* Handles tween repetition logic.
|
|
264
268
|
* @returns {number} The tween status (TWEEN_LOOPED or TWEEN_COMPLETE).
|
|
265
269
|
*/
|
|
266
|
-
public repeat() {
|
|
270
|
+
public repeat(): 3 | 2 {
|
|
267
271
|
// If not a yoyo and repeatCounter = 0 then we're done
|
|
268
272
|
if (this.yoyo) {
|
|
269
273
|
// We're already in reverse mode, which means the yoyo has finished and there's no repeats, so end
|
|
@@ -111,7 +111,7 @@ export class TweenManager {
|
|
|
111
111
|
* Remove all tweens from the manager.
|
|
112
112
|
* This method removes all active and pending tweens.
|
|
113
113
|
*/
|
|
114
|
-
public removeAll() {
|
|
114
|
+
public removeAll(): void {
|
|
115
115
|
for (let i = 0; i < this._tweens.length; i += 1) {
|
|
116
116
|
this._tweens[i].pendingDelete = true;
|
|
117
117
|
}
|
|
@@ -123,7 +123,7 @@ export class TweenManager {
|
|
|
123
123
|
* @param {object} obj - The object to remove tweens from.
|
|
124
124
|
* @param {object[]} children - Optional array of child objects to remove tweens from.
|
|
125
125
|
*/
|
|
126
|
-
public removeFrom(obj: any, children: any[] | null = null) {
|
|
126
|
+
public removeFrom(obj: any, children: any[] | null = null): void {
|
|
127
127
|
let i;
|
|
128
128
|
let len;
|
|
129
129
|
if (Array.isArray(obj)) {
|
|
@@ -152,7 +152,7 @@ export class TweenManager {
|
|
|
152
152
|
* Add a tween to the manager.
|
|
153
153
|
* @param {Tween} tween - The tween to add.
|
|
154
154
|
*/
|
|
155
|
-
public add(tween: Tween) {
|
|
155
|
+
public add(tween: Tween): void {
|
|
156
156
|
tween.manager = this;
|
|
157
157
|
this._add.push(tween);
|
|
158
158
|
}
|
|
@@ -162,7 +162,7 @@ export class TweenManager {
|
|
|
162
162
|
* @param {object} object - The object to create a tween for.
|
|
163
163
|
* @returns {Tween} The created Tween object.
|
|
164
164
|
*/
|
|
165
|
-
public create(object: any) {
|
|
165
|
+
public create(object: any): Tween {
|
|
166
166
|
return new Tween(object, this.game, this);
|
|
167
167
|
}
|
|
168
168
|
|
|
@@ -170,7 +170,7 @@ export class TweenManager {
|
|
|
170
170
|
* Remove a tween from the manager.
|
|
171
171
|
* @param {Tween | null | undefined} tween - The tween to remove.
|
|
172
172
|
*/
|
|
173
|
-
public remove(tween: Tween | null | undefined) {
|
|
173
|
+
public remove(tween: Tween | null | undefined): void {
|
|
174
174
|
let i = this._tweens.indexOf(tween);
|
|
175
175
|
if (i !== -1) {
|
|
176
176
|
this._tweens[i].pendingDelete = true;
|
|
@@ -186,7 +186,7 @@ export class TweenManager {
|
|
|
186
186
|
* Update all tweens managed by this manager.
|
|
187
187
|
* @returns {boolean} True if any tweens were updated, false otherwise.
|
|
188
188
|
*/
|
|
189
|
-
public update() {
|
|
189
|
+
public update(): boolean {
|
|
190
190
|
const addTweens = this._add.length;
|
|
191
191
|
let numTweens = this._tweens.length;
|
|
192
192
|
if (numTweens === 0 && addTweens === 0) {
|
|
@@ -215,14 +215,14 @@ export class TweenManager {
|
|
|
215
215
|
* @returns {boolean} True if the object is being tweened, false otherwise.
|
|
216
216
|
*/
|
|
217
217
|
public isTweening(object: unknown): boolean {
|
|
218
|
-
return (this._tweens as Tween[]).some((tween: Tween) => tween.target === object);
|
|
218
|
+
return (this._tweens as Tween[]).some((tween: Tween): boolean => tween.target === object);
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
/**
|
|
222
222
|
* Pause all tweens managed by this manager.
|
|
223
223
|
* This method pauses all active tweens.
|
|
224
224
|
*/
|
|
225
|
-
public _pauseAll() {
|
|
225
|
+
public _pauseAll(): void {
|
|
226
226
|
for (let i = this._tweens.length - 1; i >= 0; i -= 1) {
|
|
227
227
|
this._tweens[i]._pause();
|
|
228
228
|
}
|
|
@@ -232,7 +232,7 @@ export class TweenManager {
|
|
|
232
232
|
* Resume all tweens managed by this manager.
|
|
233
233
|
* This method resumes all paused tweens.
|
|
234
234
|
*/
|
|
235
|
-
public _resumeAll() {
|
|
235
|
+
public _resumeAll(): void {
|
|
236
236
|
for (let i = this._tweens.length - 1; i >= 0; i -= 1) {
|
|
237
237
|
this._tweens[i]._resume();
|
|
238
238
|
}
|
|
@@ -242,7 +242,7 @@ export class TweenManager {
|
|
|
242
242
|
* Pause all tweens managed by this manager.
|
|
243
243
|
* This method pauses all active tweens.
|
|
244
244
|
*/
|
|
245
|
-
public pauseAll() {
|
|
245
|
+
public pauseAll(): void {
|
|
246
246
|
for (let i = this._tweens.length - 1; i >= 0; i -= 1) {
|
|
247
247
|
this._tweens[i].pause();
|
|
248
248
|
}
|
|
@@ -252,7 +252,7 @@ export class TweenManager {
|
|
|
252
252
|
* Resume all tweens managed by this manager.
|
|
253
253
|
* This method resumes all paused tweens.
|
|
254
254
|
*/
|
|
255
|
-
public resumeAll() {
|
|
255
|
+
public resumeAll(): void {
|
|
256
256
|
for (let i = this._tweens.length - 1; i >= 0; i -= 1) {
|
|
257
257
|
this._tweens[i].resume(true);
|
|
258
258
|
}
|
package/src/phaser/core/world.ts
CHANGED