Phaser API Documentation

  Version: 
Filter
Namespace: Textures
Phaser.Types.Textures

Type Definitions

CompressedTextureData
Focus
Focus

Description:

An object containing the dimensions and mipmap data for a Compressed Texture.

Properties:
name type description
compressed boolean

Is this a compressed texture?

generateMipmap boolean

Should this texture have mipmaps generated?

width number

The width of the maximum size of the texture.

height number

The height of the maximum size of the texture.

internalFormat GLenum

The WebGL internal texture format.

mipmaps Array.<Phaser.Types.Textures.MipmapType>

An array of MipmapType objects.

Type:
object
Since: 3.60.0
Focus
Focus
MipmapType
Focus
Focus

Description:

A Mipmap Data entry for a Compressed Texture.

Properties:
name type description
width number

The width of this level of the mipmap.

height number

The height of this level of the mipmap.

data Uint8Array

The decoded pixel data.

Type:
object
Since: 3.60.0
Focus
Focus
PixelConfig
Focus
Focus

Description:

An object containing the position and color data for a single pixel in a CanvasTexture.

Properties:
name type description
x number

The x-coordinate of the pixel.

y number

The y-coordinate of the pixel.

color number

The color of the pixel, not including the alpha channel.

alpha number

The alpha of the pixel, between 0 and 1.

Type:
object
Since: 3.16.0
Focus
Focus
SpriteSheetConfig
Focus
Focus
Properties:
name type arguments Default description
frameWidth number

The fixed width of each frame.

frameHeight number <optional>

The fixed height of each frame. If not set it will use the frameWidth as the height.

startFrame number <optional> 0

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

endFrame number <optional> -1

The total number of 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.

Type:
object
Since: 3.0.0
Focus
Focus
SpriteSheetFromAtlasConfig
Focus
Focus
Properties:
name type arguments Default description
atlas string

The key of the Texture Atlas in which this Sprite Sheet can be found.

frame string

The key of the Texture Atlas Frame in which this Sprite Sheet can be found.

frameWidth number

The fixed width of each frame.

frameHeight number <optional>

The fixed height of each frame. If not set it will use the frameWidth as the height.

startFrame number <optional> 0

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

endFrame number <optional> -1

The total number of 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.

Type:
object
Focus
Focus
StampConfig
Focus
Focus

Description:

An object containing the position and color data for a single pixel in a CanvasTexture.

Properties:
name type arguments Default description
alpha number <optional> 1

The alpha value used by the stamp.

tint number <optional> 0xffffff

The tint color value used by the stamp. WebGL only.

angle number <optional> 0

The angle of the stamp in degrees. Rotation takes place around its origin.

rotation number <optional> 0

The rotation of the stamp in radians. Rotation takes place around its origin.

scale number <optional> 1

Sets both the horizontal and vertical scale of the stamp with a single value.

scaleX number <optional> 1

Set the horizontal scale of the stamp. Overrides the scale property, if provided.

scaleY number <optional> 1

Set the vertical scale of the stamp. Overrides the scale property, if provided.

originX number <optional> 0.5

The horizontal origin of the stamp. 0 is the left, 0.5 is the center and 1 is the right.

originY number <optional> 0.5

The vertical origin of the stamp. 0 is the top, 0.5 is the center and 1 is the bottom.

blendMode string | number | Phaser.BlendModes <optional> 0

The blend mode used when drawing the stamp. Defaults to 0 (normal).

erase boolean <optional> false

Erase this stamp from the texture?

skipBatch boolean <optional> false

Skip beginning and ending a batch with this call. Use if this is part of a bigger batched draw.

Type:
object
Since: 3.60.0
Focus
Focus