new TweenManager(game)
Phaser.Game has a single instance of the TweenManager through which all Tween objects are created and updated. Tweens are hooked into the game clock and pause system, adjusting based on the game state.
TweenManager is based heavily on tween.js by http://soledadpenades.com. The difference being that tweens belong to a games instance of TweenManager, rather than to a global TWEEN object. It also has callbacks swapped for Signals and a few issues patched with regard to properties and completion errors. Please see https://github.com/sole/tween.js for a full list of contributors.
相位。游戏有一个单一的实例,通过它的所有tweenmanager吐温对象被创建和更新。吐温被钩进游戏时间和暂停系统,基于游戏状态的调整。
tweenmanager主要是基于tween.js通过http://soledadpenades.com。所不同的是,吐温属于游戏tweenmanager实例,而不是一个全球性的吐温对象。它也有回调换信号和一些问题的修补方面性能和完成错误。请参阅完整的名单https://github.com/sole/tween.js。
Parameters:
Name | Type | Description |
---|---|---|
game |
Phaser.Game | A reference to the currently running game. |
- Source - tween/TweenManager.js, line 20
Members
-
frameBased :boolean
-
Are all newly created Tweens frame or time based? A frame based tween will use the physics elapsed timer when updating. This means it will retain the same consistent frame rate, regardless of the speed of the device. The duration value given should be given in frames.
在所有新创建的补间帧或基于时间的?基于帧的吐温将使用物理流逝定时器更新时。这意味着它将保持相同的帧速率,而不管设备的速度如何。给出的持续时间值应在帧中给出。
If the Tween uses a time based update (which is the default) then the duration is given in milliseconds. In this situation a 2000ms tween will last exactly 2 seconds, regardless of the device and how many visual updates the tween has actually been through. For very short tweens you may wish to experiment with a frame based update instead.
如果会话使用基于时间的更新(默认情况下),则持续时间以毫秒为单位。在这种情况下,2000ms吐温将持续整整2秒,无论设备和吐温实际上已经通过多少视觉更新。很短的吐温你不妨尝试一种基于框架的更新替代。
- Source - tween/TweenManager.js, line 38
-
game :Phaser.Game
-
Local reference to game.
- Source - tween/TweenManager.js, line 25
Methods
-
add(tween) → {Phaser.Tween}
-
Add a new tween into the TweenManager.
Parameters:
Name Type Description tween
Phaser.Tween The tween object you want to add.
Returns:
The tween object you added to the manager.
- Source - tween/TweenManager.js, line 189
-
create(object) → {Phaser.Tween}
-
Create a tween object for a specific object. The object can be any JavaScript object or Phaser object such as Sprite.
Parameters:
Name Type Description object
object Object the tween will be run on.
Returns:
The newly created tween object.
- Source - tween/TweenManager.js, line 203
-
getAll() → {Array.<Phaser.Tween>}
-
Get all the tween objects in an array.
Returns:
Array.<Phaser.Tween> -Array with all tween objects.
- Source - tween/TweenManager.js, line 114
-
isTweening(object) → {boolean}
-
Checks to see if a particular Sprite is currently being tweened.
Parameters:
Name Type Description object
object The object to check for tweens against.
Returns:
boolean -Returns true if the object is currently being tweened, false if not.
- Source - tween/TweenManager.js, line 285
-
pauseAll()
-
Pauses all currently running tweens.
- Source - tween/TweenManager.js, line 330
-
remove(tween)
-
Remove a tween from this manager.
Parameters:
Name Type Description tween
Phaser.Tween The tween object you want to remove.
- Source - tween/TweenManager.js, line 216
-
removeAll()
-
Remove all tweens running and in the queue. Doesn't call any of the tween onComplete events.
- Source - tween/TweenManager.js, line 125
-
removeFrom(obj, children)
-
Remove all tweens from a specific object, array of objects or Group.
Parameters:
Name Type Argument Default Description obj
object | Array.<object> | Phaser.Group The object you want to remove the tweens from.
children
boolean <optional>
true If passing a group, setting this to true will remove the tweens from all of its children instead of the group itself.
- Source - tween/TweenManager.js, line 140
-
resumeAll()
-
Resumes all currently paused tweens.
- Source - tween/TweenManager.js, line 344
-
update() → {boolean}
-
Update all the tween objects you added to this manager.
Returns:
boolean -Return false if there's no tween to update, otherwise return true.
- Source - tween/TweenManager.js, line 242