Tween#loop()

loop(value) โ†’ {Phaser.Tween}

Enables the looping of this tween. The tween will loop forever, and onComplete will never fire.

If value is true then this is the same as setting Tween.repeatAll(-1).
If value is false it is the same as setting Tween.repeatAll(0) and will reset the repeatCounter to zero.

Usage:
game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Linear.None, true)
.to({ y: 300 }, 1000, Phaser.Easing.Linear.None)
.to({ x: 0 }, 1000, Phaser.Easing.Linear.None)
.to({ y: 0 }, 1000, Phaser.Easing.Linear.None)
.loop();

Parameters
Name Type Argument Default Description
value boolean <optional>
true

If true this tween will loop once it reaches the end. Set to false to remove an active loop.

Returns

This tween. Useful for method chaining.

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

Please login to continue.