| Name | Type | Description |
|---|---|---|
baseTexture |
PIXI.BaseTexture |
The base texture source to create the texture from |
frame |
PIXI.Rectangle |
optional
The rectangle frame of the texture to show |
orig |
PIXI.Rectangle |
optional
The area of original texture |
trim |
PIXI.Rectangle |
optional
Trimmed rectangle of original texture |
rotate |
number |
optional
indicates how the texture was rotated by texture packer. See PIXI.GroupD8 |
Extends
- EventEmitter
Members
-
An empty texture, used often to not have to create multiple empty textures. Can not be destroyed.
-
A white texture of 10x10 size, used for graphics and other things Can not be destroyed.
-
_frame PIXI.Rectangle
-
This is the area of the BaseTexture image to actually copy to the Canvas / WebGL when rendering, irrespective of the actual frame size or placement (which can be influenced by trimmed texture atlases)
-
baseTexture PIXI.BaseTexture
-
The base texture that this texture uses.
-
frame PIXI.Rectangle
-
The frame specifies the region of the base texture that this texture uses. Please call
_updateUvs()after you change coordinates offramemanually. -
The height of the Texture in pixels.
-
Does this Texture have any frame data assigned to it?
-
orig PIXI.Rectangle
-
This is the area of original texture, before it was put in atlas
-
This will let a renderer know that a texture has been updated (used mainly for webGL uv updates)
-
Indicates whether the texture is rotated inside the atlas set to 2 to compensate for texture packer rotation set to 6 to compensate for spine packer rotation can be used to rotate or mirror sprites See PIXI.GroupD8 for explanation
-
The ids under which this Texture has been added to the texture cache. This is automatically set as long as Texture.addToCache is used, but may not be set if a Texture is added directly to the TextureCache array.
-
trim PIXI.Rectangle
-
This is the trimmed area of original texture, before it was put in atlas Please call
_updateUvs()after you change coordinates oftrimmanually. -
This will let the renderer know if the texture is valid. If it's not then it cannot be rendered.
-
The width of the Texture in pixels.
Methods
-
Name Type Description texturePIXI.Texture The Texture to add to the cache.
idstring The id that the texture will be stored against.
-
Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object.
Name Type Description texturePIXI.Texture The Texture to add to the cache.
idstring The id that the Texture will be stored against.
-
PIXI.Texture.from (source)PIXI.Texture static
-
Helper function that creates a new Texture based on the source you provide. The source can be - frame id, image url, video url, canvas element, video element, base texture
Name Type Description sourcenumber | string | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | PIXI.BaseTexture Source to create texture from
Returns:
Type Description PIXI.Texture The newly created texture -
PIXI.Texture.fromCanvas (canvas, scaleMode, origin)PIXI.Texture static
-
Helper function that creates a new Texture based on the given canvas element.
Name Type Default Description canvasHTMLCanvasElement The canvas element source of the texture
scaleModenumber PIXI.settings.SCALE_MODE optional See PIXI.SCALE_MODES for possible values
originstring 'canvas' optional A string origin of who created the base texture
Returns:
Type Description PIXI.Texture The newly created texture -
PIXI.Texture.fromFrame (frameId)PIXI.Texture static
-
Helper function that creates a sprite that will contain a texture from the TextureCache based on the frameId The frame ids are created when a Texture packer file has been loaded
Name Type Description frameIdstring The frame Id of the texture in the cache
Returns:
Type Description PIXI.Texture The newly created texture -
PIXI.Texture.fromImage (imageUrl, crossorigin, scaleMode, sourceScale)PIXI.Texture static
-
Helper function that creates a Texture object from the given image url. If the image is not in the texture cache it will be created and loaded.
Name Type Default Description imageUrlstring The image url of the texture
crossoriginboolean optional Whether requests should be treated as crossorigin
scaleModenumber PIXI.settings.SCALE_MODE optional See PIXI.SCALE_MODES for possible values
sourceScalenumber (auto) optional Scale for the original image, used with SVG images.
Returns:
Type Description PIXI.Texture The newly created texture -
PIXI.Texture.fromLoader (source, imageUrl, name)PIXI.Texture static
-
Create a texture from a source and add to the cache.
Name Type Description sourceHTMLImageElement | HTMLCanvasElement The input source.
imageUrlString File name of texture, for cache and resolving resolution.
nameString optional Human readible name for the texture cache. If no name is specified, only
imageUrlwill be used as the cache ID.Returns:
Type Description PIXI.Texture Output texture -
PIXI.Texture.fromVideo (video, scaleMode)PIXI.Texture static
-
Helper function that creates a new Texture based on the given video element.
Name Type Default Description videoHTMLVideoElement | string The URL or actual element of the video
scaleModenumber PIXI.settings.SCALE_MODE optional See PIXI.SCALE_MODES for possible values
Returns:
Type Description PIXI.Texture The newly created texture -
PIXI.Texture.fromVideoUrl (videoUrl, scaleMode)PIXI.Texture static
-
Helper function that creates a new Texture based on the video url.
Name Type Default Description videoUrlstring URL of the video
scaleModenumber PIXI.settings.SCALE_MODE optional See PIXI.SCALE_MODES for possible values
Returns:
Type Description PIXI.Texture The newly created texture -
PIXI.Texture.removeFromCache (texture)PIXI.Texture | null static
-
Remove a Texture from the global TextureCache.
Name Type Description texturestring | PIXI.Texture id of a Texture to be removed, or a Texture instance itself
Returns:
Type Description PIXI.Texture | null The Texture that was removed -
PIXI.Texture.removeTextureFromCache (id)PIXI.Texture | null Deprecated : since 4.5.0 static
-
Name Type Description idstring The id of the texture to be removed
Returns:
Type Description PIXI.Texture | null The texture that was removed -
Updates the internal WebGL UV cache. Use it after you change
frameortrimof the texture. -
clone ()PIXI.Texture
-
Creates a new texture object that acts the same as this one.
Returns:
Type Description PIXI.Texture The new texture -
Destroys this texture
Name Type Default Description destroyBaseboolean false optional Whether to destroy the base texture as well
-
Name Type Description framePIXI.Rectangle The frame to set.
-
Updates this texture on the gpu.
Events
-
Fired when the texture is updated. This happens if the frame or the baseTexture is updated.
Name Type Description texturePIXI.Texture Instance of texture being updated.