Namespace: Tweens

Phaser. Tweens

Classes

Timeline
Tween
TweenManager

Namespaces

Builders
Events

Members


<static> ACTIVE :integer

Tween state.

Type:
  • integer
Since: 3.0.0
Source: src/tweens/tween/const.js (Line 128)

<static> COMPLETE :integer

TweenData state.

Type:
  • integer
Since: 3.0.0
Source: src/tweens/tween/const.js (Line 90)

<static> COMPLETE_DELAY :integer

Tween state.

Type:
  • integer
Since: 3.0.0
Source: src/tweens/tween/const.js (Line 137)

<static> CREATED :integer

TweenData state.

Type:
  • integer
Since: 3.0.0
Source: src/tweens/tween/const.js (Line 9)

<static> DELAY :integer

TweenData state.

Type:
  • integer
Since: 3.0.0
Source: src/tweens/tween/const.js (Line 27)

<static> HOLD_DELAY :integer

TweenData state.

Type:
  • integer
Since: 3.0.0
Source: src/tweens/tween/const.js (Line 72)

<static> INIT :integer

TweenData state.

Type:
  • integer
Since: 3.0.0
Source: src/tweens/tween/const.js (Line 18)

<static> LOOP_DELAY :integer

Tween state.

Type:
  • integer
Since: 3.0.0
Source: src/tweens/tween/const.js (Line 119)

<static> OFFSET_DELAY :integer

TweenData state.

Type:
  • integer
Since: 3.0.0
Source: src/tweens/tween/const.js (Line 36)

<static> PAUSED :integer

Tween state.

Type:
  • integer
Since: 3.0.0
Source: src/tweens/tween/const.js (Line 110)

<static> PENDING_ADD :integer

Tween state.

Type:
  • integer
Since: 3.0.0
Source: src/tweens/tween/const.js (Line 101)

<static> PENDING_REMOVE :integer

Tween state.

Type:
  • integer
Since: 3.0.0
Source: src/tweens/tween/const.js (Line 146)

<static> PENDING_RENDER :integer

TweenData state.

Type:
  • integer
Since: 3.0.0
Source: src/tweens/tween/const.js (Line 45)

<static> PLAYING_BACKWARD :integer

TweenData state.

Type:
  • integer
Since: 3.0.0
Source: src/tweens/tween/const.js (Line 63)

<static> PLAYING_FORWARD :integer

TweenData state.

Type:
  • integer
Since: 3.0.0
Source: src/tweens/tween/const.js (Line 54)

<static> REMOVED :integer

Tween state.

Type:
  • integer
Since: 3.0.0
Source: src/tweens/tween/const.js (Line 155)

<static> REPEAT_DELAY :integer

TweenData state.

Type:
  • integer
Since: 3.0.0
Source: src/tweens/tween/const.js (Line 81)

Methods


<static> TweenData(target, key, getEnd, getStart, ease, delay, duration, yoyo, hold, repeat, repeatDelay, flipX, flipY)

Returns a TweenDataConfig object that describes the tween data for a unique property of a unique target. A single Tween consists of multiple TweenDatas, depending on how many properties are being changed by the Tween.

This is an internal function used by the TweenBuilder and should not be accessed directly, instead, Tweens should be created using the GameObjectFactory or GameObjectCreator.

Parameters:
Name Type Description
target object

The target to tween.

key string

The property of the target to tween.

getEnd function

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

getStart function

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

ease function

The ease function this tween uses.

delay number

Time in ms/frames before tween will start.

duration number

Duration of the tween in ms/frames.

yoyo boolean

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

hold number

Time in ms/frames the tween will pause before repeating or returning to its starting value if yoyo is set to true.

repeat number

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

Time in ms/frames 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?

Since: 3.0.0
Source: src/tweens/tween/TweenData.js (Line 46)
Returns:

The config object describing this TweenData.

Type
TweenDataConfig

Type Definitions


TweenConfigDefaults

Type:
  • object
Properties:
Name Type Argument Default Description
targets object | Array.<object>

The object, or an array of objects, to run the tween on.

delay number <optional>
0

The number of milliseconds to delay before the tween will start.

duration number <optional>
1000

The duration of the tween in milliseconds.

ease string <optional>
'Power0'

The easing equation to use for the tween.

easeParams array <optional>

Optional easing parameters.

hold number <optional>
0

The number of milliseconds to hold the tween for before yoyo'ing.

repeat number <optional>
0

The number of times to repeat the tween.

repeatDelay number <optional>
0

The number of milliseconds to pause before a tween will repeat.

yoyo boolean <optional>
false

Should the tween complete, then reverse the values incrementally to get back to the starting tween values? The reverse tweening will also take duration milliseconds to complete.

flipX boolean <optional>
false

Horizontally flip the target of the Tween when it completes (before it yoyos, if set to do so). Only works for targets that support the flipX property.

flipY boolean <optional>
false

Vertically flip the target of the Tween when it completes (before it yoyos, if set to do so). Only works for targets that support the flipY property.

Source: src/tweens/tween/Defaults.js (Line 7)

TweenDataConfig

Type:
  • object
Properties:
Name Type Argument Default Description
target object

The target to tween.

key string

The property of the target being tweened.

getEndValue function

The returned value sets what the property will be at the END of the Tween.

getStartValue function

The returned value sets what the property will be at the START of the Tween.

ease function

The ease function this tween uses.

duration number <optional>
0

Duration of the tween in ms/frames, excludes time for yoyo or repeats.

totalDuration number <optional>
0

The total calculated duration of this TweenData (based on duration, repeat, delay and yoyo)

delay number <optional>
0

Time in ms/frames before tween will start.

yoyo boolean <optional>
false

Cause the tween to return back to its start value after hold has expired.

hold number <optional>
0

Time in ms/frames the tween will pause before running the yoyo or starting a repeat.

repeat integer <optional>
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.

repeatDelay number <optional>
0

Time in ms/frames before the repeat will start.

flipX boolean <optional>
false

Automatically call toggleFlipX when the TweenData yoyos or repeats

flipY boolean <optional>
false

Automatically call toggleFlipY when the TweenData yoyos or repeats

progress number <optional>
0

Between 0 and 1 showing completion of this TweenData.

elapsed number <optional>
0

Delta counter

repeatCounter integer <optional>
0

How many repeats are left to run?

start number <optional>
0

Ease value data.

current number <optional>
0

Ease value data.

end number <optional>
0

Ease value data.

t1 number <optional>
0

Time duration 1.

t2 number <optional>
0

Time duration 2.

gen TweenDataGenConfig <optional>

LoadValue generation functions.

state integer <optional>
0

TWEEN_CONST.CREATED

Source: src/tweens/tween/TweenData.js (Line 17)