Class: Parser

.Animation. Parser

new Parser()

Responsible for parsing sprite sheet and JSON data into the internal FrameData format that Phaser uses for animations.

Source:

Methods

<static> JSONData(game, json, cacheKey) → {Phaser.Animation.FrameData}

Parse the JSON data and extract the animation frame data from it.

Parameters:
Name Type Description
game Phaser.Game

A reference to the currently running game.

json Object

The JSON data from the Texture Atlas. Must be in Array format.

cacheKey string

The Game.Cache asset key of the texture image.

Source:
Returns:

A FrameData object containing the parsed frames.

Type
Phaser.Animation.FrameData

<static> JSONDataHash(game, json, cacheKey) → {Phaser.Animation.FrameData}

Parse the JSON data and extract the animation frame data from it.

Parameters:
Name Type Description
game Phaser.Game

A reference to the currently running game.

json Object

The JSON data from the Texture Atlas. Must be in JSON Hash format.

cacheKey string

The Game.Cache asset key of the texture image.

Source:
Returns:

A FrameData object containing the parsed frames.

Type
Phaser.Animation.FrameData

<static> spriteSheet(game, key, frameWidth, frameHeight, frameMax) → {Phaser.Animation.FrameData}

Parse a Sprite Sheet and extract the animation frame data from it.

Parameters:
Name Type Argument Default Description
game Phaser.Game

A reference to the currently running game.

key string

The Game.Cache asset key of the Sprite Sheet image.

frameWidth number

The fixed width of each frame of the animation.

frameHeight number

The fixed height of each frame of the animation.

frameMax number <optional>
-1

The total number of animation frames to extact from the Sprite Sheet. The default value of -1 means "extract all frames".

Source:
Returns:

A FrameData object containing the parsed frames.

Type
Phaser.Animation.FrameData

<static> XMLData(game, xml, cacheKey) → {Phaser.Animation.FrameData}

Parse the XML data and extract the animation frame data from it.

Parameters:
Name Type Description
game Phaser.Game

A reference to the currently running game.

xml Object

The XML data from the Texture Atlas. Must be in Starling XML format.

cacheKey string

The Game.Cache asset key of the texture image.

Source:
Returns:

A FrameData object containing the parsed frames.

Type
Phaser.Animation.FrameData
Phaser Copyright © 2012-2013 Photon Storm Ltd.
Documentation generated by JSDoc 3.2.0-dev on Wed Oct 02 2013 01:12:17 GMT+0100 (BST) using the DocStrap template.