Namespace: Animations

Phaser.Types. Animations

Type Definitions


Animation

Type:
  • object
Properties:
Name Type Argument Default Description
key string <optional>

The key that the animation will be associated with. i.e. sprite.animations.play(key)

frames Array.<Phaser.Types.Animations.AnimationFrame> <optional>

An object containing data used to generate the frames for the animation

defaultTextureKey string <optional>
null

The key of the texture all frames of the animation will use. Can be overridden on a per frame basis.

frameRate integer <optional>

The frame rate of playback in frames per second (default 24 if duration is null)

duration integer <optional>

How long the animation should play for in milliseconds. If not given its derived from frameRate.

skipMissedFrames boolean <optional>
true

Skip frames if the time lags, or always advanced anyway?

delay integer <optional>
0

Delay before starting playback. Value given in milliseconds.

repeat integer <optional>
0

Number of times to repeat the animation (-1 for infinity)

repeatDelay integer <optional>
0

Delay before the animation repeats. Value given in milliseconds.

yoyo boolean <optional>
false

Should the animation yoyo? (reverse back down to the start) before repeating?

showOnStart boolean <optional>
false

Should sprite.visible = true when the animation starts to play?

hideOnComplete boolean <optional>
false

Should sprite.visible = false when the animation finishes?

Since: 3.0.0
Source: src/animations/typedefs/Animation.js (Line 1)

AnimationFrame

Type:
  • object
Properties:
Name Type Argument Default Description
key string

The key that the animation will be associated with. i.e. sprite.animations.play(key)

frame string | number

[description]

duration number <optional>
0

[description]

visible boolean <optional>

[description]

Since: 3.0.0
Source: src/animations/typedefs/AnimationFrame.js (Line 1)

GenerateFrameNames

Type:
  • object
Properties:
Name Type Argument Default Description
prefix string <optional>
''

The string to append to every resulting frame name if using a range or an array of frames.

start integer <optional>
0

If frames is not provided, the number of the first frame to return.

end integer <optional>
0

If frames is not provided, the number of the last frame to return.

suffix string <optional>
''

The string to append to every resulting frame name if using a range or an array of frames.

zeroPad integer <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.

outputArray Array.<Phaser.Types.Animations.AnimationFrame> <optional>
[]

The array to append the created configuration objects to.

frames boolean <optional>
false

If provided as an array, the range defined by start and end will be ignored and these frame numbers will be used.

Since: 3.0.0
Source: src/animations/typedefs/GenerateFrameNames.js (Line 1)

GenerateFrameNumbers

Type:
  • object
Properties:
Name Type Argument Default Description
start integer <optional>
0

The starting frame of the animation.

end integer <optional>
-1

The ending frame of the animation.

first boolean | integer <optional>
false

A frame to put at the beginning of the animation, before start or outputArray or frames.

outputArray Array.<Phaser.Types.Animations.AnimationFrame> <optional>
[]

An array to concatenate the output onto.

frames boolean | Array.<integer> <optional>
false

A custom sequence of frames.

Since: 3.0.0
Source: src/animations/typedefs/GenerateFrameNumbers.js (Line 1)

JSONAnimation

Type:
  • object
Properties:
Name Type Description
key string

The key that the animation will be associated with. i.e. sprite.animations.play(key)

type string

A frame based animation (as opposed to a bone based animation)

frames Array.<Phaser.Types.Animations.JSONAnimationFrame>

[description]

frameRate integer

The frame rate of playback in frames per second (default 24 if duration is null)

duration integer

How long the animation should play for in milliseconds. If not given its derived from frameRate.

skipMissedFrames boolean

Skip frames if the time lags, or always advanced anyway?

delay integer

Delay before starting playback. Value given in milliseconds.

repeat integer

Number of times to repeat the animation (-1 for infinity)

repeatDelay integer

Delay before the animation repeats. Value given in milliseconds.

yoyo boolean

Should the animation yoyo? (reverse back down to the start) before repeating?

showOnStart boolean

Should sprite.visible = true when the animation starts to play?

hideOnComplete boolean

Should sprite.visible = false when the animation finishes?

Since: 3.0.0
Source: src/animations/typedefs/JSONAnimation.js (Line 1)

JSONAnimationFrame

Type:
  • object
Properties:
Name Type Description
key string

The key of the Texture this AnimationFrame uses.

frame string | integer

The key of the Frame within the Texture that this AnimationFrame uses.

duration number

Additional time (in ms) that this frame should appear for during playback.

Since: 3.0.0
Source: src/animations/typedefs/JSONAnimationFrame.js (Line 1)

JSONAnimations

Type:
  • object
Properties:
Name Type Description
anims Array.<Phaser.Types.Animations.JSONAnimation>

An array of all Animations added to the Animation Manager.

globalTimeScale number

The global time scale of the Animation Manager.

Since: 3.0.0
Source: src/animations/typedefs/JSONAnimations.js (Line 1)