- Source: src/animations/typedefs/index.js (Line 7)
Type Definitions
-
Animation
-
Type:
- object
- Since: 3.0.0
- Source: src/animations/typedefs/Animation.js (Line 1)
Properties:
Name Type Argument Default Description keystring <optional>
The key that the animation will be associated with. i.e. sprite.animations.play(key)
framesstring | Array.<Phaser.Types.Animations.AnimationFrame> <optional>
Either a string, in which case it will use all frames from a texture with the matching key, or an array of Animation Frame configuration objects.
sortFramesboolean <optional>
true If you provide a string for
framesyou can optionally have the frame names numerically sorted.defaultTextureKeystring <optional>
null The key of the texture all frames of the animation will use. Can be overridden on a per frame basis.
frameRatenumber <optional>
The frame rate of playback in frames per second (default 24 if duration is null)
durationnumber <optional>
How long the animation should play for in milliseconds. If not given its derived from frameRate.
skipMissedFramesboolean <optional>
true Skip frames if the time lags, or always advanced anyway?
delaynumber <optional>
0 Delay before starting playback. Value given in milliseconds.
repeatnumber <optional>
0 Number of times to repeat the animation (-1 for infinity)
repeatDelaynumber <optional>
0 Delay before the animation repeats. Value given in milliseconds.
yoyoboolean <optional>
false Should the animation yoyo? (reverse back down to the start) before repeating?
showOnStartboolean <optional>
false Should sprite.visible = true when the animation starts to play?
hideOnCompleteboolean <optional>
false Should sprite.visible = false when the animation finishes?
-
AnimationFrame
-
Type:
- object
- Since: 3.0.0
- Source: src/animations/typedefs/AnimationFrame.js (Line 1)
Properties:
Name Type Argument Default Description keystring <optional>
The key of the texture within the Texture Manager to use for this Animation Frame.
framestring | number <optional>
The key, or index number, of the frame within the texture to use for this Animation Frame.
durationnumber <optional>
0 The duration, in ms, of this frame of the animation.
visibleboolean <optional>
Should the parent Game Object be visible during this frame of the animation?
-
GenerateFrameNames
-
Type:
- object
- Since: 3.0.0
- Source: src/animations/typedefs/GenerateFrameNames.js (Line 1)
Properties:
Name Type Argument Default Description prefixstring <optional>
'' The string to append to every resulting frame name if using a range or an array of
frames.startnumber <optional>
0 If
framesis not provided, the number of the first frame to return.endnumber <optional>
0 If
framesis not provided, the number of the last frame to return.suffixstring <optional>
'' The string to append to every resulting frame name if using a range or an array of
frames.zeroPadnumber <optional>
0 The minimum expected lengths of each resulting frame's number. Numbers will be left-padded with zeroes until they are this long, then prepended and appended to create the resulting frame name.
outputArrayArray.<Phaser.Types.Animations.AnimationFrame> <optional>
[] The array to append the created configuration objects to.
framesboolean | Array.<number> <optional>
false If provided as an array, the range defined by
startandendwill be ignored and these frame numbers will be used. -
GenerateFrameNumbers
-
Type:
- object
- Since: 3.0.0
- Source: src/animations/typedefs/GenerateFrameNumbers.js (Line 1)
Properties:
Name Type Argument Default Description startnumber <optional>
0 The starting frame of the animation.
endnumber <optional>
-1 The ending frame of the animation.
firstboolean | number <optional>
false A frame to put at the beginning of the animation, before
startoroutputArrayorframes.outputArrayArray.<Phaser.Types.Animations.AnimationFrame> <optional>
[] An array to concatenate the output onto.
framesboolean | Array.<number> <optional>
false A custom sequence of frames.
-
JSONAnimation
-
Type:
- object
- Since: 3.0.0
- Source: src/animations/typedefs/JSONAnimation.js (Line 1)
Properties:
Name Type Description keystring The key that the animation will be associated with. i.e. sprite.animations.play(key)
typestring A frame based animation (as opposed to a bone based animation)
framesArray.<Phaser.Types.Animations.JSONAnimationFrame> An array of the AnimationFrame objects inside this Animation.
frameRatenumber The frame rate of playback in frames per second (default 24 if duration is null)
durationnumber How long the animation should play for in milliseconds. If not given its derived from frameRate.
skipMissedFramesboolean Skip frames if the time lags, or always advanced anyway?
delaynumber Delay before starting playback. Value given in milliseconds.
repeatnumber Number of times to repeat the animation (-1 for infinity)
repeatDelaynumber Delay before the animation repeats. Value given in milliseconds.
yoyoboolean Should the animation yoyo? (reverse back down to the start) before repeating?
showOnStartboolean Should sprite.visible = true when the animation starts to play?
hideOnCompleteboolean Should sprite.visible = false when the animation finishes?
-
JSONAnimationFrame
-
Type:
- object
- Since: 3.0.0
- Source: src/animations/typedefs/JSONAnimationFrame.js (Line 1)
Properties:
Name Type Description keystring The key of the Texture this AnimationFrame uses.
framestring | number The key of the Frame within the Texture that this AnimationFrame uses.
durationnumber Additional time (in ms) that this frame should appear for during playback.
-
JSONAnimations
-
Type:
- object
- Since: 3.0.0
- Source: src/animations/typedefs/JSONAnimations.js (Line 1)
Properties:
Name Type Description animsArray.<Phaser.Types.Animations.JSONAnimation> An array of all Animations added to the Animation Manager.
globalTimeScalenumber The global time scale of the Animation Manager.
-
PlayAnimationConfig
-
Type:
- object
- Since: 3.50.0
- Source: src/animations/typedefs/PlayAnimationConfig.js (Line 1)
Properties:
Name Type Argument Description keystring | Phaser.Animations.Animation The string-based key of the animation to play, or an Animation instance.
frameRatenumber <optional>
The frame rate of playback in frames per second (default 24 if duration is null)
durationnumber <optional>
How long the animation should play for in milliseconds. If not given its derived from frameRate.
delaynumber <optional>
Delay before starting playback. Value given in milliseconds.
repeatnumber <optional>
Number of times to repeat the animation (-1 for infinity)
repeatDelaynumber <optional>
Delay before the animation repeats. Value given in milliseconds.
yoyoboolean <optional>
Should the animation yoyo? (reverse back down to the start) before repeating?
showOnStartboolean <optional>
Should sprite.visible = true when the animation starts to play?
hideOnCompleteboolean <optional>
Should sprite.visible = false when the animation finishes?
startFramenumber <optional>
The frame of the animation to start playback from.
timeScalenumber <optional>
The time scale to be applied to playback of this animation.
