Skip to content

Commit 7a98fe6

Browse files
committed
Add tween callbacks
1 parent d6b3141 commit 7a98fe6

8 files changed

Lines changed: 65 additions & 17 deletions

src/tweens/typedefs/NumberTweenBuilderConfig.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,27 @@
1414
* @property {boolean} [yoyo=false] - Should the tween complete, then reverse the values incrementally to get back to the starting tween values? The reverse tweening will also take `duration` milliseconds to complete.
1515
* @property {number|function|object|array} [offset=null] - Used when the Tween is part of a Timeline.
1616
* @property {number|function|object|array} [completeDelay=0] - The time the tween will wait before the onComplete event is dispatched once it has completed, in ms.
17-
* @property {number|function|object|array} [loop=0] - The number of times the tween repeats after the first play. (A value of 1 means the tween will play twice, as it repeated once.) The first loop starts after every property tween has completed once.
17+
* @property {number|function|object|array} [loop=0] - The number of times the tween will repeat. (A value of 1 means the tween will play twice, as it repeated once.) The first loop starts after every property tween has completed once.
1818
* @property {number|function|object|array} [loopDelay=0] - The time the tween will pause before starting either a yoyo or returning to the start for a repeat.
1919
* @property {boolean} [paused=false] - Does the tween start in a paused state (true) or playing (false)?
2020
* @property {boolean} [useFrames=false] - Use frames or milliseconds?
21-
* @property {any} [callbackScope] - Scope (this) for the callbacks. The default scope is the new tween.
22-
* @property {function} [onComplete] - A function to call when the tween completes.
21+
* @property {any} [callbackScope] - Scope (this) for the callbacks. The default scope is the tween.
22+
* @property {Phaser.Types.Tweens.TweenOnCompleteCallback} [onComplete] - A function to call when the tween completes.
2323
* @property {array} [onCompleteParams] - Additional parameters to pass to `onComplete`.
2424
* @property {any} [onCompleteScope] - Scope (this) for `onComplete`.
25-
* @property {function} [onLoop] - A function to call each time the tween loops.
25+
* @property {Phaser.Types.Tweens.TweenOnLoopCallback} [onLoop] - A function to call each time the tween loops.
2626
* @property {array} [onLoopParams] - Additional parameters to pass to `onLoop`.
2727
* @property {any} [onLoopScope] - Scope (this) for `onLoop`.
28-
* @property {function} [onRepeat] - A function to call each time each property repeats.
28+
* @property {Phaser.Types.Tweens.TweenOnRepeatCallback} [onRepeat] - A function to call each time the tween repeats. Called once per property per target.
2929
* @property {array} [onRepeatParams] - Additional parameters to pass to `onRepeat`.
3030
* @property {any} [onRepeatScope] - Scope (this) for `onRepeat`.
31-
* @property {function} [onStart] - A function to call when the tween starts.
31+
* @property {Phaser.Types.Tweens.TweenOnStartCallback} [onStart] - A function to call when the tween starts.
3232
* @property {array} [onStartParams] - Additional parameters to pass to `onStart`.
3333
* @property {any} [onStartScope] - Scope (this) for `onStart`.
34-
* @property {function} [onUpdate] - A function to call each time the tween steps.
34+
* @property {Phaser.Types.Tweens.TweenOnUpdateCallback} [onUpdate] - A function to call each time the tween steps. Called once per property per target.
3535
* @property {array} [onUpdateParams] - Additional parameters to pass to `onUpdate`.
3636
* @property {any} [onUpdateScope] - Scope (this) for `onUpdate`.
37-
* @property {function} [onYoyo] - A function to call each time the tween yoyos.
37+
* @property {Phaser.Types.Tweens.TweenOnYoyoCallback} [onYoyo] - A function to call each time the tween yoyos. Called once per property per target.
3838
* @property {array} [onYoyoParams] - Additional parameters to pass to `onYoyo`.
3939
* @property {any} [onYoyoScope] - Scope (this) for `onYoyo`.
4040
*/

