TweenData#to()

to(properties, duration, ease, delay, repeat, yoyo) → {Phaser.TweenData}

Sets this tween to be a to tween on the properties given. A to tween starts at the current value and tweens to the destination value given.
For example a Sprite with an x coordinate of 100 could be tweened to x 200 by giving a properties object of { x: 200 }.

Parameters
Name Type Argument Default Description
properties object

The properties you want to tween, such as Sprite.x or Sound.volume. Given as a JavaScript object.

duration number <optional>
1000

Duration of this tween in ms.

ease function <optional>
null

Easing function. If not set it will default to Phaser.Easing.Default, which is Phaser.Easing.Linear.None by default but can be over-ridden at will.

delay number <optional>
0

Delay before this tween will start, defaults to 0 (no delay). Value given is in ms.

repeat number <optional>
0

Should the tween automatically restart once complete? If you want it to run forever set as -1. This ignores any chained tweens.

yoyo boolean <optional>
false

A tween that yoyos will reverse itself and play backwards automatically. A yoyo'd tween doesn't fire the Tween.onComplete event, so listen for Tween.onLoop instead.

Returns

This Tween object.

Source code: tween/TweenData.js (Line 183)
doc_phaser
2017-02-14 11:18:53
Comments
Leave a Comment

Please login to continue.