Phaser API Documentation

  Version: 

Member of: Phaser.Tweens.Tween

add(targetIndex, key, getEnd, getStart, getActive, ease, delay, duration, yoyo, hold, repeat, repeatDelay, flipX, flipY, interpolation, interpolationData)

Description:

Adds a new TweenData to this Tween. Typically, this method is called automatically by the TweenBuilder, however you can also invoke it yourself.

Parameters:

name type description
targetIndex number

The target index within the Tween targets array.

key string

The property of the target to tween.

getEnd Phaser.Types.Tweens.GetEndCallback

What the property will be at the END of the Tween.

getStart Phaser.Types.Tweens.GetStartCallback

What the property will be at the START of the Tween.

getActive Phaser.Types.Tweens.GetActiveCallback

If not null, is invoked immediately as soon as the TweenData is running, and is set on the target property.

ease function

The ease function this tween uses.

delay function

Function that returns the time in milliseconds before tween will start.

duration number

The duration of the tween in milliseconds.

yoyo boolean

Determines whether the tween should return back to its start value after hold has expired.

hold number

Function that returns the time in milliseconds the tween will pause before repeating or returning to its starting value if yoyo is set to true.

repeat number

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.

repeatDelay number

Function that returns the time in milliseconds before the repeat will start.

flipX boolean

Should toggleFlipX be called when yoyo or repeat happens?

flipY boolean

Should toggleFlipY be called when yoyo or repeat happens?

interpolation function

The interpolation function to be used for arrays of data. Defaults to 'null'.

interpolationData Array.<number>

The array of interpolation data to be set. Defaults to 'null'.

Returns:
Description:

The TweenData instance that was added.

Since: 3.60.0