the object whose properties will be tweened
whether the tween should persist across state changes (not auto-stopped on game reset)
whether the tween should keep running when the game is paused
StaticEasingAvailable easing functions, accessed via Tween.Easing.
Each family provides In, Out, and InOut variants.
Easing for the full list
StaticInterpolationAvailable interpolation functions for tweening array values.
Smooth Bezier curve interpolation through all array values.
Smooth Catmull-Rom spline interpolation — best for path-following tweens.
Piecewise linear interpolation between consecutive array values.
delay the tween
delay amount expressed in milliseconds
this instance for object chaining
set the easing function
easing function
this instance for object chaining
set the interpolation function
interpolation function
this instance for object chaining
onComplete callback
callback
this instance for object chaining
onStart callback
callback
this instance for object chaining
onUpdate callback
callback
this instance for object chaining
Repeat the tween
amount of times the tween should be repeated
this instance for object chaining
Start the tween. Subscribes to game loop events and begins interpolation.
Optionaltime: number = ...the start time (defaults to current game time)
this instance for object chaining
Stop the tween. Unsubscribes from all game loop events.
this instance for object chaining
Define the target property values and tween options.
target property values to tween to (e.g. { x: 200, y: 100 })
Optionaloptions: {tween configuration
OptionalautoStart?: booleanstart the tween immediately without calling start()
Optionaldelay?: numberdelay before starting, in milliseconds
Optionalduration?: numbertween duration in milliseconds
Optionaleasing?: EasingFunctioneasing function (e.g. Tween.Easing.Quadratic.InOut)
Optionalinterpolation?: InterpolationFunctioninterpolation function for array values
Optionalrepeat?: numbernumber of times to repeat (use Infinity for endless loops)
Optionalyoyo?: booleanbounce back to original values when finished (use with repeat)
this instance for object chaining
Allows the tween to bounce back to their original value when finished. To be used together with repeat to create endless loops.
flag
this instance for object chaining
A tweening engine for smoothly interpolating object properties over time. Based on tween.js with optimised Robert Penner's equations.
Tweens use an event-based lifecycle — on
start()the tween subscribes to the game loop events (TICK,GAME_AFTER_UPDATE,STATE_PAUSE,STATE_RESUME,GAME_RESET) and automatically unsubscribes on completion orstop(). They do not need to be added to a container.Example
Example