Corrected jsdocs

This commit is contained in:
Richard Davey 2022-09-20 13:08:53 +01:00
parent 009ad199bf
commit e42c814af8
4 changed files with 68 additions and 49 deletions

View file

@ -9,16 +9,11 @@ var TWEEN_CONST = require('./const');
/** /**
* @classdesc * @classdesc
* The TweenData is a class that contains a single target and property that is being tweened. * BaseTweenData is the class that the TweenData and TweenFrameData classes
* extend from. You should not typically instantiate this class directly, but instead
* use it to form your own tween data classes from, should you require it.
* *
* Tweens create TweenData instances when they are created, with one TweenData instance per * Prior to Phaser 3.60 the TweenData was just an object, but was refactored to a class,
* target, per property. A Tween can own multiple TweenData instances, but a TweenData only
* ever belongs to a single Tween.
*
* You should not typically create these yourself, but rather use the TweenBuilder,
* or the `Tween.add` method.
*
* Prior to Phaser 3.60 the TweenData was just an object, but was refactored to a class,
* to make it responsible for its own state and updating. * to make it responsible for its own state and updating.
* *
* @class BaseTweenData * @class BaseTweenData
@ -53,7 +48,7 @@ var BaseTweenData = new Class({
/** /**
* A reference to the Tween that this TweenData instance belongs to. * A reference to the Tween that this TweenData instance belongs to.
* *
* @name Phaser.Tweens.TweenData#tween * @name Phaser.Tweens.BaseTweenData#tween
* @type {Phaser.Tweens.Tween} * @type {Phaser.Tweens.Tween}
* @since 3.60.0 * @since 3.60.0
*/ */
@ -62,7 +57,7 @@ var BaseTweenData = new Class({
/** /**
* The index of the target within the Tween `targets` array. * The index of the target within the Tween `targets` array.
* *
* @name Phaser.Tweens.TweenData#targetIndex * @name Phaser.Tweens.BaseTweenData#targetIndex
* @type {number} * @type {number}
* @since 3.60.0 * @since 3.60.0
*/ */
@ -72,7 +67,7 @@ var BaseTweenData = new Class({
* The duration of the tween in milliseconds, excluding any time required * The duration of the tween in milliseconds, excluding any time required
* for yoyo or repeats. * for yoyo or repeats.
* *
* @name Phaser.Tweens.TweenData#duration * @name Phaser.Tweens.BaseTweenData#duration
* @type {number} * @type {number}
* @since 3.60.0 * @since 3.60.0
*/ */
@ -82,7 +77,7 @@ var BaseTweenData = new Class({
* The total calculated duration, in milliseconds, of this TweenData. * The total calculated duration, in milliseconds, of this TweenData.
* Factoring in the duration, repeats, delays and yoyos. * Factoring in the duration, repeats, delays and yoyos.
* *
* @name Phaser.Tweens.TweenData#totalDuration * @name Phaser.Tweens.BaseTweenData#totalDuration
* @type {number} * @type {number}
* @since 3.60.0 * @since 3.60.0
*/ */
@ -93,7 +88,7 @@ var BaseTweenData = new Class({
* *
* This value is generated by the `getDelay` function. * This value is generated by the `getDelay` function.
* *
* @name Phaser.Tweens.TweenData#delay * @name Phaser.Tweens.BaseTweenData#delay
* @type {number} * @type {number}
* @since 3.60.0 * @since 3.60.0
*/ */
@ -102,7 +97,7 @@ var BaseTweenData = new Class({
/** /**
* This function returns the value to be used for `TweenData.delay`. * This function returns the value to be used for `TweenData.delay`.
* *
* @name Phaser.Tweens.TweenData#getDelay * @name Phaser.Tweens.BaseTweenData#getDelay
* @type {function} * @type {function}
* @since 3.60.0 * @since 3.60.0
*/ */
@ -112,7 +107,7 @@ var BaseTweenData = new Class({
* Will the Tween ease back to its starting values, after reaching the end * Will the Tween ease back to its starting values, after reaching the end
* and any `hold` value that may be set? * and any `hold` value that may be set?
* *
* @name Phaser.Tweens.TweenData#yoyo * @name Phaser.Tweens.BaseTweenData#yoyo
* @type {boolean} * @type {boolean}
* @since 3.60.0 * @since 3.60.0
*/ */
@ -121,7 +116,7 @@ var BaseTweenData = new Class({
/** /**
* The time, in milliseconds, before this tween will start a yoyo to repeat. * The time, in milliseconds, before this tween will start a yoyo to repeat.
* *
* @name Phaser.Tweens.TweenData#hold * @name Phaser.Tweens.BaseTweenData#hold
* @type {number} * @type {number}
* @since 3.60.0 * @since 3.60.0
*/ */
@ -136,7 +131,7 @@ var BaseTweenData = new Class({
* *
* If this value is set to -1 this tween will repeat forever. * If this value is set to -1 this tween will repeat forever.
* *
* @name Phaser.Tweens.TweenData#repeat * @name Phaser.Tweens.BaseTweenData#repeat
* @type {number} * @type {number}
* @since 3.60.0 * @since 3.60.0
*/ */
@ -145,7 +140,7 @@ var BaseTweenData = new Class({
/** /**
* The time, in milliseconds, before the repeat will start. * The time, in milliseconds, before the repeat will start.
* *
* @name Phaser.Tweens.TweenData#repeatDelay * @name Phaser.Tweens.BaseTweenData#repeatDelay
* @type {number} * @type {number}
* @since 3.60.0 * @since 3.60.0
*/ */
@ -154,7 +149,7 @@ var BaseTweenData = new Class({
/** /**
* How many repeats are left to run? * How many repeats are left to run?
* *
* @name Phaser.Tweens.TweenData#repeatCounter * @name Phaser.Tweens.BaseTweenData#repeatCounter
* @type {number} * @type {number}
* @since 3.60.0 * @since 3.60.0
*/ */
@ -165,7 +160,7 @@ var BaseTweenData = new Class({
* whenever it yoyo's or repeats. It will only be called if the target * whenever it yoyo's or repeats. It will only be called if the target
* has a function matching this name, like most Phaser GameObjects do. * has a function matching this name, like most Phaser GameObjects do.
* *
* @name Phaser.Tweens.TweenData#flipX * @name Phaser.Tweens.BaseTweenData#flipX
* @type {boolean} * @type {boolean}
* @since 3.60.0 * @since 3.60.0
*/ */
@ -176,7 +171,7 @@ var BaseTweenData = new Class({
* whenever it yoyo's or repeats. It will only be called if the target * whenever it yoyo's or repeats. It will only be called if the target
* has a function matching this name, like most Phaser GameObjects do. * has a function matching this name, like most Phaser GameObjects do.
* *
* @name Phaser.Tweens.TweenData#flipY * @name Phaser.Tweens.BaseTweenData#flipY
* @type {boolean} * @type {boolean}
* @since 3.60.0 * @since 3.60.0
*/ */
@ -185,7 +180,7 @@ var BaseTweenData = new Class({
/** /**
* A value between 0 and 1 holding the progress of this TweenData. * A value between 0 and 1 holding the progress of this TweenData.
* *
* @name Phaser.Tweens.TweenData#progress * @name Phaser.Tweens.BaseTweenData#progress
* @type {number} * @type {number}
* @since 3.60.0 * @since 3.60.0
*/ */
@ -195,7 +190,7 @@ var BaseTweenData = new Class({
* The amount of time, in milliseconds, that has elapsed since this * The amount of time, in milliseconds, that has elapsed since this
* TweenData was made active. * TweenData was made active.
* *
* @name Phaser.Tweens.TweenData#elapsed * @name Phaser.Tweens.BaseTweenData#elapsed
* @type {number} * @type {number}
* @since 3.60.0 * @since 3.60.0
*/ */
@ -204,7 +199,7 @@ var BaseTweenData = new Class({
/** /**
* The state of this TweenData. * The state of this TweenData.
* *
* @name Phaser.Tweens.TweenData#state * @name Phaser.Tweens.BaseTweenData#state
* @type {Phaser.Types.Tweens.TweenDataState} * @type {Phaser.Types.Tweens.TweenDataState}
* @since 3.60.0 * @since 3.60.0
*/ */
@ -213,7 +208,7 @@ var BaseTweenData = new Class({
/** /**
* Is this Tween Data currently waiting for a countdown to elapse, or not? * Is this Tween Data currently waiting for a countdown to elapse, or not?
* *
* @name Phaser.Tweens.TweenData#isCountdown * @name Phaser.Tweens.BaseTweenData#isCountdown
* @type {boolean} * @type {boolean}
* @since 3.60.0 * @since 3.60.0
*/ */
@ -223,7 +218,7 @@ var BaseTweenData = new Class({
/** /**
* Sets this TweenData state to CREATED. * Sets this TweenData state to CREATED.
* *
* @method Phaser.Tweens.TweenData#setCreatedState * @method Phaser.Tweens.BaseTweenData#setCreatedState
* @since 3.60.0 * @since 3.60.0
*/ */
setCreatedState: function () setCreatedState: function ()
@ -235,7 +230,7 @@ var BaseTweenData = new Class({
/** /**
* Sets this TweenData state to DELAY. * Sets this TweenData state to DELAY.
* *
* @method Phaser.Tweens.TweenData#setDelayState * @method Phaser.Tweens.BaseTweenData#setDelayState
* @since 3.60.0 * @since 3.60.0
*/ */
setDelayState: function () setDelayState: function ()
@ -247,7 +242,7 @@ var BaseTweenData = new Class({
/** /**
* Sets this TweenData state to PENDING_RENDER. * Sets this TweenData state to PENDING_RENDER.
* *
* @method Phaser.Tweens.TweenData#setPendingRenderState * @method Phaser.Tweens.BaseTweenData#setPendingRenderState
* @since 3.60.0 * @since 3.60.0
*/ */
setPendingRenderState: function () setPendingRenderState: function ()
@ -259,7 +254,7 @@ var BaseTweenData = new Class({
/** /**
* Sets this TweenData state to PLAYING_FORWARD. * Sets this TweenData state to PLAYING_FORWARD.
* *
* @method Phaser.Tweens.TweenData#setPlayingForwardState * @method Phaser.Tweens.BaseTweenData#setPlayingForwardState
* @since 3.60.0 * @since 3.60.0
*/ */
setPlayingForwardState: function () setPlayingForwardState: function ()
@ -271,7 +266,7 @@ var BaseTweenData = new Class({
/** /**
* Sets this TweenData state to PLAYING_BACKWARD. * Sets this TweenData state to PLAYING_BACKWARD.
* *
* @method Phaser.Tweens.TweenData#setPlayingBackwardState * @method Phaser.Tweens.BaseTweenData#setPlayingBackwardState
* @since 3.60.0 * @since 3.60.0
*/ */
setPlayingBackwardState: function () setPlayingBackwardState: function ()
@ -283,7 +278,7 @@ var BaseTweenData = new Class({
/** /**
* Sets this TweenData state to HOLD_DELAY. * Sets this TweenData state to HOLD_DELAY.
* *
* @method Phaser.Tweens.TweenData#setHoldState * @method Phaser.Tweens.BaseTweenData#setHoldState
* @since 3.60.0 * @since 3.60.0
*/ */
setHoldState: function () setHoldState: function ()
@ -295,7 +290,7 @@ var BaseTweenData = new Class({
/** /**
* Sets this TweenData state to REPEAT_DELAY. * Sets this TweenData state to REPEAT_DELAY.
* *
* @method Phaser.Tweens.TweenData#setRepeatState * @method Phaser.Tweens.BaseTweenData#setRepeatState
* @since 3.60.0 * @since 3.60.0
*/ */
setRepeatState: function () setRepeatState: function ()
@ -307,7 +302,7 @@ var BaseTweenData = new Class({
/** /**
* Sets this TweenData state to COMPLETE. * Sets this TweenData state to COMPLETE.
* *
* @method Phaser.Tweens.TweenData#setCompleteState * @method Phaser.Tweens.BaseTweenData#setCompleteState
* @since 3.60.0 * @since 3.60.0
*/ */
setCompleteState: function () setCompleteState: function ()
@ -319,7 +314,7 @@ var BaseTweenData = new Class({
/** /**
* Returns `true` if this TweenData has a _current_ state of CREATED, otherwise `false`. * Returns `true` if this TweenData has a _current_ state of CREATED, otherwise `false`.
* *
* @method Phaser.Tweens.TweenData#isCreated * @method Phaser.Tweens.BaseTweenData#isCreated
* @since 3.60.0 * @since 3.60.0
* *
* @return {boolean} `true` if this TweenData has a _current_ state of CREATED, otherwise `false`. * @return {boolean} `true` if this TweenData has a _current_ state of CREATED, otherwise `false`.
@ -332,7 +327,7 @@ var BaseTweenData = new Class({
/** /**
* Returns `true` if this TweenData has a _current_ state of DELAY, otherwise `false`. * Returns `true` if this TweenData has a _current_ state of DELAY, otherwise `false`.
* *
* @method Phaser.Tweens.TweenData#isDelayed * @method Phaser.Tweens.BaseTweenData#isDelayed
* @since 3.60.0 * @since 3.60.0
* *
* @return {boolean} `true` if this TweenData has a _current_ state of DELAY, otherwise `false`. * @return {boolean} `true` if this TweenData has a _current_ state of DELAY, otherwise `false`.
@ -345,7 +340,7 @@ var BaseTweenData = new Class({
/** /**
* Returns `true` if this TweenData has a _current_ state of PENDING_RENDER, otherwise `false`. * Returns `true` if this TweenData has a _current_ state of PENDING_RENDER, otherwise `false`.
* *
* @method Phaser.Tweens.TweenData#isPendingRender * @method Phaser.Tweens.BaseTweenData#isPendingRender
* @since 3.60.0 * @since 3.60.0
* *
* @return {boolean} `true` if this TweenData has a _current_ state of PENDING_RENDER, otherwise `false`. * @return {boolean} `true` if this TweenData has a _current_ state of PENDING_RENDER, otherwise `false`.
@ -358,7 +353,7 @@ var BaseTweenData = new Class({
/** /**
* Returns `true` if this TweenData has a _current_ state of PLAYING_FORWARD, otherwise `false`. * Returns `true` if this TweenData has a _current_ state of PLAYING_FORWARD, otherwise `false`.
* *
* @method Phaser.Tweens.TweenData#isPlayingForward * @method Phaser.Tweens.BaseTweenData#isPlayingForward
* @since 3.60.0 * @since 3.60.0
* *
* @return {boolean} `true` if this TweenData has a _current_ state of PLAYING_FORWARD, otherwise `false`. * @return {boolean} `true` if this TweenData has a _current_ state of PLAYING_FORWARD, otherwise `false`.
@ -371,7 +366,7 @@ var BaseTweenData = new Class({
/** /**
* Returns `true` if this TweenData has a _current_ state of PLAYING_BACKWARD, otherwise `false`. * Returns `true` if this TweenData has a _current_ state of PLAYING_BACKWARD, otherwise `false`.
* *
* @method Phaser.Tweens.TweenData#isPlayingBackward * @method Phaser.Tweens.BaseTweenData#isPlayingBackward
* @since 3.60.0 * @since 3.60.0
* *
* @return {boolean} `true` if this TweenData has a _current_ state of PLAYING_BACKWARD, otherwise `false`. * @return {boolean} `true` if this TweenData has a _current_ state of PLAYING_BACKWARD, otherwise `false`.
@ -384,7 +379,7 @@ var BaseTweenData = new Class({
/** /**
* Returns `true` if this TweenData has a _current_ state of HOLD_DELAY, otherwise `false`. * Returns `true` if this TweenData has a _current_ state of HOLD_DELAY, otherwise `false`.
* *
* @method Phaser.Tweens.TweenData#isHolding * @method Phaser.Tweens.BaseTweenData#isHolding
* @since 3.60.0 * @since 3.60.0
* *
* @return {boolean} `true` if this TweenData has a _current_ state of HOLD_DELAY, otherwise `false`. * @return {boolean} `true` if this TweenData has a _current_ state of HOLD_DELAY, otherwise `false`.
@ -397,7 +392,7 @@ var BaseTweenData = new Class({
/** /**
* Returns `true` if this TweenData has a _current_ state of REPEAT_DELAY, otherwise `false`. * Returns `true` if this TweenData has a _current_ state of REPEAT_DELAY, otherwise `false`.
* *
* @method Phaser.Tweens.TweenData#isRepeating * @method Phaser.Tweens.BaseTweenData#isRepeating
* @since 3.60.0 * @since 3.60.0
* *
* @return {boolean} `true` if this TweenData has a _current_ state of REPEAT_DELAY, otherwise `false`. * @return {boolean} `true` if this TweenData has a _current_ state of REPEAT_DELAY, otherwise `false`.
@ -410,7 +405,7 @@ var BaseTweenData = new Class({
/** /**
* Returns `true` if this TweenData has a _current_ state of COMPLETE, otherwise `false`. * Returns `true` if this TweenData has a _current_ state of COMPLETE, otherwise `false`.
* *
* @method Phaser.Tweens.TweenData#isComplete * @method Phaser.Tweens.BaseTweenData#isComplete
* @since 3.60.0 * @since 3.60.0
* *
* @return {boolean} `true` if this TweenData has a _current_ state of COMPLETE, otherwise `false`. * @return {boolean} `true` if this TweenData has a _current_ state of COMPLETE, otherwise `false`.
@ -423,7 +418,7 @@ var BaseTweenData = new Class({
/** /**
* Immediately destroys this TweenData, nulling of all its references. * Immediately destroys this TweenData, nulling of all its references.
* *
* @method Phaser.Tweens.TweenData#destroy * @method Phaser.Tweens.BaseTweenData#destroy
* @since 3.60.0 * @since 3.60.0
*/ */
destroy: function () destroy: function ()

View file

@ -178,7 +178,28 @@ var Tween = new Class({
return tweenData; return tweenData;
}, },
addFrameData: function (targetIndex, texture, frame, delay, duration, hold, repeat, repeatDelay, flipX, flipY) /**
* Adds a new TweenFrameData to this Tween. Typically, this method is called
* automatically by the TweenBuilder, however you can also invoke it
* yourself.
*
* @method Phaser.Tweens.Tween#addFrame
* @since 3.60.0
*
* @param {number} targetIndex - The target index within the Tween targets array.
* @param {string} texture - The texture to set on the target at the end of the tween.
* @param {string|number} frame - The texture frame to set on the target at the end of the tween.
* @param {function} delay - Function that returns the time in ms/frames before tween will start.
* @param {number} duration - The duration of the tween in ms/frames.
* @param {number} hold - Function that returns the time in ms/frames the tween will pause before repeating or returning to its starting value if yoyo is set to true.
* @param {number} repeat - Function that returns the 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.
* @param {number} repeatDelay - Function that returns the time in ms/frames before the repeat will start.
* @param {boolean} flipX - Should toggleFlipX be called when yoyo or repeat happens?
* @param {boolean} flipY - Should toggleFlipY be called when yoyo or repeat happens?
*
* @return {Phaser.Tweens.TweenFrameData} The TweenFrameData instance that was added.
*/
addFrame: function (targetIndex, texture, frame, delay, duration, hold, repeat, repeatDelay, flipX, flipY)
{ {
var tweenData = new TweenFrameData(this, targetIndex, texture, frame, delay, duration, hold, repeat, repeatDelay, flipX, flipY); var tweenData = new TweenFrameData(this, targetIndex, texture, frame, delay, duration, hold, repeat, repeatDelay, flipX, flipY);

View file

@ -19,7 +19,7 @@ var Events = require('../events');
* You should not typically create these yourself, but rather use the TweenBuilder, * You should not typically create these yourself, but rather use the TweenBuilder,
* or the `Tween.add` method. * or the `Tween.add` method.
* *
* Prior to Phaser 3.60 the TweenData was just an object, but was refactored to a class, * Prior to Phaser 3.60 the TweenData was just an object, but was refactored to a class,
* to make it responsible for its own state and updating. * to make it responsible for its own state and updating.
* *
* @class TweenData * @class TweenData

View file

@ -10,14 +10,17 @@ var Events = require('../events');
/** /**
* @classdesc * @classdesc
* The TweenFrameData is a class that contains a single target that it will change the texture frame on. * The TweenFrameData is a class that contains a single target that will change the texture frame
* and the conclusion of the tween.
* *
* Tweens create TweenFrameData instances when they are created, with one TweenData instance per * TweenFrameData instances are typically created by the TweenBuilder automatically, when it
* target, per property. A Tween can own multiple TweenData instances, but a TweenData only * detects the prescence of a 'texture' property as the key being tweened.
*
* A Tween can own multiple TweenFrameData instances, but a TweenFrameData only
* ever belongs to a single Tween. * ever belongs to a single Tween.
* *
* You should not typically create these yourself, but rather use the TweenBuilder, * You should not typically create these yourself, but rather use the TweenBuilder,
* or the `Tween.add` method. * or the `Tween.addFrame` method.
* *
* @class TweenFrameData * @class TweenFrameData
* @memberof Phaser.Tweens * @memberof Phaser.Tweens