Texture Class
A texture stores the information that represents an image or part of an image. It cannot be added to the display list directly. To do this use PIXI.Sprite. If no frame is provided then the whole image is used
Constructor
Texture
-
baseTexture
-
frame
Parameters:
-
baseTexture
BaseTextureThe base texture source to create the texture from
-
frame
RectangleThe rectangle frame of the texture to show
Item Index
Methods
- addTextureToCache static
- destroy
- fromCanvas static
- fromFrame static
- fromImage static
- onBaseTextureLoaded
- removeTextureFromCache static
- setFrame
Properties
Methods
addTextureToCache
-
texture
-
id
Adds a texture to the textureCache.
Parameters:
-
texture
Texture -
id
Stringthe id that the texture will be stored against.
destroy
-
destroyBase
Destroys this texture
Parameters:
-
destroyBase
BooleanWhether to destroy the base texture as well
fromCanvas
-
canvas
Helper function that returns a texture based on a canvas element If the canvas is not in the texture cache it will be created and loaded
Parameters:
-
canvas
CanvasThe canvas element source of the texture
Returns:
Texture
fromFrame
-
frameId
Helper function that returns a texture based on a frame id If the frame id is not in the texture cache an error will be thrown
Parameters:
-
frameId
StringThe frame id of the texture
Returns:
Texture
fromImage
-
imageUrl
-
crossorigin
Helper function that returns a texture based on an image url If the image is not in the texture cache it will be created and loaded
Parameters:
-
imageUrl
StringThe image url of the texture
-
crossorigin
BooleanWhether requests should be treated as crossorigin
Returns:
Texture
onBaseTextureLoaded
-
event
Called when the base texture is loaded
Parameters:
-
event
Object
removeTextureFromCache
-
id
Remove a texture from the textureCache.
Parameters:
-
id
Stringthe id of the texture to be removed
Returns:
the texture that was removed
setFrame
-
frame
Specifies the rectangle region of the baseTexture
Parameters:
-
frame
RectangleThe frame of the texture to set it to