Class: TweenManager

Phaser. TweenManager

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.

Parameters:
Name Type Description
game Phaser.Game

A reference to the currently running game.

Source:
src/tween/TweenManager.js line 20

Members

game : Phaser.Game

Local reference to game.

Type:
Source:
src/tween/TweenManager.js line 25

Methods

add(tween)

Add a new tween into the TweenManager.

Parameters:
Name Type Description
tween Phaser.Tween

The tween object you want to add.

Source:
src/tween/TweenManager.js line 172
Returns:

The tween object you added to the manager.

Type
Phaser.Tween

create(object)

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.

Source:
src/tween/TweenManager.js line 185
Returns:

The newly created tween object.

Type
Phaser.Tween

destroy()

Removes all tweens and deletes queues.

Source:
src/tween/TweenManager.js line 338

getAll()

Get all the tween objects in an array.

Source:
src/tween/TweenManager.js line 100
Returns:

Array with all tween objects.

Type
Array.<Phaser.Tween>

isTweening(object [, checkIsRunning])

Checks to see if a particular Sprite is currently being tweened.

The checkIsRunning parameter will exclude tweens that have just completed or been stopped but haven't yet been removed from the manager.

Parameters:
Name Type Argument Default Description
object object

The object to check for tweens against.

checkIsRunning boolean <optional>
false

Also check that the tween is running and is not marked for deletion.

Source:
src/tween/TweenManager.js line 264
Returns:

Returns true if the object is currently being tweened, false if not.

Type
boolean

pauseAll()

Pauses all currently running tweens.

Source:
src/tween/TweenManager.js line 312

remove(tween)

Remove a tween from this manager.

Parameters:
Name Type Description
tween Phaser.Tween

The tween object you want to remove.

Source:
src/tween/TweenManager.js line 197

removeAll()

Remove all tweens running and in the queue. Doesn't call any of the tween onComplete events.

Source:
src/tween/TweenManager.js line 110

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:
src/tween/TweenManager.js line 124

resumeAll()

Resumes all currently paused tweens.

Source:
src/tween/TweenManager.js line 325

update()

Update all the tween objects you added to this manager.

Source:
src/tween/TweenManager.js line 222
Returns:

Return false if there's no tween to update, otherwise return true.

Type
boolean

phaser-ce@2.20.1 is on GitHub and NPM

Documentation generated by JSDoc 3.6.11 on 2024-10-05 using Tomorrow.