You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @property {object} target - Reference to the target object.
24
+
* @property {object} target - The target object, such as a Phaser.Sprite or property like Phaser.Sprite.scale.
25
25
*/
26
26
this.target=target;
27
27
28
28
/**
29
29
* @property {object} parent - Reference to the parent tween if part of a chained tween.
30
30
*/
31
-
this.parent=null;
31
+
// this.parent = null;
32
32
33
33
/**
34
-
* @property {Phaser.TweenManager} manager - Reference to the TweenManager.
34
+
* @property {Phaser.TweenManager} manager - Reference to the TweenManager responsible for updating this Tween.
35
35
*/
36
36
this.manager=manager;
37
37
38
-
this.timeline=[];
39
-
40
-
/**
41
-
* @property {number} duration - The duration of the tween in ms.
42
-
* @readOnly
43
-
* @default
44
-
*/
45
-
this.duration=1000;
46
-
47
-
/**
48
-
* @property {number} percent - A value between 0 and 1 that represents how far through the duration this tween is.
49
-
* @readOnly
50
-
*/
51
-
this.percent=0;
52
-
53
-
/**
54
-
* @property {number} repeatCounter - If the Tween is set to repeat this contains the current repeat count.
55
-
*/
56
-
this.repeatCounter=0;
57
-
58
38
/**
59
-
* @property {boolean} yoyo - True if the Tween is set to yoyo, otherwise false.
60
-
* @default
39
+
* @property {Array} timeline - An Array of TweenData objects that comprise the different parts of this Tween.
61
40
*/
62
-
this.yoyo=false;
41
+
this.timeline=[];
63
42
64
43
/**
65
-
* @property {boolean} inReverse - When a Tween is yoyoing this value holds if it's currently playing forwards (false) or in reverse (true).
44
+
* @property {boolean} reverse - If set to `true` the current tween will play in reverse. If the tween hasn't yet started this has no effect. If there are child tweens then all child tweens will play in reverse from the current point.
* @property {number} speed - The speed at which the tweens will run. A value of 1 means it will match the game frame rate. 0.5 will run at half the frame rate. 2 at double the frame rate and so on.
73
51
* @default
74
52
*/
75
-
this._delay=0;
53
+
this.speed=1;
76
54
77
55
/**
78
-
* @property {number} startTime - The time the Tween started or null if it hasn't yet started.
56
+
* @property {number} repeatCounter - If the Tween and any child tweens are set to repeat this contains the current repeat count.
* @property {boolean} pendingDelete - True if this Tween is ready to be deleted by the TweenManager.
125
103
* @default
104
+
* @readOnly
126
105
*/
127
106
this.pendingDelete=false;
128
107
108
+
// Move all of these to TweenManager?
109
+
129
110
/**
130
-
* @property {Phaser.Signal} onStart - The onStart event is fired when the Tween begins.
111
+
* @property {Phaser.Signal} onStart - The onStart event is fired when the Tween begins. If there is a delay before the tween starts then onStart fires after the delay is finished.
131
112
*/
132
113
this.onStart=newPhaser.Signal();
133
114
134
115
/**
135
-
* @property {Phaser.Signal} onLoop - The onLoop event is fired if the Tween loops.
116
+
* @property {Phaser.Signal} onStart - The onStart event is fired when the Tween begins. If there is a delay before the tween starts then onStart fires after the delay is finished.
117
+
*/
118
+
this.onChildStart=newPhaser.Signal();
119
+
120
+
/**
121
+
* @property {Phaser.Signal} onLoop - The onLoop event is fired if the Tween loops. If there are chained tweens it fires after all the child tweens have completed.
* @property {number} current - The current Tween child being run.
138
+
* @default
139
+
* @readOnly
140
+
*/
150
141
this.current=0;
151
142
152
143
};
@@ -156,83 +147,83 @@ Phaser.Tween.prototype = {
156
147
/**
157
148
* Sets this tween to be a `to` tween on the properties given. A `to` tween starts at the current value and tweens to the destination value given.
158
149
* For example a Sprite with an `x` coordinate of 100 could be tweened to `x` 200 by giving a properties object of `{ x: 200 }`.
150
+
* The ease function allows you define the rate of change. You can pass either a function such as Phaser.Easing.Circular.Out or a string such as "Circ".
151
+
* ".easeIn", ".easeOut" and "easeInOut" variants are all supported for all ease types.
159
152
*
160
153
* @method Phaser.Tween#to
161
-
* @param {object} properties - The properties you want to tween, such as `Sprite.x` or `Sound.volume`. Given as a JavaScript object.
154
+
* @param {object} properties - An object containing the properties you want to tween., such as `Sprite.x` or `Sound.volume`. Given as a JavaScript object.
162
155
* @param {number} [duration=1000] - Duration of this tween in ms.
163
-
* @param {function} [ease=null] - Easing function. If not set it will default to Phaser.Easing.Default, which is Phaser.Easing.Linear.None by default but can be over-ridden at will.
164
-
* @param {boolean} [autoStart=false] - Whether this tween will start automatically or not.
165
-
* @param {number} [delay=0] - Delay before this tween will start, defaults to 0 (no delay). Value given is in ms.
166
-
* @param {number} [repeat=0] - Should the tween automatically restart once complete? If you want it to run forever set as -1. This ignores any chained tweens.
156
+
* @param {function|string} [ease=null] - Easing function. If not set it will default to Phaser.Easing.Default, which is Phaser.Easing.Linear.None by default but can be over-ridden.
157
+
* @param {boolean} [autoStart=false] - Set to `true` to allow this tween to start automatically. Otherwise call Tween.start().
158
+
* @param {number} [delay=0] - Delay before this tween will start in milliseconds. Defaults to 0, no delay.
159
+
* @param {number} [repeat=0] - Should the tween automatically restart once complete? If you want it to run forever set as -1. This only effects this induvidual tween, not any chained tweens.
167
160
* @param {boolean} [yoyo=false] - A tween that yoyos will reverse itself and play backwards automatically. A yoyo'd tween doesn't fire the Tween.onComplete event, so listen for Tween.onLoop instead.
168
161
* @return {Phaser.Tween} This Tween object.
169
162
*/
170
163
to: function(properties,duration,ease,autoStart,delay,repeat,yoyo){
* Sets this tween to be a `from` tween on the properties given. A `from` tween starts at the given value and tweens to the current values.
199
190
* For example a Sprite with an `x` coordinate of 100 could be tweened from `x: 200` by giving a properties object of `{ x: 200 }`.
191
+
* The ease function allows you define the rate of change. You can pass either a function such as Phaser.Easing.Circular.Out or a string such as "Circ".
192
+
* ".easeIn", ".easeOut" and "easeInOut" variants are all supported for all ease types.
200
193
*
201
194
* @method Phaser.Tween#from
202
-
* @param {object} properties - Properties you want to tween from.
195
+
* @param {object} properties - An object containing the properties you want to tween., such as `Sprite.x` or `Sound.volume`. Given as a JavaScript object.
203
196
* @param {number} [duration=1000] - Duration of this tween in ms.
204
-
* @param {function} [ease=null] - Easing function. If not set it will default to Phaser.Easing.Linear.None.
205
-
* @param {boolean} [autoStart=false] - Whether this tween will start automatically or not.
206
-
* @param {number} [delay=0] - Delay before this tween will start, defaults to 0 (no delay). Value given is in ms.
207
-
* @param {number} [repeat=0] - Should the tween automatically restart once complete? If you want it to run forever set as Number.MAX_VALUE. This ignores any chained tweens.
197
+
* @param {function|string} [ease=null] - Easing function. If not set it will default to Phaser.Easing.Default, which is Phaser.Easing.Linear.None by default but can be over-ridden.
198
+
* @param {boolean} [autoStart=false] - Set to `true` to allow this tween to start automatically. Otherwise call Tween.start().
199
+
* @param {number} [delay=0] - Delay before this tween will start in milliseconds. Defaults to 0, no delay.
200
+
* @param {number} [repeat=0] - Should the tween automatically restart once complete? If you want it to run forever set as -1. This only effects this induvidual tween, not any chained tweens.
208
201
* @param {boolean} [yoyo=false] - A tween that yoyos will reverse itself and play backwards automatically. A yoyo'd tween doesn't fire the Tween.onComplete event, so listen for Tween.onLoop instead.
* If the Tween has a delay set then nothing will start tweening until that delay has expired.
242
233
*
243
234
* @method Phaser.Tween#start
244
-
* @param {number} [index=0] - If this Tween contains chained child tweens you can specify which one to start from. The default is zero, i.e. the first tween created.
235
+
* @param {number} [index=0] - If this Tween contains child tweens you can specify which one to start from. The default is zero, i.e. the first tween created.
245
236
* @return {Phaser.Tween} This tween. Useful for method chaining.
0 commit comments