@vpmedia/phaser 1.15.0 → 1.16.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 +3 -3
- package/package.json +6 -5
- package/src/index.js +15 -18
- package/src/phaser/core/animation.js +102 -6
- package/src/phaser/core/animation_manager.js +88 -10
- package/src/phaser/core/animation_parser.js +5 -18
- package/src/phaser/core/array_set.js +51 -5
- package/src/phaser/core/cache.js +291 -6
- package/src/phaser/core/const.js +107 -4
- package/src/phaser/core/device.js +3 -6
- package/src/phaser/core/device_util.js +3 -16
- package/src/phaser/core/dom.js +127 -29
- package/src/phaser/core/event_manager.js +128 -6
- package/src/phaser/core/factory.js +69 -34
- package/src/phaser/core/frame.js +43 -6
- package/src/phaser/core/frame_data.js +55 -5
- package/src/phaser/core/frame_util.js +7 -12
- package/src/phaser/core/game.js +35 -7
- package/src/phaser/core/input.js +116 -17
- package/src/phaser/core/input_handler.js +242 -42
- package/src/phaser/core/input_mouse.js +66 -5
- package/src/phaser/core/input_mspointer.js +40 -9
- package/src/phaser/core/input_pointer.js +79 -17
- package/src/phaser/core/input_touch.js +42 -5
- package/src/phaser/core/loader.js +274 -101
- package/src/phaser/core/loader_parser.js +2 -10
- package/src/phaser/core/raf.js +16 -5
- package/src/phaser/core/scale_manager.js +204 -39
- package/src/phaser/core/scene.js +24 -5
- package/src/phaser/core/scene_manager.js +81 -11
- package/src/phaser/core/signal.js +88 -11
- package/src/phaser/core/signal_binding.js +35 -15
- package/src/phaser/core/sound.js +99 -10
- package/src/phaser/core/sound_manager.js +89 -13
- package/src/phaser/core/sound_sprite.js +20 -5
- package/src/phaser/core/stage.js +43 -7
- package/src/phaser/core/time.js +67 -5
- package/src/phaser/core/timer.js +107 -30
- package/src/phaser/core/timer_event.js +11 -6
- package/src/phaser/core/tween.js +124 -30
- package/src/phaser/core/tween_data.js +42 -18
- package/src/phaser/core/tween_easing.js +1 -8
- package/src/phaser/core/tween_manager.js +47 -5
- package/src/phaser/core/world.js +9 -6
- package/src/phaser/display/bitmap_text.js +91 -10
- package/src/phaser/display/button.js +63 -12
- package/src/phaser/display/canvas/buffer.js +16 -6
- package/src/phaser/display/canvas/graphics.js +1 -13
- package/src/phaser/display/canvas/masker.js +0 -6
- package/src/phaser/display/canvas/pool.js +0 -7
- package/src/phaser/display/canvas/renderer.js +28 -8
- package/src/phaser/display/canvas/tinter.js +4 -43
- package/src/phaser/display/canvas/util.js +0 -6
- package/src/phaser/display/display_object.js +192 -20
- package/src/phaser/display/graphics.js +161 -26
- package/src/phaser/display/graphics_data.js +14 -6
- package/src/phaser/display/graphics_data_util.js +2 -8
- package/src/phaser/display/group.js +74 -9
- package/src/phaser/display/image.js +85 -9
- package/src/phaser/display/sprite_batch.js +3 -8
- package/src/phaser/display/sprite_util.js +3 -23
- package/src/phaser/display/text.js +331 -31
- package/src/phaser/display/webgl/abstract_filter.js +8 -7
- package/src/phaser/display/webgl/base_texture.js +20 -12
- package/src/phaser/display/webgl/blend_manager.js +14 -7
- package/src/phaser/display/webgl/earcut.js +4 -23
- package/src/phaser/display/webgl/earcut_node.js +6 -7
- package/src/phaser/display/webgl/fast_sprite_batch.js +34 -11
- package/src/phaser/display/webgl/filter_manager.js +25 -7
- package/src/phaser/display/webgl/filter_texture.js +21 -22
- package/src/phaser/display/webgl/graphics.js +5 -28
- package/src/phaser/display/webgl/graphics_data.js +10 -7
- package/src/phaser/display/webgl/mask_manager.js +0 -6
- package/src/phaser/display/webgl/render_texture.js +33 -21
- package/src/phaser/display/webgl/renderer.js +38 -11
- package/src/phaser/display/webgl/shader/complex.js +10 -6
- package/src/phaser/display/webgl/shader/fast.js +10 -6
- package/src/phaser/display/webgl/shader/normal.js +23 -32
- package/src/phaser/display/webgl/shader/primitive.js +10 -6
- package/src/phaser/display/webgl/shader/strip.js +10 -6
- package/src/phaser/display/webgl/shader_manager.js +18 -6
- package/src/phaser/display/webgl/sprite_batch.js +41 -8
- package/src/phaser/display/webgl/stencil_manager.js +28 -6
- package/src/phaser/display/webgl/texture.js +28 -15
- package/src/phaser/display/webgl/texture_util.js +0 -6
- package/src/phaser/display/webgl/util.js +0 -7
- package/src/phaser/geom/circle.js +123 -18
- package/src/phaser/geom/ellipse.js +39 -18
- package/src/phaser/geom/line.js +148 -16
- package/src/phaser/geom/matrix.js +73 -6
- package/src/phaser/geom/point.js +152 -6
- package/src/phaser/geom/polygon.js +42 -14
- package/src/phaser/geom/rectangle.js +233 -6
- package/src/phaser/geom/rounded_rectangle.js +10 -6
- package/src/phaser/geom/util/circle.js +3 -9
- package/src/phaser/geom/util/ellipse.js +0 -7
- package/src/phaser/geom/util/line.js +5 -14
- package/src/phaser/geom/util/matrix.js +1 -7
- package/src/phaser/geom/util/point.js +0 -6
- package/src/phaser/geom/util/polygon.js +1 -7
- package/src/phaser/geom/util/rectangle.js +1 -7
- package/src/phaser/geom/util/rounded_rectangle.js +1 -7
- package/src/phaser/util/math.js +3 -21
- package/types/index.d.ts +2 -1
- package/types/index.d.ts.map +1 -1
- package/types/phaser/core/animation.d.ts +105 -4
- package/types/phaser/core/animation.d.ts.map +1 -1
- package/types/phaser/core/animation_manager.d.ts +87 -0
- package/types/phaser/core/animation_manager.d.ts.map +1 -1
- package/types/phaser/core/animation_parser.d.ts +5 -4
- package/types/phaser/core/animation_parser.d.ts.map +1 -1
- package/types/phaser/core/array_set.d.ts +53 -7
- package/types/phaser/core/array_set.d.ts.map +1 -1
- package/types/phaser/core/cache.d.ts +346 -56
- package/types/phaser/core/cache.d.ts.map +1 -1
- package/types/phaser/core/const.d.ts +143 -40
- package/types/phaser/core/const.d.ts.map +1 -1
- package/types/phaser/core/device.d.ts +0 -5
- package/types/phaser/core/device.d.ts.map +1 -1
- package/types/phaser/core/device_util.d.ts +1 -1
- package/types/phaser/core/device_util.d.ts.map +1 -1
- package/types/phaser/core/dom.d.ts +119 -0
- package/types/phaser/core/dom.d.ts.map +1 -1
- package/types/phaser/core/event_manager.d.ts +127 -0
- package/types/phaser/core/event_manager.d.ts.map +1 -1
- package/types/phaser/core/factory.d.ts +74 -7
- package/types/phaser/core/factory.d.ts.map +1 -1
- package/types/phaser/core/frame.d.ts +64 -21
- package/types/phaser/core/frame.d.ts.map +1 -1
- package/types/phaser/core/frame_data.d.ts +61 -9
- package/types/phaser/core/frame_data.d.ts.map +1 -1
- package/types/phaser/core/frame_util.d.ts +10 -8
- package/types/phaser/core/frame_util.d.ts.map +1 -1
- package/types/phaser/core/game.d.ts +40 -6
- package/types/phaser/core/game.d.ts.map +1 -1
- package/types/phaser/core/input.d.ts +114 -3
- package/types/phaser/core/input.d.ts.map +1 -1
- package/types/phaser/core/input_handler.d.ts +257 -24
- package/types/phaser/core/input_handler.d.ts.map +1 -1
- package/types/phaser/core/input_mouse.d.ts +51 -4
- package/types/phaser/core/input_mouse.d.ts.map +1 -1
- package/types/phaser/core/input_mspointer.d.ts +43 -9
- package/types/phaser/core/input_mspointer.d.ts.map +1 -1
- package/types/phaser/core/input_pointer.d.ts +78 -2
- package/types/phaser/core/input_pointer.d.ts.map +1 -1
- package/types/phaser/core/input_touch.d.ts +45 -8
- package/types/phaser/core/input_touch.d.ts.map +1 -1
- package/types/phaser/core/loader.d.ts +264 -19
- package/types/phaser/core/loader.d.ts.map +1 -1
- package/types/phaser/core/loader_parser.d.ts.map +1 -1
- package/types/phaser/core/raf.d.ts +17 -7
- package/types/phaser/core/raf.d.ts.map +1 -1
- package/types/phaser/core/scale_manager.d.ts +201 -6
- package/types/phaser/core/scale_manager.d.ts.map +1 -1
- package/types/phaser/core/scene.d.ts +21 -5
- package/types/phaser/core/scene.d.ts.map +1 -1
- package/types/phaser/core/scene_manager.d.ts +90 -10
- package/types/phaser/core/scene_manager.d.ts.map +1 -1
- package/types/phaser/core/signal.d.ts +93 -9
- package/types/phaser/core/signal.d.ts.map +1 -1
- package/types/phaser/core/signal_binding.d.ts +34 -5
- package/types/phaser/core/signal_binding.d.ts.map +1 -1
- package/types/phaser/core/sound.d.ts +111 -14
- package/types/phaser/core/sound.d.ts.map +1 -1
- package/types/phaser/core/sound_manager.d.ts +93 -7
- package/types/phaser/core/sound_manager.d.ts.map +1 -1
- package/types/phaser/core/sound_sprite.d.ts +22 -8
- package/types/phaser/core/sound_sprite.d.ts.map +1 -1
- package/types/phaser/core/stage.d.ts +32 -3
- package/types/phaser/core/stage.d.ts.map +1 -1
- package/types/phaser/core/time.d.ts +73 -6
- package/types/phaser/core/time.d.ts.map +1 -1
- package/types/phaser/core/timer.d.ts +103 -2
- package/types/phaser/core/timer.d.ts.map +1 -1
- package/types/phaser/core/timer_event.d.ts +11 -5
- package/types/phaser/core/timer_event.d.ts.map +1 -1
- package/types/phaser/core/tween.d.ts +122 -2
- package/types/phaser/core/tween.d.ts.map +1 -1
- package/types/phaser/core/tween_data.d.ts +41 -2
- package/types/phaser/core/tween_data.d.ts.map +1 -1
- package/types/phaser/core/tween_easing.d.ts +0 -5
- package/types/phaser/core/tween_easing.d.ts.map +1 -1
- package/types/phaser/core/tween_manager.d.ts +49 -2
- package/types/phaser/core/tween_manager.d.ts.map +1 -1
- package/types/phaser/core/world.d.ts +9 -1
- package/types/phaser/core/world.d.ts.map +1 -1
- package/types/phaser/display/bitmap_text.d.ts +84 -7
- package/types/phaser/display/bitmap_text.d.ts.map +1 -1
- package/types/phaser/display/button.d.ts +65 -8
- package/types/phaser/display/button.d.ts.map +1 -1
- package/types/phaser/display/canvas/buffer.d.ts +20 -4
- package/types/phaser/display/canvas/buffer.d.ts.map +1 -1
- package/types/phaser/display/canvas/graphics.d.ts.map +1 -1
- package/types/phaser/display/canvas/masker.d.ts.map +1 -1
- package/types/phaser/display/canvas/pool.d.ts +0 -6
- package/types/phaser/display/canvas/pool.d.ts.map +1 -1
- package/types/phaser/display/canvas/renderer.d.ts +29 -2
- package/types/phaser/display/canvas/renderer.d.ts.map +1 -1
- package/types/phaser/display/canvas/tinter.d.ts.map +1 -1
- package/types/phaser/display/canvas/util.d.ts.map +1 -1
- package/types/phaser/display/display_object.d.ts +195 -8
- package/types/phaser/display/display_object.d.ts.map +1 -1
- package/types/phaser/display/graphics.d.ts +132 -6
- package/types/phaser/display/graphics.d.ts.map +1 -1
- package/types/phaser/display/graphics_data.d.ts +15 -1
- package/types/phaser/display/graphics_data.d.ts.map +1 -1
- package/types/phaser/display/graphics_data_util.d.ts +3 -2
- package/types/phaser/display/graphics_data_util.d.ts.map +1 -1
- package/types/phaser/display/group.d.ts +62 -0
- package/types/phaser/display/group.d.ts.map +1 -1
- package/types/phaser/display/image.d.ts +66 -2
- package/types/phaser/display/image.d.ts.map +1 -1
- package/types/phaser/display/sprite_batch.d.ts +4 -3
- package/types/phaser/display/sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/sprite_util.d.ts.map +1 -1
- package/types/phaser/display/text.d.ts +366 -46
- package/types/phaser/display/text.d.ts.map +1 -1
- package/types/phaser/display/webgl/abstract_filter.d.ts +8 -6
- package/types/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
- package/types/phaser/display/webgl/base_texture.d.ts +20 -1
- package/types/phaser/display/webgl/base_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/blend_manager.d.ts +11 -6
- package/types/phaser/display/webgl/blend_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/earcut.d.ts.map +1 -1
- package/types/phaser/display/webgl/earcut_node.d.ts +9 -9
- package/types/phaser/display/webgl/earcut_node.d.ts.map +1 -1
- package/types/phaser/display/webgl/fast_sprite_batch.d.ts +33 -6
- package/types/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/webgl/filter_manager.d.ts +22 -6
- package/types/phaser/display/webgl/filter_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/filter_texture.d.ts +21 -3
- package/types/phaser/display/webgl/filter_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/graphics.d.ts.map +1 -1
- package/types/phaser/display/webgl/graphics_data.d.ts +10 -6
- package/types/phaser/display/webgl/graphics_data.d.ts.map +1 -1
- package/types/phaser/display/webgl/mask_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/render_texture.d.ts +30 -3
- package/types/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/renderer.d.ts +41 -4
- package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/complex.d.ts +10 -0
- package/types/phaser/display/webgl/shader/complex.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/fast.d.ts +10 -0
- package/types/phaser/display/webgl/shader/fast.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/normal.d.ts +20 -0
- package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/primitive.d.ts +10 -0
- package/types/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/strip.d.ts +10 -0
- package/types/phaser/display/webgl/shader/strip.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader_manager.d.ts +15 -0
- package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/sprite_batch.d.ts +37 -0
- package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/webgl/stencil_manager.d.ts +25 -0
- package/types/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/texture.d.ts +21 -0
- package/types/phaser/display/webgl/texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/texture_util.d.ts.map +1 -1
- package/types/phaser/display/webgl/util.d.ts +0 -6
- package/types/phaser/display/webgl/util.d.ts.map +1 -1
- package/types/phaser/geom/circle.d.ts +131 -9
- package/types/phaser/geom/circle.d.ts.map +1 -1
- package/types/phaser/geom/ellipse.d.ts +43 -5
- package/types/phaser/geom/ellipse.d.ts.map +1 -1
- package/types/phaser/geom/line.d.ts +159 -13
- package/types/phaser/geom/line.d.ts.map +1 -1
- package/types/phaser/geom/matrix.d.ts +85 -11
- package/types/phaser/geom/matrix.d.ts.map +1 -1
- package/types/phaser/geom/point.d.ts +170 -18
- package/types/phaser/geom/point.d.ts.map +1 -1
- package/types/phaser/geom/polygon.d.ts +45 -5
- package/types/phaser/geom/polygon.d.ts.map +1 -1
- package/types/phaser/geom/rectangle.d.ts +253 -20
- package/types/phaser/geom/rectangle.d.ts.map +1 -1
- package/types/phaser/geom/rounded_rectangle.d.ts +11 -1
- package/types/phaser/geom/rounded_rectangle.d.ts.map +1 -1
- package/types/phaser/geom/util/circle.d.ts +3 -3
- package/types/phaser/geom/util/circle.d.ts.map +1 -1
- package/types/phaser/geom/util/ellipse.d.ts +0 -6
- package/types/phaser/geom/util/ellipse.d.ts.map +1 -1
- package/types/phaser/geom/util/line.d.ts +5 -5
- package/types/phaser/geom/util/line.d.ts.map +1 -1
- package/types/phaser/geom/util/matrix.d.ts.map +1 -1
- package/types/phaser/geom/util/point.d.ts.map +1 -1
- package/types/phaser/geom/util/polygon.d.ts.map +1 -1
- package/types/phaser/geom/util/rectangle.d.ts.map +1 -1
- package/types/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
- package/types/phaser/util/math.d.ts +0 -5
- package/types/phaser/util/math.d.ts.map +1 -1
package/src/phaser/core/tween.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
3
|
-
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
4
|
-
* @author Richard Davey <rich@photonstorm.com>
|
|
5
|
-
*/
|
|
6
|
-
import { Signal } from './signal';
|
|
1
|
+
import { Signal } from './signal';
|
|
7
2
|
import { TweenData } from './tween_data';
|
|
8
3
|
import * as MathUtils from '../util/math';
|
|
9
4
|
import { TWEEN_PENDING, TWEEN_RUNNING, TWEEN_COMPLETE, TWEEN_LOOPED } from './const';
|
|
5
|
+
import { Game } from './game';
|
|
10
6
|
|
|
11
7
|
export class Tween {
|
|
8
|
+
/**
|
|
9
|
+
* TBD.
|
|
10
|
+
* @param target - TBD.
|
|
11
|
+
* @param {Game} game - TBD.
|
|
12
|
+
* @param manager
|
|
13
|
+
*/
|
|
12
14
|
constructor(target, game, manager) {
|
|
13
15
|
this.game = game;
|
|
14
16
|
this.target = target;
|
|
@@ -35,15 +37,17 @@ export class Tween {
|
|
|
35
37
|
this._hasStarted = false;
|
|
36
38
|
}
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
/**
|
|
41
|
+
* 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
|
|
49
|
+
*/
|
|
50
|
+
to(properties, duration = 1000, ease = 'Linear', autoStart = false, delay = 0, repeat = 0, yoyo = false) {
|
|
47
51
|
if (typeof ease === 'string' && this.manager.easeMap[ease]) {
|
|
48
52
|
ease = this.manager.easeMap[ease];
|
|
49
53
|
}
|
|
@@ -57,15 +61,17 @@ export class Tween {
|
|
|
57
61
|
return this;
|
|
58
62
|
}
|
|
59
63
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
/**
|
|
65
|
+
* 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
|
|
73
|
+
*/
|
|
74
|
+
from(properties, duration = 1000, ease = 'Linear', autoStart = false, delay = 0, repeat = 0, yoyo = false) {
|
|
69
75
|
if (typeof ease === 'string' && this.manager.easeMap[ease]) {
|
|
70
76
|
ease = this.manager.easeMap[ease];
|
|
71
77
|
}
|
|
@@ -80,13 +86,12 @@ export class Tween {
|
|
|
80
86
|
return this;
|
|
81
87
|
}
|
|
82
88
|
|
|
89
|
+
/**
|
|
90
|
+
* TBD.
|
|
91
|
+
* @param index - TBD.
|
|
92
|
+
*/
|
|
83
93
|
start(index = 0) {
|
|
84
|
-
if (
|
|
85
|
-
this.game === null ||
|
|
86
|
-
this.target === null ||
|
|
87
|
-
this.timeline.length === 0 ||
|
|
88
|
-
this.isRunning
|
|
89
|
-
) {
|
|
94
|
+
if (this.game === null || this.target === null || this.timeline.length === 0 || this.isRunning) {
|
|
90
95
|
return this;
|
|
91
96
|
}
|
|
92
97
|
// Populate the tween data
|
|
@@ -115,6 +120,10 @@ export class Tween {
|
|
|
115
120
|
return this;
|
|
116
121
|
}
|
|
117
122
|
|
|
123
|
+
/**
|
|
124
|
+
* TBD.
|
|
125
|
+
* @param complete
|
|
126
|
+
*/
|
|
118
127
|
stop(complete = false) {
|
|
119
128
|
this.isRunning = false;
|
|
120
129
|
this._onUpdateCallback = null;
|
|
@@ -130,6 +139,12 @@ export class Tween {
|
|
|
130
139
|
return this;
|
|
131
140
|
}
|
|
132
141
|
|
|
142
|
+
/**
|
|
143
|
+
* TBD.
|
|
144
|
+
* @param property
|
|
145
|
+
* @param value
|
|
146
|
+
* @param index - TBD.
|
|
147
|
+
*/
|
|
133
148
|
updateTweenData(property, value, index = 0) {
|
|
134
149
|
if (this.timeline.length === 0) {
|
|
135
150
|
return this;
|
|
@@ -144,28 +159,60 @@ export class Tween {
|
|
|
144
159
|
return this;
|
|
145
160
|
}
|
|
146
161
|
|
|
162
|
+
/**
|
|
163
|
+
* TBD.
|
|
164
|
+
* @param duration - TBD.
|
|
165
|
+
* @param index - TBD.
|
|
166
|
+
*/
|
|
147
167
|
delay(duration, index) {
|
|
148
168
|
return this.updateTweenData('delay', duration, index);
|
|
149
169
|
}
|
|
150
170
|
|
|
171
|
+
/**
|
|
172
|
+
* TBD.
|
|
173
|
+
* @param total
|
|
174
|
+
* @param repeatDelay
|
|
175
|
+
* @param index - TBD.
|
|
176
|
+
*/
|
|
151
177
|
repeat(total, repeatDelay = 0, index = 0) {
|
|
152
178
|
this.updateTweenData('repeatCounter', total, index);
|
|
153
179
|
return this.updateTweenData('repeatDelay', repeatDelay, index);
|
|
154
180
|
}
|
|
155
181
|
|
|
182
|
+
/**
|
|
183
|
+
* TBD.
|
|
184
|
+
* @param duration - TBD.
|
|
185
|
+
* @param index - TBD.
|
|
186
|
+
*/
|
|
156
187
|
repeatDelay(duration, index) {
|
|
157
188
|
return this.updateTweenData('repeatDelay', duration, index);
|
|
158
189
|
}
|
|
159
190
|
|
|
191
|
+
/**
|
|
192
|
+
* TBD.
|
|
193
|
+
* @param enable
|
|
194
|
+
* @param yoyoDelay
|
|
195
|
+
* @param index - TBD.
|
|
196
|
+
*/
|
|
160
197
|
yoyo(enable, yoyoDelay = 0, index = 0) {
|
|
161
198
|
this.updateTweenData('yoyo', enable, index);
|
|
162
199
|
return this.updateTweenData('yoyoDelay', yoyoDelay, index);
|
|
163
200
|
}
|
|
164
201
|
|
|
202
|
+
/**
|
|
203
|
+
* TBD.
|
|
204
|
+
* @param duration - TBD.
|
|
205
|
+
* @param index - TBD.
|
|
206
|
+
*/
|
|
165
207
|
yoyoDelay(duration, index) {
|
|
166
208
|
return this.updateTweenData('yoyoDelay', duration, index);
|
|
167
209
|
}
|
|
168
210
|
|
|
211
|
+
/**
|
|
212
|
+
* TBD.
|
|
213
|
+
* @param ease - TBD.
|
|
214
|
+
* @param index - TBD.
|
|
215
|
+
*/
|
|
169
216
|
easing(ease, index) {
|
|
170
217
|
if (typeof ease === 'string' && this.manager.easeMap[ease]) {
|
|
171
218
|
ease = this.manager.easeMap[ease];
|
|
@@ -173,16 +220,30 @@ export class Tween {
|
|
|
173
220
|
return this.updateTweenData('easingFunction', ease, index);
|
|
174
221
|
}
|
|
175
222
|
|
|
223
|
+
/**
|
|
224
|
+
* TBD.
|
|
225
|
+
* @param interpolation
|
|
226
|
+
* @param context
|
|
227
|
+
* @param index - TBD.
|
|
228
|
+
*/
|
|
176
229
|
interpolation(interpolation, context = MathUtils, index = 0) {
|
|
177
230
|
this.updateTweenData('interpolationFunction', interpolation, index);
|
|
178
231
|
return this.updateTweenData('interpolationContext', context, index);
|
|
179
232
|
}
|
|
180
233
|
|
|
234
|
+
/**
|
|
235
|
+
* TBD.
|
|
236
|
+
* @param total
|
|
237
|
+
*/
|
|
181
238
|
repeatAll(total = 0) {
|
|
182
239
|
this.repeatCounter = total;
|
|
183
240
|
return this;
|
|
184
241
|
}
|
|
185
242
|
|
|
243
|
+
/**
|
|
244
|
+
* TBD.
|
|
245
|
+
* @param {...any} args
|
|
246
|
+
*/
|
|
186
247
|
chain(...args) {
|
|
187
248
|
let i = args.length;
|
|
188
249
|
while (i) {
|
|
@@ -196,23 +257,38 @@ export class Tween {
|
|
|
196
257
|
return this;
|
|
197
258
|
}
|
|
198
259
|
|
|
260
|
+
/**
|
|
261
|
+
* TBD.
|
|
262
|
+
* @param value
|
|
263
|
+
*/
|
|
199
264
|
loop(value = true) {
|
|
200
265
|
this.repeatCounter = value ? -1 : 0;
|
|
201
266
|
return this;
|
|
202
267
|
}
|
|
203
268
|
|
|
269
|
+
/**
|
|
270
|
+
* TBD.
|
|
271
|
+
* @param callback - TBD.
|
|
272
|
+
* @param callbackContext
|
|
273
|
+
*/
|
|
204
274
|
onUpdateCallback(callback, callbackContext) {
|
|
205
275
|
this._onUpdateCallback = callback;
|
|
206
276
|
this._onUpdateCallbackContext = callbackContext;
|
|
207
277
|
return this;
|
|
208
278
|
}
|
|
209
279
|
|
|
280
|
+
/**
|
|
281
|
+
* TBD.
|
|
282
|
+
*/
|
|
210
283
|
pause() {
|
|
211
284
|
this.isPaused = true;
|
|
212
285
|
this._codePaused = true;
|
|
213
286
|
this._pausedTime = this.game.time.time;
|
|
214
287
|
}
|
|
215
288
|
|
|
289
|
+
/**
|
|
290
|
+
* TBD.
|
|
291
|
+
*/
|
|
216
292
|
_pause() {
|
|
217
293
|
if (!this._codePaused) {
|
|
218
294
|
this.isPaused = true;
|
|
@@ -220,6 +296,9 @@ export class Tween {
|
|
|
220
296
|
}
|
|
221
297
|
}
|
|
222
298
|
|
|
299
|
+
/**
|
|
300
|
+
* TBD.
|
|
301
|
+
*/
|
|
223
302
|
resume() {
|
|
224
303
|
if (this.isPaused) {
|
|
225
304
|
this.isPaused = false;
|
|
@@ -232,12 +311,19 @@ export class Tween {
|
|
|
232
311
|
}
|
|
233
312
|
}
|
|
234
313
|
|
|
314
|
+
/**
|
|
315
|
+
* TBD.
|
|
316
|
+
*/
|
|
235
317
|
_resume() {
|
|
236
318
|
if (!this._codePaused) {
|
|
237
319
|
this.resume();
|
|
238
320
|
}
|
|
239
321
|
}
|
|
240
322
|
|
|
323
|
+
/**
|
|
324
|
+
* TBD.
|
|
325
|
+
* @param time
|
|
326
|
+
*/
|
|
241
327
|
update(time) {
|
|
242
328
|
if (this.pendingDelete || !this.target) {
|
|
243
329
|
return false;
|
|
@@ -316,6 +402,11 @@ export class Tween {
|
|
|
316
402
|
return false;
|
|
317
403
|
}
|
|
318
404
|
|
|
405
|
+
/**
|
|
406
|
+
* TBD.
|
|
407
|
+
* @param frameRate
|
|
408
|
+
* @param data
|
|
409
|
+
*/
|
|
319
410
|
generateData(frameRate = 60, data = []) {
|
|
320
411
|
if (this.game === null || this.target === null) {
|
|
321
412
|
return null;
|
|
@@ -342,6 +433,9 @@ export class Tween {
|
|
|
342
433
|
return data;
|
|
343
434
|
}
|
|
344
435
|
|
|
436
|
+
/**
|
|
437
|
+
* TBD.
|
|
438
|
+
*/
|
|
345
439
|
get totalDuration() {
|
|
346
440
|
let total = 0;
|
|
347
441
|
for (let i = 0; i < this.timeline.length; i += 1) {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
3
|
-
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
4
|
-
* @author Richard Davey <rich@photonstorm.com>
|
|
5
|
-
*/
|
|
6
1
|
import * as MathUtils from '../util/math';
|
|
7
2
|
import { TWEEN_PENDING, TWEEN_RUNNING, TWEEN_COMPLETE, TWEEN_LOOPED } from './const';
|
|
8
3
|
|
|
9
4
|
export class TweenData {
|
|
5
|
+
/**
|
|
6
|
+
* TBD.
|
|
7
|
+
* @param parent
|
|
8
|
+
*/
|
|
10
9
|
constructor(parent) {
|
|
11
10
|
this.parent = parent;
|
|
12
11
|
this.game = parent.game;
|
|
@@ -34,6 +33,15 @@ export class TweenData {
|
|
|
34
33
|
this.isFrom = false;
|
|
35
34
|
}
|
|
36
35
|
|
|
36
|
+
/**
|
|
37
|
+
* TBD.
|
|
38
|
+
* @param properties
|
|
39
|
+
* @param duration - TBD.
|
|
40
|
+
* @param ease - TBD.
|
|
41
|
+
* @param delay - TBD.
|
|
42
|
+
* @param repeat
|
|
43
|
+
* @param yoyo
|
|
44
|
+
*/
|
|
37
45
|
to(properties, duration, ease, delay, repeat, yoyo) {
|
|
38
46
|
this.vEnd = properties;
|
|
39
47
|
this.duration = duration;
|
|
@@ -45,6 +53,15 @@ export class TweenData {
|
|
|
45
53
|
return this;
|
|
46
54
|
}
|
|
47
55
|
|
|
56
|
+
/**
|
|
57
|
+
* TBD.
|
|
58
|
+
* @param properties
|
|
59
|
+
* @param duration - TBD.
|
|
60
|
+
* @param ease - TBD.
|
|
61
|
+
* @param delay - TBD.
|
|
62
|
+
* @param repeat
|
|
63
|
+
* @param yoyo
|
|
64
|
+
*/
|
|
48
65
|
from(properties, duration, ease, delay, repeat, yoyo) {
|
|
49
66
|
this.vEnd = properties;
|
|
50
67
|
this.duration = duration;
|
|
@@ -56,6 +73,9 @@ export class TweenData {
|
|
|
56
73
|
return this;
|
|
57
74
|
}
|
|
58
75
|
|
|
76
|
+
/**
|
|
77
|
+
* TBD.
|
|
78
|
+
*/
|
|
59
79
|
start() {
|
|
60
80
|
this.startTime = this.game.time.time + this.delay;
|
|
61
81
|
if (this.parent.reverse) {
|
|
@@ -84,6 +104,9 @@ export class TweenData {
|
|
|
84
104
|
return this;
|
|
85
105
|
}
|
|
86
106
|
|
|
107
|
+
/**
|
|
108
|
+
* TBD.
|
|
109
|
+
*/
|
|
87
110
|
loadValues() {
|
|
88
111
|
const keys = Object.keys(this.parent.properties);
|
|
89
112
|
for (let k = 0; k < keys.length; k += 1) {
|
|
@@ -117,6 +140,10 @@ export class TweenData {
|
|
|
117
140
|
return this;
|
|
118
141
|
}
|
|
119
142
|
|
|
143
|
+
/**
|
|
144
|
+
* TBD.
|
|
145
|
+
* @param time
|
|
146
|
+
*/
|
|
120
147
|
update(time) {
|
|
121
148
|
if (!this.isRunning) {
|
|
122
149
|
if (time >= this.startTime) {
|
|
@@ -144,24 +171,21 @@ export class TweenData {
|
|
|
144
171
|
const start = this.vStart[property];
|
|
145
172
|
const end = this.vEnd[property];
|
|
146
173
|
if (Array.isArray(end)) {
|
|
147
|
-
this.parent.target[property] = this.interpolationFunction.call(
|
|
148
|
-
this.interpolationContext,
|
|
149
|
-
end,
|
|
150
|
-
this.value
|
|
151
|
-
);
|
|
174
|
+
this.parent.target[property] = this.interpolationFunction.call(this.interpolationContext, end, this.value);
|
|
152
175
|
} else {
|
|
153
176
|
this.parent.target[property] = start + (end - start) * this.value;
|
|
154
177
|
}
|
|
155
178
|
}
|
|
156
|
-
if (
|
|
157
|
-
(!this.parent.reverse && this.percent === 1) ||
|
|
158
|
-
(this.parent.reverse && this.percent === 0)
|
|
159
|
-
) {
|
|
179
|
+
if ((!this.parent.reverse && this.percent === 1) || (this.parent.reverse && this.percent === 0)) {
|
|
160
180
|
return this.repeat();
|
|
161
181
|
}
|
|
162
182
|
return TWEEN_RUNNING;
|
|
163
183
|
}
|
|
164
184
|
|
|
185
|
+
/**
|
|
186
|
+
* TBD.
|
|
187
|
+
* @param frameRate
|
|
188
|
+
*/
|
|
165
189
|
generateData(frameRate) {
|
|
166
190
|
if (this.parent.reverse) {
|
|
167
191
|
this.dt = this.duration;
|
|
@@ -194,10 +218,7 @@ export class TweenData {
|
|
|
194
218
|
}
|
|
195
219
|
}
|
|
196
220
|
data.push(blob);
|
|
197
|
-
if (
|
|
198
|
-
(!this.parent.reverse && this.percent === 1) ||
|
|
199
|
-
(this.parent.reverse && this.percent === 0)
|
|
200
|
-
) {
|
|
221
|
+
if ((!this.parent.reverse && this.percent === 1) || (this.parent.reverse && this.percent === 0)) {
|
|
201
222
|
complete = true;
|
|
202
223
|
}
|
|
203
224
|
} while (!complete);
|
|
@@ -209,6 +230,9 @@ export class TweenData {
|
|
|
209
230
|
return data;
|
|
210
231
|
}
|
|
211
232
|
|
|
233
|
+
/**
|
|
234
|
+
* TBD.
|
|
235
|
+
*/
|
|
212
236
|
repeat() {
|
|
213
237
|
// If not a yoyo and repeatCounter = 0 then we're done
|
|
214
238
|
if (this.yoyo) {
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
3
|
-
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
4
|
-
* @author Richard Davey <rich@photonstorm.com>
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
1
|
/**
|
|
8
2
|
* TBD.
|
|
9
3
|
* @param {number} k - TBD.
|
|
@@ -273,8 +267,7 @@ export function ElasticInOut(k) {
|
|
|
273
267
|
} else {
|
|
274
268
|
s = (p * Math.asin(1 / a)) / (2 * Math.PI);
|
|
275
269
|
}
|
|
276
|
-
if ((k *= 2) < 1)
|
|
277
|
-
return -0.5 * (a * Math.pow(2, 10 * (k -= 1)) * Math.sin(((k - s) * (2 * Math.PI)) / p));
|
|
270
|
+
if ((k *= 2) < 1) return -0.5 * (a * Math.pow(2, 10 * (k -= 1)) * Math.sin(((k - s) * (2 * Math.PI)) / p));
|
|
278
271
|
return a * Math.pow(2, -10 * (k -= 1)) * Math.sin(((k - s) * (2 * Math.PI)) / p) * 0.5 + 1;
|
|
279
272
|
}
|
|
280
273
|
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
3
|
-
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
4
|
-
* @author Richard Davey <rich@photonstorm.com>
|
|
5
|
-
*/
|
|
6
1
|
import { Tween } from './tween';
|
|
7
2
|
import {
|
|
8
3
|
LinearNone,
|
|
@@ -38,8 +33,13 @@ import {
|
|
|
38
33
|
BounceInOut,
|
|
39
34
|
} from './tween_easing';
|
|
40
35
|
import { GROUP } from './const';
|
|
36
|
+
import { Game } from './game';
|
|
41
37
|
|
|
42
38
|
export class TweenManager {
|
|
39
|
+
/**
|
|
40
|
+
* TBD.
|
|
41
|
+
* @param {Game} game - TBD.
|
|
42
|
+
*/
|
|
43
43
|
constructor(game) {
|
|
44
44
|
this.game = game;
|
|
45
45
|
this._tweens = [];
|
|
@@ -92,10 +92,16 @@ export class TweenManager {
|
|
|
92
92
|
this.game.onResume.add(this._resumeAll, this);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
/**
|
|
96
|
+
* TBD.
|
|
97
|
+
*/
|
|
95
98
|
getAll() {
|
|
96
99
|
return this._tweens;
|
|
97
100
|
}
|
|
98
101
|
|
|
102
|
+
/**
|
|
103
|
+
* TBD.
|
|
104
|
+
*/
|
|
99
105
|
removeAll() {
|
|
100
106
|
for (let i = 0; i < this._tweens.length; i += 1) {
|
|
101
107
|
this._tweens[i].pendingDelete = true;
|
|
@@ -103,6 +109,11 @@ export class TweenManager {
|
|
|
103
109
|
this._add = [];
|
|
104
110
|
}
|
|
105
111
|
|
|
112
|
+
/**
|
|
113
|
+
* TBD.
|
|
114
|
+
* @param obj
|
|
115
|
+
* @param children
|
|
116
|
+
*/
|
|
106
117
|
removeFrom(obj, children) {
|
|
107
118
|
let i;
|
|
108
119
|
let len;
|
|
@@ -128,15 +139,27 @@ export class TweenManager {
|
|
|
128
139
|
}
|
|
129
140
|
}
|
|
130
141
|
|
|
142
|
+
/**
|
|
143
|
+
* TBD.
|
|
144
|
+
* @param tween
|
|
145
|
+
*/
|
|
131
146
|
add(tween) {
|
|
132
147
|
tween._manager = this;
|
|
133
148
|
this._add.push(tween);
|
|
134
149
|
}
|
|
135
150
|
|
|
151
|
+
/**
|
|
152
|
+
* TBD.
|
|
153
|
+
* @param object
|
|
154
|
+
*/
|
|
136
155
|
create(object) {
|
|
137
156
|
return new Tween(object, this.game, this);
|
|
138
157
|
}
|
|
139
158
|
|
|
159
|
+
/**
|
|
160
|
+
* TBD.
|
|
161
|
+
* @param tween
|
|
162
|
+
*/
|
|
140
163
|
remove(tween) {
|
|
141
164
|
let i = this._tweens.indexOf(tween);
|
|
142
165
|
if (i !== -1) {
|
|
@@ -149,6 +172,9 @@ export class TweenManager {
|
|
|
149
172
|
}
|
|
150
173
|
}
|
|
151
174
|
|
|
175
|
+
/**
|
|
176
|
+
* TBD.
|
|
177
|
+
*/
|
|
152
178
|
update() {
|
|
153
179
|
const addTweens = this._add.length;
|
|
154
180
|
let numTweens = this._tweens.length;
|
|
@@ -172,28 +198,44 @@ export class TweenManager {
|
|
|
172
198
|
return true;
|
|
173
199
|
}
|
|
174
200
|
|
|
201
|
+
/**
|
|
202
|
+
* TBD.
|
|
203
|
+
* @param object
|
|
204
|
+
*/
|
|
175
205
|
isTweening(object) {
|
|
176
206
|
return this._tweens.some((tween) => tween.target === object);
|
|
177
207
|
}
|
|
178
208
|
|
|
209
|
+
/**
|
|
210
|
+
* TBD.
|
|
211
|
+
*/
|
|
179
212
|
_pauseAll() {
|
|
180
213
|
for (let i = this._tweens.length - 1; i >= 0; i -= 1) {
|
|
181
214
|
this._tweens[i]._pause();
|
|
182
215
|
}
|
|
183
216
|
}
|
|
184
217
|
|
|
218
|
+
/**
|
|
219
|
+
* TBD.
|
|
220
|
+
*/
|
|
185
221
|
_resumeAll() {
|
|
186
222
|
for (let i = this._tweens.length - 1; i >= 0; i -= 1) {
|
|
187
223
|
this._tweens[i]._resume();
|
|
188
224
|
}
|
|
189
225
|
}
|
|
190
226
|
|
|
227
|
+
/**
|
|
228
|
+
* TBD.
|
|
229
|
+
*/
|
|
191
230
|
pauseAll() {
|
|
192
231
|
for (let i = this._tweens.length - 1; i >= 0; i -= 1) {
|
|
193
232
|
this._tweens[i].pause();
|
|
194
233
|
}
|
|
195
234
|
}
|
|
196
235
|
|
|
236
|
+
/**
|
|
237
|
+
* TBD.
|
|
238
|
+
*/
|
|
197
239
|
resumeAll() {
|
|
198
240
|
for (let i = this._tweens.length - 1; i >= 0; i -= 1) {
|
|
199
241
|
this._tweens[i].resume(true);
|
package/src/phaser/core/world.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
4
|
-
* @author Richard Davey <rich@photonstorm.com>
|
|
5
|
-
*/
|
|
6
|
-
import { Group } from '../display/group';
|
|
1
|
+
import { Group } from '../display/group';
|
|
2
|
+
import { Game } from './game';
|
|
7
3
|
|
|
8
4
|
export class World extends Group {
|
|
5
|
+
/**
|
|
6
|
+
* TBD.
|
|
7
|
+
* @param {Game} game - TBD.
|
|
8
|
+
*/
|
|
9
9
|
constructor(game) {
|
|
10
10
|
super(game, null, '__world', false);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* TBD.
|
|
15
|
+
*/
|
|
13
16
|
boot() {
|
|
14
17
|
this.game.stage.addChild(this);
|
|
15
18
|
}
|