Phaser API Documentation

  Version: 
Event: TWEEN_YOYO
Phaser.Tweens.Events.TWEEN_YOYO
TWEEN_YOYO

Description:

The Tween Yoyo Event.

This event is dispatched by a Tween whenever a property it is tweening yoyos.

This event will only be dispatched if the Tween has a property with yoyo set.

If the Tween has a hold value, this event is dispatched when the hold expires.

This event is dispatched for every property, and for every target, that yoyos. For example, if a Tween was updating 2 properties and had 10 targets, this event would be dispatched 20 times (twice per target). So be careful how you use it!

Listen to it from a Tween instance using Tween.on('yoyo', listener), i.e.:

var tween = this.tweens.add({
    targets: image,
    x: 500,
    ease: 'Power1',
    duration: 3000,
    yoyo: true
});
tween.on('yoyo', listener);

Parameters:

name type description
tween Phaser.Tweens.Tween

A reference to the Tween instance that emitted the event.

key string

The property on the target that has just yoyo'd, i.e. x or scaleY, or whatever property you are tweening.

target any

The target object that was yoyo'd. Usually a Game Object, but can be of any type.

current number

The current value of the property being set on the target.

previous number

The previous value of the property being set on the target.

Since: 3.19.0