Tween#from()

from(properties, duration, ease, autoStart, delay, repeat, yoyo) → {Phaser.Tween}

Sets this tween to be a from tween on the properties given. A from tween sets the target to the destination value and tweens to its current value.
For example a Sprite with an x coordinate of 100 tweened from x 500 would be set to x 500 and then tweened to x 100 by giving a properties object of { x: 500 }.
The ease function allows you define the rate of change. You can pass either a function such as Phaser.Easing.Circular.Out or a string such as "Circ".
".easeIn", ".easeOut" and "easeInOut" variants are all supported for all ease types.

Parameters
Name Type Argument Default Description
properties object

An object containing 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. Or if Tween.frameBased is true this represents the number of frames that should elapse.

ease function | string <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.

autoStart boolean <optional>
false

Set to true to allow this tween to start automatically. Otherwise call Tween.start().

delay number <optional>
0

Delay before this tween will start in milliseconds. Defaults to 0, no delay.

repeat number <optional>
0

Should the tween automatically restart once complete? If you want it to run forever set as -1. This only effects this individual tween, not 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/Tween.js (Line 237)
doc_phaser
2017-02-14 11:18:32
Comments
Leave a Comment

Please login to continue.