Class: FrameData

Phaser. FrameData

new FrameData()

FrameData is a container for Frame objects, which are the internal representation of animation data in Phaser.

Source:
src/animation/FrameData.js line 13

Members

<readonly> total : number

The total number of frames in this FrameData set.

Type:
  • number
Source:
src/animation/FrameData.js line 255

Methods

addFrame(frame)

Adds a new Frame to this FrameData collection. Typically called by the Animation.Parser and not directly.

Parameters:
Name Type Description
frame Phaser.Frame

The frame to add to this FrameData set.

Source:
src/animation/FrameData.js line 30
Returns:

The frame that was just added.

Type
Phaser.Frame

checkFrameName(name)

Check if there is a Frame with the given name.

Parameters:
Name Type Description
name string

The name of the frame you want to check.

Source:
src/animation/FrameData.js line 85
Returns:

True if the frame is found, otherwise false.

Type
boolean

clone()

Makes a copy of this FrameData including copies (not references) to all of the Frames it contains.

Source:
src/animation/FrameData.js line 102
Returns:

A clone of this object, including clones of the Frame objects it contains.

Type
Phaser.FrameData

destroy()

Destroys this FrameData collection by nulling the _frames and _frameNames arrays.

Source:
src/animation/FrameData.js line 240

getFrame(index)

Get a Frame by its numerical index.

Parameters:
Name Type Description
index number

The index of the frame you want to get.

Source:
src/animation/FrameData.js line 51
Returns:

The frame, if found, or undefined.

Type
Phaser.Frame

getFrameByName(name)

Get a Frame by its frame name.

Parameters:
Name Type Description
name string

The name of the frame you want to get.

Source:
src/animation/FrameData.js line 68
Returns:

The frame, if found, or null.

Type
Phaser.Frame

getFrameIndexes( [frames] [, useNumericIndex] [, output])

Returns all of the Frame indexes in this FrameData set. The frames indexes are returned in the output array, or if none is provided in a new Array object.

Parameters:
Name Type Argument Default Description
frames Array <optional>

An Array containing the indexes of the frames to retrieve. If undefined or the array is empty then all frames in the FrameData are returned.

useNumericIndex boolean <optional>
true

Are the given frames using numeric indexes (default) or strings? (false)

output Array <optional>

If given the results will be appended to the end of this array otherwise a new array will be created.

Source:
src/animation/FrameData.js line 196
Returns:

An array of all Frame indexes matching the given names or IDs.

Type
Array

getFrameRange(start, end [, output])

Returns a range of frames based on the given start and end frame indexes and returns them in an Array.

Parameters:
Name Type Argument Description
start number

The starting frame index.

end number

The ending frame index.

output Array <optional>

If given the results will be appended to the end of this array otherwise a new array will be created.

Source:
src/animation/FrameData.js line 129
Returns:

An array of Frames between the start and end index values, or an empty array if none were found.

Type
Array

getFrames( [frames] [, useNumericIndex] [, output])

Returns all of the Frames in this FrameData set where the frame index is found in the input array. The frames are returned in the output array, or if none is provided in a new Array object.

Parameters:
Name Type Argument Default Description
frames Array <optional>

An Array containing the indexes of the frames to retrieve. If the array is empty or undefined then all frames in the FrameData are returned.

useNumericIndex boolean <optional>
true

Are the given frames using numeric indexes (default) or strings? (false)

output Array <optional>

If given the results will be appended to the end of this array otherwise a new array will be created.

Source:
src/animation/FrameData.js line 150
Returns:

An array of all Frames in this FrameData set matching the given names or IDs.

Type
Array

phaser-ce@2.20.1 is on GitHub and NPM

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