Class: AnimationParser

Phaser. AnimationParser

new AnimationParser()

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

Source:
src/animation/AnimationParser.js line 13

Methods

<static> JSONData(game, json)

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.

Source:
src/animation/AnimationParser.js line 181
Returns:

A FrameData object containing the parsed frames.

Type
Phaser.FrameData

<static> JSONDataHash(game, json)

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.

Source:
src/animation/AnimationParser.js line 296
Returns:

A FrameData object containing the parsed frames.

Type
Phaser.FrameData

<static> JSONDataPyxel(game, json)

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 Pyxel JSON format.

Source:
src/animation/AnimationParser.js line 239
Returns:

A FrameData object containing the parsed frames.

Type
Phaser.FrameData

<static> spriteSheet(game, key, frameWidth, frameHeight [, frameMax] [, margin] [, spacing] [, skipFrames])

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 | Image

The Game.Cache asset key of the Sprite Sheet image or an actual HTML Image element.

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 extract from the Sprite Sheet. The default value of -1 means "extract all frames".

margin number <optional>
0

If the frames have been drawn with a margin, specify the amount here.

spacing number <optional>
0

If the frames have been drawn with spacing between them, specify the amount here.

skipFrames number <optional>
0

Skip a number of frames. Useful when there are multiple sprite sheets in one image.

Source:
src/animation/AnimationParser.js line 15
See:
Returns:

A FrameData object containing the parsed frames.

Type
Phaser.FrameData

<static> XMLData(game, xml)

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.

Source:
src/animation/AnimationParser.js line 357
Returns:

A FrameData object containing the parsed frames.

Type
Phaser.FrameData

phaser-ce@2.20.0 is on GitHub and NPM

Documentation generated by JSDoc 3.6.7 on 2022-12-10 using Tomorrow.