src/tweens/typedefs/TweenBuilderConfig.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,35 @@
88
* @property {string} [ease='Power0'] - The easing equation to use for the tween.
99
* @property {array} [easeParams] - Optional easing parameters.
1010
* @property {number} [hold=0] - The number of milliseconds to hold the tween for before yoyo'ing.
11-
* @property {number} [repeat=0] - The number of times each property tween repeats after the first play.
11+
* @property {number} [repeat=0] - The number of times each property tween repeats.
1212
* @property {number} [repeatDelay=0] - The number of milliseconds to pause before a repeat.
1313
* @property {boolean} [yoyo=false] - Should the tween complete, then reverse the values incrementally to get back to the starting tween values? The reverse tweening will also take `duration` milliseconds to complete.
1414
* @property {boolean} [flipX=false] - Horizontally flip the target of the Tween when it completes (before it yoyos, if set to do so). Only works for targets that support the `flipX` property.
1515
* @property {boolean} [flipY=false] - Vertically flip the target of the Tween when it completes (before it yoyos, if set to do so). Only works for targets that support the `flipY` property.
1616
* @property {number|function|object|array} [offset=null] - Used when the Tween is part of a Timeline.
1717
* @property {number|function|object|array} [completeDelay=0] - The time the tween will wait before the onComplete event is dispatched once it has completed, in ms.
18-
* @property {number|function|object|array} [loop=0] - The number of times the tween repeats after the first play. (A value of 1 means the tween will play twice, as it repeated once.) The first loop starts after every property tween has completed once.
18+
* @property {number|function|object|array} [loop=0] - The number of times the tween will repeat. (A value of 1 means the tween will play twice, as it repeated once.) The first loop starts after every property tween has completed once.
1919
* @property {number|function|object|array} [loopDelay=0] - The time the tween will pause before starting either a yoyo or returning to the start for a repeat.
2020
* @property {boolean} [paused=false] - Does the tween start in a paused state (true) or playing (false)?
2121
* @property {object} [props] - The properties to tween.
2222
* @property {boolean} [useFrames=false] - Use frames or milliseconds?
23-
* @property {any} [callbackScope] - Scope (this) for the callbacks. The default scope is the new tween.
24-
* @property {function} [onComplete] - A function to call when the tween completes.
23+
* @property {any} [callbackScope] - Scope (this) for the callbacks. The default scope is the tween.
24+
* @property {Phaser.Types.Tweens.TweenOnCompleteCallback} [onComplete] - A function to call when the tween completes.
2525
* @property {array} [onCompleteParams] - Additional parameters to pass to `onComplete`.
2626
* @property {any} [onCompleteScope] - Scope (this) for `onComplete`.
27-
* @property {function} [onLoop] - A function to call each time the tween loops.
27+
* @property {Phaser.Types.Tweens.TweenOnLoopCallback} [onLoop] - A function to call each time the tween loops.
2828
* @property {array} [onLoopParams] - Additional parameters to pass to `onLoop`.
2929
* @property {any} [onLoopScope] - Scope (this) for `onLoop`.
30-
* @property {function} [onRepeat] - A function to call each time each property repeats.
30+
* @property {Phaser.Types.Tweens.TweenOnRepeatCallback} [onRepeat] - A function to call each time the tween repeats. Called once per property per target.
3131
* @property {array} [onRepeatParams] - Additional parameters to pass to `onRepeat`.
3232
* @property {any} [onRepeatScope] - Scope (this) for `onRepeat`.
33-
* @property {function} [onStart] - A function to call when the tween starts.
33+
* @property {Phaser.Types.Tweens.TweenOnStartCallback} [onStart] - A function to call when the tween starts.
3434
* @property {array} [onStartParams] - Additional parameters to pass to `onStart`.
3535
* @property {any} [onStartScope] - Scope (this) for `onStart`.
36-
* @property {function} [onUpdate] - A function to call each time the tween steps.
36+
* @property {Phaser.Types.Tweens.TweenOnUpdateCallback} [onUpdate] - A function to call each time the tween steps. Called once per property per target.
3737
* @property {array} [onUpdateParams] - Additional parameters to pass to `onUpdate`.
3838
* @property {any} [onUpdateScope] - Scope (this) for `onUpdate`.
39-
* @property {function} [onYoyo] - A function to call each time the tween yoyos.
39+
* @property {Phaser.Types.Tweens.TweenOnYoyoCallback} [onYoyo] - A function to call each time the tween yoyos. Called once per property per target.
4040
* @property {array} [onYoyoParams] - Additional parameters to pass to `onYoyo`.
4141
* @property {any} [onYoyoScope] - Scope (this) for `onYoyo`.
4242
*
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* @callback Phaser.Types.Tweens.TweenOnCompleteCallback
3+
* @since 3.18.0
4+
*
5+
* @param {Phaser.Tweens.Tween} tween - The tween.
6+
* @param {array} targets - The tween targets.
7+
* @param {...any} param - Any value passed in `onCompleteParams`.
8+
*/
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* @callback Phaser.Types.Tweens.TweenOnLoopCallback
3+
* @since 3.18.0
4+
*
5+
* @param {Phaser.Tweens.Tween} tween - The tween.
6+
* @param {array} targets - The tween targets.
7+
* @param {...any} param - Any value passed in `onLoopParams`.
8+
*/
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* @callback Phaser.Types.Tweens.TweenOnRepeatCallback
3+
* @since 3.18.0
4+
*
5+
* @param {Phaser.Tweens.Tween} tween - The tween.
6+
* @param {any} target - The tween target.
7+
* @param {...any} param - Any value passed in `onRepeatParams`.
8+
*/
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* @callback Phaser.Types.Tweens.TweenOnStartCallback
3+
* @since 3.18.0
4+
*
5+
* @param {Phaser.Tweens.Tween} tween - The tween.
6+
* @param {array} targets - The tween targets.
7+
* @param {...any} param - Any value passed in `onStartParams`.
8+
*/
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* @callback Phaser.Types.Tweens.TweenOnUpdateCallback
3+
* @since 3.18.0
4+
*
5+
* @param {Phaser.Tweens.Tween} tween - The tween.
6+
* @param {any} target - The tween target.
7+
* @param {...any} param - Any value passed in `onUpdateParams`.
8+
*/
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* @callback Phaser.Types.Tweens.TweenOnYoyoCallback
3+
* @since 3.18.0
4+
*
5+
* @param {Phaser.Tweens.Tween} tween - The tween.
6+
* @param {any} target - The tween target.
7+
* @param {...any} param - Any value passed in `onYoyoParams`.
8+
*/

0 commit comments

Comments
 (0)