Skip to content

Commit 77626d8

Browse files
authored
Merge pull request phaserjs#4568 from samme/types/tween-configs-2
Add types for tween `props` configs
2 parents dc13cc2 + 8410f6b commit 77626d8

4 files changed

Lines changed: 38 additions & 1 deletion

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* @callback Phaser.Types.Tweens.GetEndCallback
3+
* @since 3.18.0
4+
*
5+
* @param {any} target - The tween target.
6+
* @param {string} key - The target property.
7+
* @param {number} value - The current value of the target property.
8+
*
9+
* @return {number} - The new value.
10+
*/
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* @callback Phaser.Types.Tweens.GetStartCallback
3+
* @since 3.18.0
4+
*
5+
* @param {any} target - The tween target.
6+
* @param {string} key - The target property.
7+
* @param {number} value - The current value of the target property.
8+
*
9+
* @return {number} - The new value.
10+
*/

src/tweens/typedefs/TweenBuilderConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* @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)?
21-
* @property {object} [props] - The properties to tween.
21+
* @property {Object.<string,(number|string|Phaser.Types.Tweens.GetEndCallback|Phaser.Types.Tweens.TweenPropConfig)>} [props] - The properties to tween.
2222
* @property {boolean} [useFrames=false] - Use frames or milliseconds?
2323
* @property {any} [callbackScope] - Scope (this) for the callbacks. The default scope is the tween.
2424
* @property {Phaser.Types.Tweens.TweenOnCompleteCallback} [onComplete] - A function to call when the tween completes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* @typedef {object} Phaser.Types.Tweens.TweenPropConfig
3+
* @since 3.18.0
4+
*
5+
* @property {(number|string|Phaser.Types.Tweens.GetEndCallback|Phaser.Types.Tweens.TweenPropConfig)} [value] - What the property will be at the END of the Tween.
6+
* @property {Phaser.Types.Tweens.GetEndCallback} [getEnd] - What the property will be at the END of the Tween.
7+
* @property {Phaser.Types.Tweens.GetStartCallback} [getStart] - What the property will be at the START of the Tween.
8+
* @property {(string|function)} [ease] - The ease function this tween uses.
9+
* @property {number} [delay] - Time in ms/frames before tween will start.
10+
* @property {number} [duration] - Duration of the tween in ms/frames.
11+
* @property {boolean} [yoyo] - Determines whether the tween should return back to its start value after hold has expired.
12+
* @property {number} [hold] - Time in ms/frames the tween will pause before repeating or returning to its starting value if yoyo is set to true.
13+
* @property {number} [repeat] - Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice.
14+
* @property {number} [repeatDelay] - Time in ms/frames before the repeat will start.
15+
* @property {boolean} [flipX] - Should toggleFlipX be called when yoyo or repeat happens?
16+
* @property {boolean} [flipY] - Should toggleFlipY be called when yoyo or repeat happens?
17+
*/

0 commit comments

Comments
 (0)