@vpmedia/phaser 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/dist/phaser.cjs.LICENSE.txt +1 -1
  2. package/dist/phaser.js.LICENSE.txt +1 -1
  3. package/package.json +2 -3
  4. package/src/index.js +99 -0
  5. package/src/phaser/core/animation.js +355 -0
  6. package/src/phaser/core/animation_manager.js +238 -0
  7. package/src/phaser/core/animation_parser.js +130 -0
  8. package/src/phaser/core/array_set.js +108 -0
  9. package/src/phaser/core/cache.js +558 -0
  10. package/src/phaser/core/const.js +106 -0
  11. package/src/phaser/core/device.js +67 -0
  12. package/src/phaser/core/device_util.js +386 -0
  13. package/src/phaser/core/dom.js +207 -0
  14. package/src/phaser/core/event_manager.js +243 -0
  15. package/src/phaser/core/factory.js +74 -0
  16. package/src/phaser/core/frame.js +75 -0
  17. package/src/phaser/core/frame_data.js +84 -0
  18. package/src/phaser/core/frame_util.js +31 -0
  19. package/src/phaser/core/game.js +412 -0
  20. package/src/phaser/core/input.js +401 -0
  21. package/src/phaser/core/input_button.js +102 -0
  22. package/src/phaser/core/input_handler.js +687 -0
  23. package/src/phaser/core/input_mouse.js +289 -0
  24. package/src/phaser/core/input_mspointer.js +197 -0
  25. package/src/phaser/core/input_pointer.js +427 -0
  26. package/src/phaser/core/input_touch.js +157 -0
  27. package/src/phaser/core/loader.js +946 -0
  28. package/src/phaser/core/loader_parser.js +105 -0
  29. package/src/phaser/core/raf.js +46 -0
  30. package/src/phaser/core/raf_fb.js +75 -0
  31. package/src/phaser/core/raf_to.js +34 -0
  32. package/src/phaser/core/scale_manager.js +806 -0
  33. package/src/phaser/core/scene.js +66 -0
  34. package/src/phaser/core/scene_manager.js +310 -0
  35. package/src/phaser/core/signal.js +175 -0
  36. package/src/phaser/core/signal_binding.js +69 -0
  37. package/src/phaser/core/sound.js +538 -0
  38. package/src/phaser/core/sound_manager.js +365 -0
  39. package/src/phaser/core/stage.js +108 -0
  40. package/src/phaser/core/time.js +203 -0
  41. package/src/phaser/core/timer.js +276 -0
  42. package/src/phaser/core/timer_event.js +21 -0
  43. package/src/phaser/core/tween.js +329 -0
  44. package/src/phaser/core/tween_data.js +258 -0
  45. package/src/phaser/core/tween_easing.js +316 -0
  46. package/src/phaser/core/tween_manager.js +185 -0
  47. package/src/phaser/core/world.js +18 -0
  48. package/src/phaser/display/bitmap_text.js +322 -0
  49. package/src/phaser/display/button.js +194 -0
  50. package/src/phaser/display/canvas/buffer.js +36 -0
  51. package/src/phaser/display/canvas/graphics.js +227 -0
  52. package/src/phaser/display/canvas/masker.js +39 -0
  53. package/src/phaser/display/canvas/pool.js +121 -0
  54. package/src/phaser/display/canvas/renderer.js +123 -0
  55. package/src/phaser/display/canvas/tinter.js +141 -0
  56. package/src/phaser/display/canvas/util.js +151 -0
  57. package/src/phaser/display/display_object.js +597 -0
  58. package/src/phaser/display/graphics.js +723 -0
  59. package/src/phaser/display/graphics_data.js +27 -0
  60. package/src/phaser/display/graphics_data_util.js +14 -0
  61. package/src/phaser/display/group.js +227 -0
  62. package/src/phaser/display/image.js +288 -0
  63. package/src/phaser/display/sprite_batch.js +15 -0
  64. package/src/phaser/display/sprite_util.js +248 -0
  65. package/src/phaser/display/text.js +1089 -0
  66. package/src/phaser/display/webgl/abstract_filter.js +25 -0
  67. package/src/phaser/display/webgl/base_texture.js +68 -0
  68. package/src/phaser/display/webgl/blend_manager.js +35 -0
  69. package/src/phaser/display/webgl/earcut.js +647 -0
  70. package/src/phaser/display/webgl/earcut_node.js +28 -0
  71. package/src/phaser/display/webgl/fast_sprite_batch.js +242 -0
  72. package/src/phaser/display/webgl/filter_manager.js +46 -0
  73. package/src/phaser/display/webgl/filter_texture.js +61 -0
  74. package/src/phaser/display/webgl/graphics.js +618 -0
  75. package/src/phaser/display/webgl/graphics_data.js +42 -0
  76. package/src/phaser/display/webgl/mask_manager.js +36 -0
  77. package/src/phaser/display/webgl/render_texture.js +81 -0
  78. package/src/phaser/display/webgl/renderer.js +234 -0
  79. package/src/phaser/display/webgl/shader/complex.js +74 -0
  80. package/src/phaser/display/webgl/shader/fast.js +97 -0
  81. package/src/phaser/display/webgl/shader/normal.js +225 -0
  82. package/src/phaser/display/webgl/shader/primitive.js +72 -0
  83. package/src/phaser/display/webgl/shader/strip.js +77 -0
  84. package/src/phaser/display/webgl/shader_manager.js +89 -0
  85. package/src/phaser/display/webgl/sprite_batch.js +320 -0
  86. package/src/phaser/display/webgl/stencil_manager.js +170 -0
  87. package/src/phaser/display/webgl/texture.js +117 -0
  88. package/src/phaser/display/webgl/texture_util.js +32 -0
  89. package/src/phaser/display/webgl/util.js +74 -0
  90. package/src/phaser/geom/circle.js +186 -0
  91. package/src/phaser/geom/ellipse.js +65 -0
  92. package/src/phaser/geom/line.js +190 -0
  93. package/src/phaser/geom/matrix.js +147 -0
  94. package/src/phaser/geom/point.js +164 -0
  95. package/src/phaser/geom/polygon.js +141 -0
  96. package/src/phaser/geom/rectangle.js +306 -0
  97. package/src/phaser/geom/rounded_rectangle.js +36 -0
  98. package/src/phaser/geom/util/circle.js +115 -0
  99. package/src/phaser/geom/util/ellipse.js +30 -0
  100. package/src/phaser/geom/util/line.js +130 -0
  101. package/src/phaser/geom/util/matrix.js +48 -0
  102. package/src/phaser/geom/util/point.js +276 -0
  103. package/src/phaser/geom/util/polygon.js +24 -0
  104. package/src/phaser/geom/util/rectangle.js +212 -0
  105. package/src/phaser/geom/util/rounded_rectangle.js +28 -0
  106. package/src/phaser/util/math.js +279 -0
  107. package/src/phaser/util/string.js +26 -0
