+
+-
+
add(name, frames, frameRate, loop, useNumericIndex) → {Phaser.Animation}
+
+
+
+-
+
+
+
+ Adds a new animation under the given key. Optionally set the frames, frame rate and loop.
Animations added in this way are played back with the play function.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+ Argument |
+
+
+
+ Default |
+
+
+ Description |
+
+
+
+
+
+
+
+
+ name |
+
+
+
+
+
+string
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+ The unique (within this Sprite) name for the animation, i.e. "run", "fire", "walk". |
+
+
+
+
+
+
+ frames |
+
+
+
+
+
+Array
+
+
+
+ |
+
+
+
+
+ <optional>
+
+
+
+
+
+ |
+
+
+
+
+
+ null
+
+ |
+
+
+ An array of numbers/strings that correspond to the frames to add to this animation and in which order. e.g. [1, 2, 3] or ['run0', 'run1', run2]). If null then all frames will be used. |
+
+
+
+
+
+
+ frameRate |
+
+
+
+
+
+number
+
+
+
+ |
+
+
+
+
+ <optional>
+
+
+
+
+
+ |
+
+
+
+
+
+ 60
+
+ |
+
+
+ The speed at which the animation should play. The speed is given in frames per second. |
+
+
+
+
+
+
+ loop |
+
+
+
+
+
+boolean
+
+
+
+ |
+
+
+
+
+ <optional>
+
+
+
+
+
+ |
+
+
+
+
+
+ false
+
+ |
+
+
+ {boolean} - Whether or not the animation is looped or just plays once. |
+
+
+
+
+
+
+ useNumericIndex |
+
+
+
+
+
+boolean
+
+
+
+ |
+
+
+
+
+ <optional>
+
+
+
+
+
+ |
+
+
+
+
+
+ true
+
+ |
+
+
+ Are the given frames using numeric indexes (default) or strings? |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+ -
+ animation/AnimationManager.js, line 78
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+ The Animation object that was created.
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Phaser.Animation
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+
+
+
+-
+
+
+
+ Adds a new Frame to this FrameData collection. Typically called by the Animation.Parser and not directly.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ frame |
+
+
+
+
+
+Phaser.Animation.Frame
+
+
+
+ |
+
+
+
+
+
+ The frame to add to this FrameData set. |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+ -
+ animation/FrameData.js, line 33
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+ The frame that was just added.
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Phaser.Animation.Frame
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
checkFrameName(name) → {boolean}
+
+
+
+-
+
+
+
+ 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:
+ -
+ animation/FrameData.js, line 91
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+ True if the frame is found, otherwise false.
+
+
+
+
+
+ -
+ Type
+
+ -
+
+boolean
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
destroy()
+
+
+
+-
+
+
+
+ Cleans up this animation ready for deletion. Nulls all values and references.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+ -
+ animation/Animation.js, line 265
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
destroy()
+
+
+
+-
+
+
+
+ Destroys all references this AnimationManager contains. Sets the _anims to a new object and nulls the current animation.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+ -
+ animation/AnimationManager.js, line 243
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
generateFrameNames(prefix, min, max, suffix, zeroPad)
+
+
+
+-
+
+
+
+ Really handy function for when you are creating arrays of animation data but it's using frame names and not numbers.
For example imagine you've got 30 frames named: 'explosion_0001-large' to 'explosion_0030-large'
You could use this function to generate those by doing: Phaser.Animation.generateFrameNames('explosion_', 1, 30, '-large', 4);
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+ Argument |
+
+
+
+ Default |
+
+
+ Description |
+
+
+
+
+
+
+
+
+ prefix |
+
+
+
+
+
+string
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+ The start of the filename. If the filename was 'explosion_0001-large' the prefix would be 'explosion_'. |
+
+
+
+
+
+
+ min |
+
+
+
+
+
+number
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+ The number to start sequentially counting from. If your frames are named 'explosion_0001' to 'explosion_0034' the min is 1. |
+
+
+
+
+
+
+ max |
+
+
+
+
+
+number
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+ The number to count up to. If your frames are named 'explosion_0001' to 'explosion_0034' the max is 34. |
+
+
+
+
+
+
+ suffix |
+
+
+
+
+
+string
+
+
+
+ |
+
+
+
+
+ <optional>
+
+
+
+
+
+ |
+
+
+
+
+
+ ''
+
+ |
+
+
+ The end of the filename. If the filename was 'explosion_0001-large' the prefix would be '-large'. |
+
+
+
+
+
+
+ zeroPad |
+
+
+
+
+
+number
+
+
+
+ |
+
+
+
+
+ <optional>
+
+
+
+
+
+ |
+
+
+
+
+
+ 0
+
+ |
+
+
+ The number of zeroes to pad the min and max values with. If your frames are named 'explosion_0001' to 'explosion_0034' then the zeroPad is 4. |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+ -
+ animation/Animation.js, line 393
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+
+
+
+-
+
+
+
+ Get a Frame by its numerical index.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ index |
+
+
+
+
+
+number
+
+
+
+ |
+
+
+
+
+
+ The index of the frame you want to get. |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+ -
+ animation/FrameData.js, line 55
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+ The frame, if found.
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Phaser.Animation.Frame
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+
+
+
+-
+
+
+
+ Get a Frame by its frame name.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ name |
+
+
+
+
+
+string
+
+
+
+ |
+
+
+
+
+
+ The name of the frame you want to get. |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+ -
+ animation/FrameData.js, line 73
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+ The frame, if found.
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Phaser.Animation.Frame
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
getFrameIndexes(frames, useNumericIndex, output) → {Array}
+
+
+
+-
+
+
+
+ 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
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+ An Array containing the indexes of the frames to retrieve. If 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:
+ -
+ animation/FrameData.js, line 178
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+ An array of all Frame indexes matching the given names or IDs.
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Array
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
getFrameRange(start, end, output) → {Array}
+
+
+
+-
+
+
+
+ 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:
+ -
+ animation/FrameData.js, line 109
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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) → {Array}
+
+
+
+-
+
+
+
+ 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
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+ An Array containing the indexes of the frames to retrieve. If 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:
+ -
+ animation/FrameData.js, line 131
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+ An array of all Frames in this FrameData set matching the given names or IDs.
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Array
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+
+
+
+-
+
+
+
+ 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:
+ -
+ animation/Parser.js, line 96
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+ A FrameData object containing the parsed frames.
+
+
+
+
+
+ -
+ Type
+
+ -
+
+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:
+ -
+ animation/Parser.js, line 167
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+ A FrameData object containing the parsed frames.
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Phaser.Animation.FrameData
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
onComplete()
+
+
+
+-
+
+
+
+ Called internally when the animation finishes playback. Sets the isPlaying and isFinished states and dispatches the onAnimationComplete event if it exists on the parent.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+ -
+ animation/Animation.js, line 281
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
play(frameRate, loop) → {Phaser.Animation}
+
+
+
+-
+
+
+
+ Plays this animation.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+ Argument |
+
+
+
+ Default |
+
+
+ Description |
+
+
+
+
+
+
+
+
+ frameRate |
+
+
+
+
+
+number
+
+
+
+ |
+
+
+
+
+ <optional>
+
+
+
+
+
+ |
+
+
+
+
+
+ null
+
+ |
+
+
+ The framerate to play the animation at. The speed is given in frames per second. If not provided the previously set frameRate of the Animation is used. |
+
+
+
+
+
+
+ loop |
+
+
+
+
+
+boolean
+
+
+
+ |
+
+
+
+
+ <optional>
+
+
+
+
+
+ |
+
+
+
+
+
+ null
+
+ |
+
+
+ Should the animation be looped after playback. If not provided the previously set loop value of the Animation is used. |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+ -
+ animation/Animation.js, line 118
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+ - A reference to this Animation instance.
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Phaser.Animation
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
play(name, frameRate, loop) → {Phaser.Animation}
+
+
+
+-
+
+
+
+ Play an animation based on the given key. The animation should previously have been added via sprite.animations.add()
If the requested animation is already playing this request will be ignored. If you need to reset an already running animation do so directly on the Animation object itself.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+ Argument |
+
+
+
+ Default |
+
+
+ Description |
+
+
+
+
+
+
+
+
+ name |
+
+
+
+
+
+string
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+ The name of the animation to be played, e.g. "fire", "walk", "jump". |
+
+
+
+
+
+
+ frameRate |
+
+
+
+
+
+number
+
+
+
+ |
+
+
+
+
+ <optional>
+
+
+
+
+
+ |
+
+
+
+
+
+ null
+
+ |
+
+
+ The framerate to play the animation at. The speed is given in frames per second. If not provided the previously set frameRate of the Animation is used. |
+
+
+
+
+
+
+ loop |
+
+
+
+
+
+boolean
+
+
+
+ |
+
+
+
+
+ <optional>
+
+
+
+
+
+ |
+
+
+
+
+
+ null
+
+ |
+
+
+ Should the animation be looped after playback. If not provided the previously set loop value of the Animation is used. |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+ -
+ animation/AnimationManager.js, line 158
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+ A reference to playing Animation instance.
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Phaser.Animation
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
restart()
+
+
+
+-
+
+
+
+ Sets this animation back to the first frame and restarts the animation.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+ -
+ animation/Animation.js, line 160
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
setTrim(trimmed, actualWidth, actualHeight, destX, destY, destWidth, destHeight)
+
+
+
+-
+
+
+
+ If the frame was trimmed when added to the Texture Atlas this records the trim and source data.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+
+
+
+ Description |
+
+
+
+
+
+
+
+
+ trimmed |
+
+
+
+
+
+bool
+
+
+
+ |
+
+
+
+
+
+ If this frame was trimmed or not. |
+
+
+
+
+
+
+ actualWidth |
+
+
+
+
+
+number
+
+
+
+ |
+
+
+
+
+
+ The width of the frame before being trimmed. |
+
+
+
+
+
+
+ actualHeight |
+
+
+
+
+
+number
+
+
+
+ |
+
+
+
+
+
+ The height of the frame before being trimmed. |
+
+
+
+
+
+
+ destX |
+
+
+
+
+
+number
+
+
+
+ |
+
+
+
+
+
+ The destination X position of the trimmed frame for display. |
+
+
+
+
+
+
+ destY |
+
+
+
+
+
+number
+
+
+
+ |
+
+
+
+
+
+ The destination Y position of the trimmed frame for display. |
+
+
+
+
+
+
+ destWidth |
+
+
+
+
+
+number
+
+
+
+ |
+
+
+
+
+
+ The destination width of the trimmed frame for display. |
+
+
+
+
+
+
+ destHeight |
+
+
+
+
+
+number
+
+
+
+ |
+
+
+
+
+
+ The destination height of the trimmed frame for display. |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+ -
+ animation/Frame.js, line 129
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
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:
+ -
+ animation/Parser.js, line 15
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+ A FrameData object containing the parsed frames.
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Phaser.Animation.FrameData
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
stop(resetFrame)
+
+
+
+-
+
+
+
+ Stops playback of this animation and set it to a finished state. If a resetFrame is provided it will stop playback and set frame to the first in the animation.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+ Argument |
+
+
+
+ Default |
+
+
+ Description |
+
+
+
+
+
+
+
+
+ resetFrame |
+
+
+
+
+
+boolean
+
+
+
+ |
+
+
+
+
+ <optional>
+
+
+
+
+
+ |
+
+
+
+
+
+ false
+
+ |
+
+
+ If true after the animation stops the currentFrame value will be set to the first frame in this animation. |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+ -
+ animation/Animation.js, line 179
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
stop(name, resetFrame)
+
+
+
+-
+
+
+
+ Stop playback of an animation. If a name is given that specific animation is stopped, otherwise the current animation is stopped.
The currentAnim property of the AnimationManager is automatically set to the animation given.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+ Argument |
+
+
+
+ Default |
+
+
+ Description |
+
+
+
+
+
+
+
+
+ name |
+
+
+
+
+
+string
+
+
+
+ |
+
+
+
+
+ <optional>
+
+
+
+
+
+ |
+
+
+
+
+
+ null
+
+ |
+
+
+ The name of the animation to be stopped, e.g. "fire". If none is given the currently running animation is stopped. |
+
+
+
+
+
+
+ resetFrame |
+
+
+
+
+
+boolean
+
+
+
+ |
+
+
+
+
+ <optional>
+
+
+
+
+
+ |
+
+
+
+
+
+ false
+
+ |
+
+
+ When the animation is stopped should the currentFrame be set to the first frame of the animation (true) or paused on the last frame displayed (false) |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+ -
+ animation/AnimationManager.js, line 188
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
total() → {Number}
+
+
+
+-
+
+
+
+ Returns the total number of frames in this FrameData set.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+ -
+ animation/FrameData.js, line 226
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+ The total number of frames in this FrameData set.
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Number
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
update()
+
+
+
+-
+
+
+
+ Updates this animation. Called automatically by the AnimationManager.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+ -
+ animation/Animation.js, line 199
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
<protected> update() → {boolean}
+
+
+
+-
+
+
+
+ The main update function is called by the Sprites update loop. It's responsible for updating animation frames and firing related events.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+ -
+ animation/AnimationManager.js, line 218
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+ True if a new animation frame has been set, otherwise false.
+
+
+
+
+
+ -
+ Type
+
+ -
+
+boolean
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
validateFrames(frames, useNumericIndex) → {boolean}
+
+
+
+-
+
+
+
+ Check whether the frames in the given array are valid and exist.
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name |
+
+
+ Type |
+
+
+ Argument |
+
+
+
+ Default |
+
+
+ Description |
+
+
+
+
+
+
+
+
+ frames |
+
+
+
+
+
+Array
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+ An array of frames to be validated. |
+
+
+
+
+
+
+ useNumericIndex |
+
+
+
+
+
+boolean
+
+
+
+ |
+
+
+
+
+ <optional>
+
+
+
+
+
+ |
+
+
+
+
+
+ true
+
+ |
+
+
+ Validate the frames based on their numeric index (true) or string index (false) |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ - Source:
+ -
+ animation/AnimationManager.js, line 124
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+ True if all given Frames are valid, otherwise false.
+
+
+
+
+
+ -
+ Type
+
+ -
+
+boolean
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+
+
+
+-
+
+
+
+ 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:
+ -
+ animation/Parser.js, line 241
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+
+ A FrameData object containing the parsed frames.
+
+
+
+
+
+ -
+ Type
+
+ -
+
+Phaser.Animation.FrameData
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+