Skip to content

Commit b3965fb

Browse files
committed
Added TweenData type def
1 parent 0ef92e1 commit b3965fb

2 files changed

Lines changed: 45 additions & 6 deletions

File tree

src/tweens/tween/Tween.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var TWEEN_CONST = require('./const');
1919
* @since 3.0.0
2020
*
2121
* @param {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} parent - [description]
22-
* @param {Phaser.Tweens.TweenData[]} data - [description]
22+
* @param {Phaser.Tweens.TweenDataConfig[]} data - [description]
2323
* @param {array} targets - [description]
2424
*/
2525
var Tween = new Class({
@@ -50,7 +50,7 @@ var Tween = new Class({
5050
* An array of TweenData objects, each containing a unique property and target being tweened.
5151
*
5252
* @name Phaser.Tweens.Tween#data
53-
* @type {Phaser.Tweens.TweenData[]}
53+
* @type {Phaser.Tweens.TweenDataConfig[]}
5454
* @since 3.0.0
5555
*/
5656
this.data = data;
@@ -1000,7 +1000,7 @@ var Tween = new Class({
10001000
* @since 3.0.0
10011001
*
10021002
* @param {Phaser.Tweens.Tween} tween - [description]
1003-
* @param {Phaser.Tweens.TweenData} tweenData - [description]
1003+
* @param {Phaser.Tweens.TweenDataConfig} tweenData - [description]
10041004
* @param {number} diff - [description]
10051005
*
10061006
* @return {integer} The state of this Tween.
@@ -1104,7 +1104,7 @@ var Tween = new Class({
11041104
* @since 3.0.0
11051105
*
11061106
* @param {Phaser.Tweens.Tween} tween - [description]
1107-
* @param {Phaser.Tweens.TweenData} tweenData - [description]
1107+
* @param {Phaser.Tweens.TweenDataConfig} tweenData - [description]
11081108
* @param {number} diff - [description]
11091109
*
11101110
* @return {integer} The state of this Tween.
@@ -1169,7 +1169,7 @@ var Tween = new Class({
11691169
* @since 3.0.0
11701170
*
11711171
* @param {Phaser.Tweens.Tween} tween - [description]
1172-
* @param {Phaser.Tweens.TweenData} tweenData - [description]
1172+
* @param {Phaser.Tweens.TweenDataConfig} tweenData - [description]
11731173
* @param {number} delta - Either a value in ms, or 1 if Tween.useFrames is true
11741174
*
11751175
* @return {boolean} [description]

src/tweens/tween/TweenData.js

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,45 @@
44
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
55
*/
66

7+
/**
8+
* @typedef {object} TweenDataGenConfig
9+
*
10+
* @property {function} delay - [description]
11+
* @property {function} duration - [description]
12+
* @property {function} hold - [description]
13+
* @property {function} repeat - [description]
14+
* @property {function} repeatDelay - [description]
15+
*/
16+
17+
/**
18+
* @typedef {object} Phaser.Tweens.TweenDataConfig
19+
*
20+
* @property {object} target - The target to tween.
21+
* @property {string} key - The property of the target being tweened.
22+
* @property {function} getEndValue - The returned value sets what the property will be at the END of the Tween.
23+
* @property {function} getStartValue - The returned value sets what the property will be at the START of the Tween.
24+
* @property {function} ease - The ease function this tween uses.
25+
* @property {number} [duration=0] - Duration of the tween in ms/frames, excludes time for yoyo or repeats.
26+
* @property {number} [totalDuration=0] - The total calculated duration of this TweenData (based on duration, repeat, delay and yoyo)
27+
* @property {number} [delay=0] - Time in ms/frames before tween will start.
28+
* @property {boolean} [yoyo=false] - Cause the tween to return back to its start value after hold has expired.
29+
* @property {number} [hold=0] - Time in ms/frames the tween will pause before running the yoyo or starting a repeat.
30+
* @property {integer} [repeat=0] - 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.
31+
* @property {number} [repeatDelay=0] - Time in ms/frames before the repeat will start.
32+
* @property {boolean} [flipX=false] - Automatically call toggleFlipX when the TweenData yoyos or repeats
33+
* @property {boolean} [flipY=false] - Automatically call toggleFlipY when the TweenData yoyos or repeats
34+
* @property {float} [progress=0] - Between 0 and 1 showing completion of this TweenData.
35+
* @property {float} [elapsed=0] - Delta counter
36+
* @property {integer} [repeatCounter=0] - How many repeats are left to run?
37+
* @property {number} [start=0] - Ease value data.
38+
* @property {number} [current=0] - Ease value data.
39+
* @property {number} [end=0] - Ease value data.
40+
* @property {number} [t1=0] - Time duration 1.
41+
* @property {number} [t2=0] - Time duration 2.
42+
* @property {TweenDataGenConfig} [gen] - LoadValue generation functions.
43+
* @property {integer} [state=0] - TWEEN_CONST.CREATED
44+
*/
45+
746
/**
847
* [description]
948
*
@@ -24,7 +63,7 @@
2463
* @param {boolean} flipX - [description]
2564
* @param {boolean} flipY - [description]
2665
*
27-
* @return {Phaser.Tweens.TweenData} [description]
66+
* @return {TweenDataConfig} [description]
2867
*/
2968
var TweenData = function (target, key, getEnd, getStart, ease, delay, duration, yoyo, hold, repeat, repeatDelay, flipX, flipY)
3069
{

0 commit comments

Comments
 (0)