Skip to main content
Version: Phaser v4.0.0-rc.6

Types.Tweens

TweenConfigDefaults

<static> TweenConfigDefaults

nametypeoptionaldefaultdescription
targetsobject | Array.<object>NoThe object, or an array of objects, to run the tween on.
delaynumberYes0The number of milliseconds to delay before the tween will start.
durationnumberYes1000The duration of the tween in milliseconds.
easestringYes"'Power0'"The easing equation to use for the tween.
easeParamsarrayYesOptional easing parameters.
holdnumberYes0The number of milliseconds to hold the tween for before yoyo'ing.
repeatnumberYes0The number of times to repeat the tween.
repeatDelaynumberYes0The number of milliseconds to pause before a tween will repeat.
yoyobooleanYesfalseShould 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.
flipXbooleanYesfalseHorizontally 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.
flipYbooleanYesfalseVertically 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.
persistbooleanYesfalseRetain the tween within the Tween Manager, even after playback completes?
interpolationfunctionYesnullThe interpolation function to use for array-based tween values.

Type: object

Member of: Phaser.Types.Tweens

Source: src/tweens/tween/Defaults.js#L7
Since: 3.0.0


Event

<static> Event

A Tween Event.

Type: string

Member of: Phaser.Types.Tweens

Source: src/tweens/typedefs/Event.js#L1
Since: 3.19.0


GetActiveCallback

<static> GetActiveCallback

Type: function

Member of: Phaser.Types.Tweens

Source: src/tweens/typedefs/GetActiveCallback.js#L1
Since: 3.19.0


GetEndCallback

<static> GetEndCallback

Type: function

Member of: Phaser.Types.Tweens

Source: src/tweens/typedefs/GetEndCallback.js#L1
Since: 3.18.0


GetStartCallback

<static> GetStartCallback

Type: function

Member of: Phaser.Types.Tweens

Source: src/tweens/typedefs/GetStartCallback.js#L1
Since: 3.18.0


NumberTweenBuilderConfig

<static> NumberTweenBuilderConfig

nametypeoptionaldefaultdescription
fromnumberYes0The start number.
tonumberYes1The end number.
delaynumberYes0The number of milliseconds to delay before the counter will start.
durationnumberYes1000The duration of the counter in milliseconds.
easestring | functionYes"'Power0'"The easing equation to use for the counter.
easeParamsarrayYesOptional easing parameters.
holdnumberYes0The number of milliseconds to hold the counter for before yoyo'ing.
repeatnumberYes0The number of times to repeat the counter.
repeatDelaynumberYes0The number of milliseconds to pause before the counter will repeat.
yoyobooleanYesfalseShould the counter play forward to the end value and then backwards to the start? The reverse playback will also take duration milliseconds to complete.
completeDelaystring | numberfunctionobjectarray
loopstring | numberfunctionobjectarray
loopDelaystring | numberfunctionobjectarray
pausedbooleanYesfalseDoes the counter start in a paused state (true) or playing (false)?
callbackScopeanyYesScope (this) for the callbacks. The default scope is the counter.
onCompletePhaser.Types.Tweens.TweenOnCompleteCallbackYesA function to call when the counter completes.
onCompleteParamsarrayYesAdditional parameters to pass to onComplete.
onLoopPhaser.Types.Tweens.TweenOnLoopCallbackYesA function to call each time the counter loops.
onLoopParamsarrayYesAdditional parameters to pass to onLoop.
onRepeatPhaser.Types.Tweens.TweenOnRepeatCallbackYesA function to call each time the counter repeats.
onRepeatParamsarrayYesAdditional parameters to pass to onRepeat.
onStartPhaser.Types.Tweens.TweenOnStartCallbackYesA function to call when the counter starts.
onStartParamsarrayYesAdditional parameters to pass to onStart.
onStopPhaser.Types.Tweens.TweenOnStopCallbackYesA function to call when the counter is stopped.
onStopParamsarrayYesAdditional parameters to pass to onStop.
onUpdatePhaser.Types.Tweens.TweenOnUpdateCallbackYesA function to call each time the counter steps.
onUpdateParamsarrayYesAdditional parameters to pass to onUpdate.
onYoyoPhaser.Types.Tweens.TweenOnYoyoCallbackYesA function to call each time the counter yoyos.
onYoyoParamsarrayYesAdditional parameters to pass to onYoyo.
onPausePhaser.Types.Tweens.TweenOnPauseCallbackYesA function to call when the counter is paused.
onPauseParamsarrayYesAdditional parameters to pass to onPause.
onResumePhaser.Types.Tweens.TweenOnResumeCallbackYesA function to call when the counter is resumed after being paused.
onResumeParamsarrayYesAdditional parameters to pass to onResume.
persistbooleanYesWill the counter be automatically destroyed on completion, or retained for future playback?
interpolationstring | functionYesThe interpolation function to use if the value given is an array of numbers.