@@ -1 +1 @@
1
- /*! @vpmedia/phaser Copyright (c) 2022-present Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu) Wed Nov 02 2022 14:47:58 GMT+0100 (Central European Standard Time) */
1
+ /*! @vpmedia/phaser Copyright (c) 2022-present Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu) Wed Nov 02 2022 14:59:47 GMT+0100 (Central European Standard Time) */
@@ -1 +1 @@
1
- /*! @vpmedia/phaser Copyright (c) 2022-present Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu) Wed Nov 02 2022 14:47:58 GMT+0100 (Central European Standard Time) */
1
+ /*! @vpmedia/phaser Copyright (c) 2022-present Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu) Wed Nov 02 2022 14:59:47 GMT+0100 (Central European Standard Time) */
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "@vpmedia/phaser",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "author": "Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/vpmedia/phaser",
7
7
  "private": false,
8
- "main": "./dist/phaser.cjs",
9
- "module": "./dist/phaser.cjs",
8
+ "main": "./src/index.js",
10
9
  "devDependencies": {
11
10
  "@babel/cli": "^7.19.3",
12
11
  "@babel/core": "^7.19.6",
package/src/index.js ADDED
@@ -0,0 +1,99 @@
1
+ /**
2
+ * @author Andras Csizmadia <andras@vpmedia.hu>
3
+ * @author Richard Davey <rich@photonstorm.com>
4
+ * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
5
+ */
6
+ import * as Const from './phaser/core/const';
7
+ import AnimationManager from './phaser/core/animation_manager';
8
+ import * as AnimationParser from './phaser/core/animation_parser';
9
+ import ArraySet from './phaser/core/array_set';
10
+ import Device from './phaser/core/device';
11
+ import * as DeviceUtils from './phaser/core/device_util';
12
+ import DOM from './phaser/core/dom';
13
+ import EventManager from './phaser/core/event_manager';
14
+ import Frame from './phaser/core/frame';
15
+ import FrameData from './phaser/core/frame_data';
16
+ import InputManager from './phaser/core/input';
17
+ import InputMouse from './phaser/core/input_mouse';
18
+ import InputMSPointer from './phaser/core/input_mspointer';
19
+ import InputPointer from './phaser/core/input_pointer';
20
+ import InputTouch from './phaser/core/input_touch';
21
+ import Loader from './phaser/core/loader';
22
+ import GameLoopRAF from './phaser/core/raf';
23
+ import GameLoopTO from './phaser/core/raf_to';
24
+ import GameLoopFB from './phaser/core/raf_fb';
25
+ import ScaleManager from './phaser/core/scale_manager';
26
+ import Scene from './phaser/core/scene';
27
+ import SceneManager from './phaser/core/scene_manager';
28
+ import Signal from './phaser/core/signal';
29
+ import SignalBinding from './phaser/core/signal_binding';
30
+ import Sound from './phaser/core/sound';
31
+ import SoundManager from './phaser/core/sound_manager';
32
+ import Time from './phaser/core/time';
33
+ import Timer from './phaser/core/timer';
34
+ import TimerEvent from './phaser/core/timer_event';
35
+ import Tween from './phaser/core/tween';
36
+ import TweenData from './phaser/core/tween_data';
37
+ import * as TweenEasing from './phaser/core/tween_easing';
38
+ import TweenManager from './phaser/core/tween_manager';
39
+ import Circle from './phaser/geom/circle';
40
+ import Ellipse from './phaser/geom/ellipse';
41
+ import Line from './phaser/geom/line';
42
+ import Matrix from './phaser/geom/matrix';
43
+ import Point from './phaser/geom/point';
44
+ import Polygon from './phaser/geom/polygon';
45
+ import Rectangle from './phaser/geom/rectangle';
46
+ import * as MathUtils from './phaser/util/math';
47
+ import * as StringUtils from './phaser/util/string';
48
+ import RoundedRectangle from './phaser/geom/rounded_rectangle';
49
+ import * as CircleUtils from './phaser/geom/util/circle';
50
+ import * as EllipseUtils from './phaser/geom/util/ellipse';
51
+ import * as LineUtils from './phaser/geom/util/line';
52
+ import * as MatrixUtils from './phaser/geom/util/matrix';
53
+ import * as PointUtils from './phaser/geom/util/point';
54
+ import * as PolygonUtils from './phaser/geom/util/polygon';
55
+ import * as RectangleUtils from './phaser/geom/util/rectangle';
56
+ import * as RoundedRectangleUtils from './phaser/geom/util/rounded_rectangle';
57
+ import GraphicsData from './phaser/display/graphics_data';
58
+ import * as CanvasPool from './phaser/display/canvas/pool';
59
+ import * as CanvasUtils from './phaser/display/canvas/util';
60
+ import * as CanvasTinter from './phaser/display/canvas/tinter';
61
+ import * as CanvasMasker from './phaser/display/canvas/masker';
62
+ import * as CanvasGraphics from './phaser/display/canvas/graphics';
63
+ import CanvasBuffer from './phaser/display/canvas/buffer';
64
+ import CanvasRenderer from './phaser/display/canvas/renderer';
65
+ import * as EarCut from './phaser/display/webgl/earcut';
66
+ import Game from './phaser/core/game';
67
+ import BitmapText from './phaser/display/bitmap_text';
68
+ import DisplayObject from './phaser/display/display_object';
69
+ import Button from './phaser/display/button';
70
+ import Image from './phaser/display/image';
71
+ import Group from './phaser/display/group';
72
+ import Text from './phaser/display/text';
73
+
74
+ export {
75
+ Const,
76
+ AnimationManager, AnimationParser,
77
+ ArraySet,
78
+ DOM,
79
+ Device, DeviceUtils,
80
+ EventManager,
81
+ Frame, FrameData,
82
+ InputManager, InputMouse, InputMSPointer, InputPointer, InputTouch,
83
+ Loader,
84
+ GameLoopRAF, GameLoopTO, GameLoopFB,
85
+ MathUtils, StringUtils,
86
+ ScaleManager,
87
+ Scene, SceneManager,
88
+ Signal, SignalBinding,
89
+ Sound, SoundManager,
90
+ Time, Timer, TimerEvent,
91
+ Tween, TweenData, TweenEasing, TweenManager,
92
+ Circle, CircleUtils, Ellipse, EllipseUtils, Line, LineUtils, Matrix, MatrixUtils, Point, PointUtils,
93
+ Polygon, PolygonUtils, Rectangle, RectangleUtils, RoundedRectangle, RoundedRectangleUtils,
94
+ Game,
95
+ GraphicsData,
96
+ CanvasPool, CanvasUtils, CanvasBuffer, CanvasTinter, CanvasMasker, CanvasGraphics, CanvasRenderer,
97
+ EarCut,
98
+ BitmapText, Button, DisplayObject, Image, Group, Text,
99
+ };
@@ -0,0 +1,355 @@
1
+ /**
2
+ * @author Andras Csizmadia <andras@vpmedia.hu>
3
+ * @author Richard Davey <rich@photonstorm.com>
4
+ * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
5
+ */
6
+ import Signal from './signal';
7
+
8
+ export default class {
9
+
10
+ constructor(game, parent, name, frameData, frames, frameRate, loop = false) {
11
+ this.game = game;
12
+ this._parent = parent;
13
+ this._frameData = frameData;
14
+ this.name = name;
15
+ this._frames = [];
16
+ this._frames = this._frames.concat(frames);
17
+ this.delay = 1000 / frameRate;
18
+ this.loop = loop;
19
+ this.loopCount = 0;
20
+ this.killOnComplete = false;
21
+ this.isFinished = false;
22
+ this.isPlaying = false;
23
+ this.isPaused = false;
24
+ this._pauseStartTime = 0;
25
+ this._frameIndex = 0;
26
+ this._frameDiff = 0;
27
+ this._frameSkip = 1;
28
+ this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]);
29
+ this.onStart = new Signal();
30
+ this.onUpdate = null;
31
+ this.onComplete = new Signal();
32
+ this.onLoop = new Signal();
33
+ this.isReversed = false;
34
+ // Set-up some event listeners
35
+ this.game.onPause.add(this.onPause, this);
36
+ this.game.onResume.add(this.onResume, this);
37
+ }
38
+
39
+ play(frameRate, loop, killOnComplete) {
40
+ if (typeof frameRate === 'number') {
41
+ // If they set a new frame rate then use it, otherwise use the one set on creation
42
+ this.delay = 1000 / frameRate;
43
+ }
44
+ if (typeof loop === 'boolean') {
45
+ // If they set a new loop value then use it, otherwise use the one set on creation
46
+ this.loop = loop;
47
+ }
48
+ if (typeof killOnComplete !== 'undefined') {
49
+ // Remove the parent sprite once the animation has finished?
50
+ this.killOnComplete = killOnComplete;
51
+ }
52
+ this.isPlaying = true;
53
+ this.isFinished = false;
54
+ this.paused = false;
55
+ this.loopCount = 0;
56
+ this._timeLastFrame = this.game.time.time;
57
+ this._timeNextFrame = this.game.time.time + this.delay;
58
+ this._frameIndex = this.isReversed ? this._frames.length - 1 : 0;
59
+ this.updateCurrentFrame(false, true);
60
+ this._parent.events.onAnimationStart$dispatch(this._parent, this);
61
+ this.onStart.dispatch(this._parent, this);
62
+ this._parent.animations.currentAnim = this;
63
+ this._parent.animations.currentFrame = this.currentFrame;
64
+ return this;
65
+ }
66
+
67
+ restart() {
68
+ this.isPlaying = true;
69
+ this.isFinished = false;
70
+ this.paused = false;
71
+ this.loopCount = 0;
72
+ this._timeLastFrame = this.game.time.time;
73
+ this._timeNextFrame = this.game.time.time + this.delay;
74
+ this._frameIndex = 0;
75
+ this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]);
76
+ this._parent.setFrame(this.currentFrame);
77
+ this._parent.animations.currentAnim = this;
78
+ this._parent.animations.currentFrame = this.currentFrame;
79
+ this.onStart.dispatch(this._parent, this);
80
+ }
81
+
82
+ reverse() {
83
+ this.reversed = !this.reversed;
84
+ return this;
85
+ }
86
+
87
+ reverseOnce() {
88
+ this.onComplete.addOnce(this.reverse, this);
89
+ return this.reverse();
90
+ }
91
+
92
+ setFrame(frameId, useLocalFrameIndex = false) {
93
+ let frameIndex;
94
+ // Find the index to the desired frame.
95
+ if (typeof frameId === 'string') {
96
+ for (let i = 0; i < this._frames.length; i += 1) {
97
+ if (this._frameData.getFrame(this._frames[i]).name === frameId) {
98
+ frameIndex = i;
99
+ }
100
+ }
101
+ } else if (typeof frameId === 'number') {
102
+ if (useLocalFrameIndex) {
103
+ frameIndex = frameId;
104
+ } else {
105
+ for (let i = 0; i < this._frames.length; i += 1) {
106
+ if (this._frames[i] === frameId) {
107
+ frameIndex = i;
108
+ }
109
+ }
110
+ }
111
+ }
112
+ if (frameIndex) {
113
+ // Set the current frame index to the found index. Subtract 1 so that it animates to the desired frame on update.
114
+ this._frameIndex = frameIndex - 1;
115
+ // Make the animation update at next update
116
+ this._timeNextFrame = this.game.time.time;
117
+ this.update();
118
+ }
119
+ }
120
+
121
+ stop(resetFrame = false, dispatchComplete = false) {
122
+ this.isPlaying = false;
123
+ this.isFinished = true;
124
+ this.paused = false;
125
+ if (resetFrame) {
126
+ this.currentFrame = this._frameData.getFrame(this._frames[0]);
127
+ if (this.currentFrame) {
128
+ this._parent.setFrame(this.currentFrame);
129
+ }
130
+ }
131
+ if (dispatchComplete) {
132
+ this._parent.events.onAnimationComplete$dispatch(this._parent, this);
133
+ this.onComplete.dispatch(this._parent, this);
134
+ }
135
+ }
136
+
137
+ onPause() {
138
+ if (this.isPlaying) {
139
+ this._frameDiff = this._timeNextFrame - this.game.time.time;
140
+ }
141
+ }
142
+
143
+ onResume() {
144
+ if (this.isPlaying) {
145
+ this._timeNextFrame = this.game.time.time + this._frameDiff;
146
+ }
147
+ }
148
+
149
+ update() {
150
+ if (this.isPaused) {
151
+ return false;
152
+ }
153
+ if (this.isPlaying && this.game.time.time >= this._timeNextFrame) {
154
+ this._frameSkip = 1;
155
+ // Lagging?
156
+ this._frameDiff = this.game.time.time - this._timeNextFrame;
157
+ this._timeLastFrame = this.game.time.time;
158
+ if (this._frameDiff > this.delay) {
159
+ // We need to skip a frame, work out how many
160
+ this._frameSkip = Math.floor(this._frameDiff / this.delay);
161
+ this._frameDiff -= (this._frameSkip * this.delay);
162
+ }
163
+ // And what's left now?
164
+ this._timeNextFrame = this.game.time.time + (this.delay - this._frameDiff);
165
+ if (this.isReversed) {
166
+ this._frameIndex -= this._frameSkip;
167
+ } else {
168
+ this._frameIndex += this._frameSkip;
169
+ }
170
+ if (!this.isReversed && this._frameIndex >= this._frames.length || this.isReversed && this._frameIndex <= -1) {
171
+ if (this.loop) {
172
+ // Update current state before event callback
173
+ this._frameIndex = Math.abs(this._frameIndex) % this._frames.length;
174
+ if (this.isReversed) {
175
+ this._frameIndex = this._frames.length - 1 - this._frameIndex;
176
+ }
177
+ this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]);
178
+ // Instead of calling updateCurrentFrame we do it here instead
179
+ if (this.currentFrame) {
180
+ this._parent.setFrame(this.currentFrame);
181
+ }
182
+ this.loopCount += 1;
183
+ this._parent.events.onAnimationLoop$dispatch(this._parent, this);
184
+ this.onLoop.dispatch(this._parent, this);
185
+ if (this.onUpdate) {
186
+ this.onUpdate.dispatch(this, this.currentFrame);
187
+ // False if the animation was destroyed from within a callback
188
+ return !!this._frameData;
189
+ }
190
+ return true;
191
+ }
192
+ this.complete();
193
+ return false;
194
+ }
195
+ return this.updateCurrentFrame(true);
196
+ }
197
+
198
+ return false;
199
+ }
200
+
201
+ updateCurrentFrame(signalUpdate, fromPlay = false) {
202
+ if (!this._frameData || !this.currentFrame) {
203
+ // The animation is already destroyed, probably from a callback
204
+ return false;
205
+ }
206
+ // Previous index
207
+ const idx = this.currentFrame.index;
208
+ this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]);
209
+ if (this.currentFrame && (fromPlay || (!fromPlay && idx !== this.currentFrame.index))) {
210
+ this._parent.setFrame(this.currentFrame);
211
+ }
212
+ if (this.onUpdate && signalUpdate) {
213
+ this.onUpdate.dispatch(this, this.currentFrame);
214
+ // False if the animation was destroyed from within a callback
215
+ return !!this._frameData;
216
+ }
217
+ return true;
218
+ }
219
+
220
+ next(quantity = 1) {
221
+ let frame = this._frameIndex + quantity;
222
+ if (frame >= this._frames.length) {
223
+ if (this.loop) {
224
+ frame %= this._frames.length;
225
+ } else {
226
+ frame = this._frames.length - 1;
227
+ }
228
+ }
229
+ if (frame !== this._frameIndex) {
230
+ this._frameIndex = frame;
231
+ this.updateCurrentFrame(true);
232
+ }
233
+ }
234
+
235
+ previous(quantity = 1) {
236
+ let frame = this._frameIndex - quantity;
237
+ if (frame < 0) {
238
+ if (this.loop) {
239
+ frame = this._frames.length + frame;
240
+ } else {
241
+ frame += 1;
242
+ }
243
+ }
244
+ if (frame !== this._frameIndex) {
245
+ this._frameIndex = frame;
246
+ this.updateCurrentFrame(true);
247
+ }
248
+ }
249
+
250
+ updateFrameData(frameData) {
251
+ this._frameData = frameData;
252
+ this.currentFrame = this._frameData ? this._frameData.getFrame(this._frames[this._frameIndex % this._frames.length]) : null;
253
+ }
254
+
255
+ destroy() {
256
+ if (!this._frameData) {
257
+ // Already destroyed
258
+ return;
259
+ }
260
+ this.game.onPause.remove(this.onPause, this);
261
+ this.game.onResume.remove(this.onResume, this);
262
+ this.game = null;
263
+ this._parent = null;
264
+ this._frames = null;
265
+ this._frameData = null;
266
+ this.currentFrame = null;
267
+ this.isPlaying = false;
268
+ this.onStart.dispose();
269
+ this.onLoop.dispose();
270
+ this.onComplete.dispose();
271
+ if (this.onUpdate) {
272
+ this.onUpdate.dispose();
273
+ }
274
+ }
275
+
276
+ complete() {
277
+ this._frameIndex = this._frames.length - 1;
278
+ this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]);
279
+ this.isPlaying = false;
280
+ this.isFinished = true;
281
+ this.paused = false;
282
+ this._parent.events.onAnimationComplete$dispatch(this._parent, this);
283
+ this.onComplete.dispatch(this._parent, this);
284
+ if (this.killOnComplete) {
285
+ this._parent.kill();
286
+ }
287
+ }
288
+
289
+ get paused() {
290
+ return this.isPaused;
291
+ }
292
+
293
+ set paused(value) {
294
+ this.isPaused = value;
295
+ if (value) {
296
+ this._pauseStartTime = this.game.time.time;
297
+ } else if (this.isPlaying) {
298
+ this._timeNextFrame = this.game.time.time + this.delay;
299
+ }
300
+ }
301
+
302
+ get reversed() {
303
+ return this.isReversed;
304
+ }
305
+
306
+ set reversed(value) {
307
+ this.isReversed = value;
308
+ }
309
+
310
+ get frameTotal() {
311
+ return this._frames.length;
312
+ }
313
+
314
+ get frame() {
315
+ if (this.currentFrame !== null) {
316
+ return this.currentFrame.index;
317
+ }
318
+ return this._frameIndex;
319
+ }
320
+
321
+ set frame(value) {
322
+ this.currentFrame = this._frameData.getFrame(this._frames[value]);
323
+ if (this.currentFrame !== null) {
324
+ this._frameIndex = value;
325
+ this._parent.setFrame(this.currentFrame);
326
+ if (this.onUpdate) {
327
+ this.onUpdate.dispatch(this, this.currentFrame);
328
+ }
329
+ }
330
+ }
331
+
332
+ get speed() {
333
+ return 1000 / this.delay;
334
+ }
335
+
336
+ set speed(value) {
337
+ if (value > 0) {
338
+ this.delay = 1000 / value;
339
+ }
340
+ }
341
+
342
+ get enableUpdate() {
343
+ return (this.onUpdate !== null);
344
+ }
345
+
346
+ set enableUpdate(value) {
347
+ if (value && this.onUpdate === null) {
348
+ this.onUpdate = new Signal();
349
+ } else if (!value && this.onUpdate !== null) {
350
+ this.onUpdate.dispose();
351
+ this.onUpdate = null;
352
+ }
353
+ }
354
+
355
+ }