Tween#yoyo()

yoyo(enable, yoyoDelay, index) → {Phaser.Tween}

A Tween that has yoyo set to true will run through from its starting values to its end values and then play back in reverse from end to start.
Used in combination with repeat you can create endless loops.
If you have not yet called Tween.to or Tween.from at least once then this method will do nothing, as there are no tweens to yoyo.
If you have child tweens and pass -1 as the index value it sets the yoyo property across all of them.
If you wish to yoyo this Tween and all of its children then see Tween.yoyoAll.

Parameters
Name Type Argument Default Description
enable boolean

Set to true to yoyo this tween, or false to disable an already active yoyo.

yoyoDelay number <optional>
0

This is the amount of time to pause (in ms) before the yoyo will start.

index number <optional>
0

If this tween has more than one child this allows you to target a specific child. If set to -1 it will set yoyo on all the children.

Returns

This tween. Useful for method chaining.

Source code: tween/Tween.js (Line 464)
doc_phaser
2017-02-14 11:18:45
Comments
Leave a Comment

Please login to continue.