Type: object

Member of: Phaser.Types.Tweens

Source: src/tweens/typedefs/NumberTweenBuilderConfig.js#L1
Since: 3.18.0


StaggerConfig

<static> StaggerConfig

nametypeoptionaldefaultdescription
startnumberYes0The value to start the stagger from. Can be used as a way to offset the stagger while still using a range for the value.
easestring | functionYes"'Linear'"An ease to apply across the staggered values. Can either be a string, such as 'sine.inout', or a function.
fromstring | numberYes0The index to start the stagger from. Can be the strings first, last or center, or an integer representing the stagger position.
gridArray.<number>YesSet the stagger to run across a grid by providing an array where element 0 is the width of the grid and element 1 is the height. Combine with the 'from' property to control direction.

Type: object

Member of: Phaser.Types.Tweens

Source: src/tweens/typedefs/StaggerConfig.js#L1
Since: 3.19.0


TweenBuilderConfig

<static> TweenBuilderConfig

nametypeoptionaldefaultdescription
targetsanyNoThe object, or an array of objects, to run the tween on.
delaynumber | functionYes0The number of milliseconds to delay before the tween will start.
durationnumberYes1000The duration of the tween in milliseconds.
easestring | functionYes"'Power0'"The easing equation to use for the tween.
easeParamsarrayYesOptional easing parameters.
holdnumberYes0The number of milliseconds to hold the tween for before yoyo'ing.
repeatnumberYes0The number of times each property tween repeats.
repeatDelaynumberYes0The number of milliseconds to pause before a repeat.
yoyobooleanYesfalseShould 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.
flipXbooleanYesfalseHorizontally 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.
flipYbooleanYesfalseVertically 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.
completeDelaystring | numberfunctionobjectarray
loopstring | numberfunctionobjectarray
loopDelaystring | numberfunctionobjectarray
pausedbooleanYesfalseDoes the tween start in a paused state (true) or playing (false)?
propsObject.<string, (number, string, Phaser.Types.Tweens.GetEndCallback, Phaser.Types.Tweens.TweenPropConfig)>YesThe properties to tween.
callbackScopeanyYesThe scope (or context) for all of the callbacks. The default scope is the tween.
onCompletePhaser.Types.Tweens.TweenOnCompleteCallbackYesA function to call when the tween completes.
onCompleteParamsarrayYesAdditional parameters to pass to onComplete.
onLoopPhaser.Types.Tweens.TweenOnLoopCallbackYesA function to call each time the tween loops.
onLoopParamsarrayYesAdditional parameters to pass to onLoop.
onRepeatPhaser.Types.Tweens.TweenOnRepeatCallbackYesA function to call each time a property tween repeats. Called once per property per target.
onRepeatParamsarrayYesAdditional parameters to pass to onRepeat.
onStartPhaser.Types.Tweens.TweenOnStartCallbackYesA function to call when the tween starts playback, after any delays have expired.
onStartParamsarrayYesAdditional parameters to pass to onStart.
onStopPhaser.Types.Tweens.TweenOnStopCallbackYesA function to call when the tween is stopped.
onStopParamsarrayYesAdditional parameters to pass to onStop.
onUpdatePhaser.Types.Tweens.TweenOnUpdateCallbackYesA function to call each time the tween steps. Called once per property per target.
onUpdateParamsarrayYesAdditional parameters to pass to onUpdate.
onYoyoPhaser.Types.Tweens.TweenOnYoyoCallbackYesA function to call each time a property tween yoyos. Called once per property per target.
onYoyoParamsarrayYesAdditional parameters to pass to onYoyo.
onActivePhaser.Types.Tweens.TweenOnActiveCallbackYesA function to call when the tween becomes active within the Tween Manager.
onActiveParamsarrayYesAdditional parameters to pass to onActive.
onPausePhaser.Types.Tweens.TweenOnPauseCallbackYesA function to call when the tween is paused.
onPauseParamsarrayYesAdditional parameters to pass to onPause.
onResumePhaser.Types.Tweens.TweenOnResumeCallbackYesA function to call when the tween is resumed after being paused.
onResumeParamsarrayYesAdditional parameters to pass to onResume.
persistbooleanYesWill the Tween be automatically destroyed on completion, or retained for future playback?
interpolationstring | functionYesThe interpolation function to use if the value given is an array of numbers.

