Added TweenData type def

This commit is contained in:
Richard Davey 2018-03-21 16:23:48 +00:00
parent 0ef92e1172
commit b3965fb5a2
2 changed files with 45 additions and 6 deletions

View file

@ -19,7 +19,7 @@ var TWEEN_CONST = require('./const');
* @since 3.0.0
*
* @param {(Phaser.Tweens.TweenManager|Phaser.Tweens.Timeline)} parent - [description]
* @param {Phaser.Tweens.TweenData[]} data - [description]
* @param {Phaser.Tweens.TweenDataConfig[]} data - [description]
* @param {array} targets - [description]
*/
var Tween = new Class({
@ -50,7 +50,7 @@ var Tween = new Class({
* An array of TweenData objects, each containing a unique property and target being tweened.
*
* @name Phaser.Tweens.Tween#data
* @type {Phaser.Tweens.TweenData[]}
* @type {Phaser.Tweens.TweenDataConfig[]}
* @since 3.0.0
*/
this.data = data;
@ -1000,7 +1000,7 @@ var Tween = new Class({
* @since 3.0.0
*
* @param {Phaser.Tweens.Tween} tween - [description]
* @param {Phaser.Tweens.TweenData} tweenData - [description]
* @param {Phaser.Tweens.TweenDataConfig} tweenData - [description]
* @param {number} diff - [description]
*
* @return {integer} The state of this Tween.
@ -1104,7 +1104,7 @@ var Tween = new Class({
* @since 3.0.0
*
* @param {Phaser.Tweens.Tween} tween - [description]
* @param {Phaser.Tweens.TweenData} tweenData - [description]
* @param {Phaser.Tweens.TweenDataConfig} tweenData - [description]
* @param {number} diff - [description]
*
* @return {integer} The state of this Tween.
@ -1169,7 +1169,7 @@ var Tween = new Class({
* @since 3.0.0
*
* @param {Phaser.Tweens.Tween} tween - [description]
* @param {Phaser.Tweens.TweenData} tweenData - [description]
* @param {Phaser.Tweens.TweenDataConfig} tweenData - [description]
* @param {number} delta - Either a value in ms, or 1 if Tween.useFrames is true
*
* @return {boolean} [description]

View file

@ -4,6 +4,45 @@
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
* @typedef {object} TweenDataGenConfig
*
* @property {function} delay - [description]
* @property {function} duration - [description]
* @property {function} hold - [description]
* @property {function} repeat - [description]
* @property {function} repeatDelay - [description]
*/
/**
* @typedef {object} Phaser.Tweens.TweenDataConfig
*
* @property {object} target - The target to tween.
* @property {string} key - The property of the target being tweened.
* @property {function} getEndValue - The returned value sets what the property will be at the END of the Tween.
* @property {function} getStartValue - The returned value sets what the property will be at the START of the Tween.
* @property {function} ease - The ease function this tween uses.
* @property {number} [duration=0] - Duration of the tween in ms/frames, excludes time for yoyo or repeats.
* @property {number} [totalDuration=0] - The total calculated duration of this TweenData (based on duration, repeat, delay and yoyo)
* @property {number} [delay=0] - Time in ms/frames before tween will start.
* @property {boolean} [yoyo=false] - Cause the tween to return back to its start value after hold has expired.
* @property {number} [hold=0] - Time in ms/frames the tween will pause before running the yoyo or starting a repeat.
* @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.
* @property {number} [repeatDelay=0] - Time in ms/frames before the repeat will start.
* @property {boolean} [flipX=false] - Automatically call toggleFlipX when the TweenData yoyos or repeats
* @property {boolean} [flipY=false] - Automatically call toggleFlipY when the TweenData yoyos or repeats
* @property {float} [progress=0] - Between 0 and 1 showing completion of this TweenData.
* @property {float} [elapsed=0] - Delta counter
* @property {integer} [repeatCounter=0] - How many repeats are left to run?
* @property {number} [start=0] - Ease value data.
* @property {number} [current=0] - Ease value data.
* @property {number} [end=0] - Ease value data.
* @property {number} [t1=0] - Time duration 1.
* @property {number} [t2=0] - Time duration 2.
* @property {TweenDataGenConfig} [gen] - LoadValue generation functions.
* @property {integer} [state=0] - TWEEN_CONST.CREATED
*/
/**
* [description]
*
@ -24,7 +63,7 @@
* @param {boolean} flipX - [description]
* @param {boolean} flipY - [description]
*
* @return {Phaser.Tweens.TweenData} [description]
* @return {TweenDataConfig} [description]
*/
var TweenData = function (target, key, getEnd, getStart, ease, delay, duration, yoyo, hold, repeat, repeatDelay, flipX, flipY)
{