Type: object

Member of: Phaser.Types.Tweens

Source: src/tweens/typedefs/TweenBuilderConfig.js#L1
Since: 3.18.0


TweenCallbackTypes

<static> TweenCallbackTypes

Type: 'onActive' | 'onComplete' | 'onLoop' | 'onPause' | 'onRepeat' | 'onResume' | 'onStart' | 'onStop' | 'onUpdate' | 'onYoyo'

Member of: Phaser.Types.Tweens

Source: src/tweens/typedefs/TweenCallbackTypes.js#L1
Since: 3.60.0


TweenCallbacks

<static> TweenCallbacks

nametypeoptionaldescription
onActivePhaser.Types.Tweens.TweenOnActiveCallbackYesA function to call when the tween becomes active within the Tween Manager.
onStartPhaser.Types.Tweens.TweenOnStartCallbackYesA function to call when the tween starts playback, after any delays have expired.
onCompletePhaser.Types.Tweens.TweenOnCompleteCallbackYesA function to call when the tween completes.
onLoopPhaser.Types.Tweens.TweenOnLoopCallbackYesA function to call each time the tween loops.
onPausePhaser.Types.Tweens.TweenOnPauseCallbackYesA function to call each time the tween is paused.
onResumePhaser.Types.Tweens.TweenOnResumeCallbackYesA function to call each time the tween is resumed.
onRepeatPhaser.Types.Tweens.TweenOnRepeatCallbackYesA function to call each time the tween repeats. Called once per property per target.
onStopPhaser.Types.Tweens.TweenOnStopCallbackYesA function to call when the tween is stopped.
onUpdatePhaser.Types.Tweens.TweenOnUpdateCallbackYesA function to call each time the tween steps. Called once per property per target.
onYoyoPhaser.Types.Tweens.TweenOnYoyoCallbackYesA function to call each time the tween yoyos. Called once per property per target.

Type: object

Member of: Phaser.Types.Tweens

Source: src/tweens/typedefs/TweenCallbacks.js#L1
Since: 3.60.0


TweenChainBuilderConfig

<static> TweenChainBuilderConfig

nametypeoptionaldefaultdescription
targetsanyNoThe object, or an array of objects, to run each tween on.
delaynumber | functionYes0The number of milliseconds to delay before the chain will start.
completeDelaystring | numberfunctionobjectarray
loopstring | numberfunctionobjectarray
loopDelaystring | numberfunctionobjectarray
pausedbooleanYesfalseDoes the chain start in a paused state (true) or playing (false)?
tweensArray.<Phaser.Types.Tweens.TweenBuilderConfig>YesThe tweens to chain together.
callbackScopeanyYesThe scope (or context) for all of the callbacks. The default scope is the chain.
onCompletePhaser.Types.Tweens.TweenOnCompleteCallbackYesA function to call when the chain completes.
onCompleteParamsarrayYesAdditional parameters to pass to onComplete.
onLoopPhaser.Types.Tweens.TweenOnLoopCallbackYesA function to call each time the chain loops.
onLoopParamsarrayYesAdditional parameters to pass to onLoop.
onStartPhaser.Types.Tweens.TweenOnStartCallbackYesA function to call when the chain starts playback, after any delays have expired.
onStartParamsarrayYesAdditional parameters to pass to onStart.
onStopPhaser.Types.Tweens.TweenOnStopCallbackYesA function to call when the chain is stopped.
onStopParamsarrayYesAdditional parameters to pass to onStop.
onActivePhaser.Types.Tweens.TweenOnActiveCallbackYesA function to call when the chain becomes active within the Tween Manager.
onActiveParamsarrayYesAdditional parameters to pass to onActive.
onPausePhaser.Types.Tweens.TweenOnPauseCallbackYesA function to call when the chain is paused.
onPauseParamsarrayYesAdditional parameters to pass to onPause.
onResumePhaser.Types.Tweens.TweenOnResumeCallbackYesA function to call when the chain is resumed after being paused.
onResumeParamsarrayYesAdditional parameters to pass to onResume.
persistbooleanYesWill the Tween be automatically destroyed on completion, or retained for future playback?

Type: object

Member of: Phaser.Types.Tweens

Source: src/tweens/typedefs/TweenChainBuilderConfig.js#L1
Since: 3.60.0


TweenDataConfig

<static> TweenDataConfig

nametypeoptionaldefaultdescription
targetanyNoThe target to tween.
indexnumberNoThe target index within the Tween targets array.
keystringNoThe property of the target being tweened.
getActiveValuePhaser.Types.Tweens.GetActiveCallbackNoIf not null, is invoked immediately as soon as the TweenData is running, and is set on the target property.
getEndValuePhaser.Types.Tweens.GetEndCallbackNoThe returned value sets what the property will be at the END of the Tween.
getStartValuePhaser.Types.Tweens.GetStartCallbackNoThe returned value sets what the property will be at the START of the Tween.
easefunctionNoThe ease function this tween uses.
durationnumberYes0Duration of the tween in milliseconds, excludes time for yoyo or repeats.
totalDurationnumberYes0The total calculated duration of this TweenData (based on duration, repeat, delay and yoyo)
delaynumberYes0Time in milliseconds before tween will start.
yoyobooleanYesfalseCause the tween to return back to its start value after hold has expired.
holdnumberYes0Time in milliseconds the tween will pause before running the yoyo or starting a repeat.
repeatnumberYes0Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice.
repeatDelaynumberYes0Time in milliseconds before the repeat will start.
flipXbooleanYesfalseAutomatically call toggleFlipX when the TweenData yoyos or repeats
flipYbooleanYesfalseAutomatically call toggleFlipY when the TweenData yoyos or repeats
progressnumberYes0Between 0 and 1 showing completion of this TweenData.
elapsednumberYes0Delta counter
repeatCounternumberYes0How many repeats are left to run?
startnumberYes0The property value at the start of the ease.
currentnumberYes0The current propety value.
previousnumberYes0The previous property value.
endnumberYes0The property value at the end of the ease.
genPhaser.Types.Tweens.TweenDataGenConfigYesLoadValue generation functions.
statePhaser.Tweens.StateTypeYes0TWEEN_CONST.CREATED

Type: object

Member of: Phaser.Types.Tweens

Source: src/tweens/typedefs/TweenDataConfig.js#L1
Since: 3.0.0


TweenDataGenConfig

<static> TweenDataGenConfig

nametypeoptionaldescription
delayfunctionNoTime in milliseconds before tween will start.
durationfunctionNoDuration of the tween in milliseconds, excludes time for yoyo or repeats.
holdfunctionNoTime in milliseconds the tween will pause before running the yoyo or starting a repeat.
repeatfunctionNoNumber of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice.
repeatDelayfunctionNoTime in milliseconds before the repeat will start.

Type: object

Member of: Phaser.Types.Tweens

Source: src/tweens/typedefs/TweenDataGenConfig.js#L1
Since: 3.0.0


TweenFrameDataConfig

<static> TweenFrameDataConfig

nametypeoptionaldefaultdescription
targetanyNoThe target to tween.
indexnumberNoThe target index within the Tween targets array.
keystringNoThe property of the target being tweened.
durationnumberYes0Duration of the tween in milliseconds, excludes time for yoyo or repeats.
totalDurationnumberYes0The total calculated duration of this TweenData (based on duration, repeat, delay and yoyo)
delaynumberYes0Time in milliseconds before tween will start.
holdnumberYes0Time in milliseconds the tween will pause before running the yoyo or starting a repeat.
repeatnumberYes0Number of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice.
repeatDelaynumberYes0Time in milliseconds before the repeat will start.
flipXbooleanYesfalseAutomatically call toggleFlipX when the TweenData yoyos or repeats
flipYbooleanYesfalseAutomatically call toggleFlipY when the TweenData yoyos or repeats
progressnumberYes0Between 0 and 1 showing completion of this TweenData.
elapsednumberYes0Delta counter
repeatCounternumberYes0How many repeats are left to run?
genPhaser.Types.Tweens.TweenDataGenConfigYesLoadValue generation functions.
statePhaser.Tweens.StateTypeYes0TWEEN_CONST.CREATED

Type: object

Member of: Phaser.Types.Tweens

Source: src/tweens/typedefs/TweenFrameDataConfig.js#L1
Since: 3.60.0


TweenOnActiveCallback

<static> TweenOnActiveCallback

Type: function

Member of: Phaser.Types.Tweens

Source: src/tweens/typedefs/TweenOnActiveCallback.js#L1
Since: 3.19.0


TweenOnCompleteCallback

<static> TweenOnCompleteCallback

Type: function

Member of: Phaser.Types.Tweens

Source: src/tweens/typedefs/TweenOnCompleteCallback.js#L1
Since: 3.18.0


TweenOnLoopCallback

<static> TweenOnLoopCallback

Type: function

Member of: Phaser.Types.Tweens

Source: src/tweens/typedefs/TweenOnLoopCallback.js#L1
Since: 3.18.0


TweenOnPauseCallback

<static> TweenOnPauseCallback

Type: function

Member of: Phaser.Types.Tweens

Source: src/tweens/typedefs/TweenOnPauseCallback.js#L1
Since: 3.60.0


TweenOnRepeatCallback

<static> TweenOnRepeatCallback

Type: function

Member of: Phaser.Types.Tweens

Source: src/tweens/typedefs/TweenOnRepeatCallback.js#L1
Since: 3.18.0


TweenOnResumeCallback

<static> TweenOnResumeCallback

Type: function

Member of: Phaser.Types.Tweens

Source: src/tweens/typedefs/TweenOnResumeCallback.js#L1
Since: 3.60.0


TweenOnStartCallback

<static> TweenOnStartCallback

Type: function

Member of: Phaser.Types.Tweens

Source: src/tweens/typedefs/TweenOnStartCallback.js#L1
Since: 3.18.0


TweenOnStopCallback

<static> TweenOnStopCallback

Type: function

Member of: Phaser.Types.Tweens

Source: src/tweens/typedefs/TweenOnStopCallback.js#L1
Since: 3.24.0


TweenOnUpdateCallback

<static> TweenOnUpdateCallback

Type: function

Member of: Phaser.Types.Tweens

Source: src/tweens/typedefs/TweenOnUpdateCallback.js#L1
Since: 3.18.0


TweenOnYoyoCallback

<static> TweenOnYoyoCallback

Type: function

Member of: Phaser.Types.Tweens

Source: src/tweens/typedefs/TweenOnYoyoCallback.js#L1
Since: 3.18.0


TweenPropConfig

<static> TweenPropConfig

nametypeoptionaldescription
valuenumber | Array.<number>stringPhaser.Types.Tweens.GetEndCallback
getActivePhaser.Types.Tweens.GetActiveCallbackYesWhat the property will be set to immediately when this tween becomes active.
getEndPhaser.Types.Tweens.GetEndCallbackYesWhat the property will be at the END of the Tween.
getStartPhaser.Types.Tweens.GetStartCallbackYesWhat the property will be at the START of the Tween.
easestring | functionYesThe ease function this tween uses.
delaynumberYesTime in milliseconds before tween will start.
durationnumberYesDuration of the tween in milliseconds.
yoyobooleanYesDetermines whether the tween should return back to its start value after hold has expired.
holdnumberYesTime in milliseconds the tween will pause before repeating or returning to its starting value if yoyo is set to true.
repeatnumberYesNumber of times to repeat the tween. The tween will always run once regardless, so a repeat value of '1' will play the tween twice.
repeatDelaynumberYesTime in milliseconds before the repeat will start.
flipXbooleanYesShould toggleFlipX be called when yoyo or repeat happens?
flipYbooleanYesShould toggleFlipY be called when yoyo or repeat happens?
interpolationstring | functionYesThe interpolation function to use if the value given is an array of numbers.

Type: object

Member of: Phaser.Types.Tweens

Source: src/tweens/typedefs/TweenPropConfig.js#L1
Since: 3.18.0