The base texture source to create the texture from
Optionalframe: RectangleThe rectangle frame of the texture to show
Optionalorig: RectangleThe area of original texture
Optionaltrim: RectangleTrimmed rectangle of original texture
Optionalrotate: numberindicates how the texture was rotated by texture packer. See PIXI.groupD8
Optionalanchor: IPointDataDefault anchor point used for sprite placement / rotation
Optionalborders: ITextureBordersDefault borders used for 9-slice scaling. See PIXI.NineSlicePlane
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)
The base texture that this texture uses.
Anchor point that is used as default if sprite is created with this texture.
Changing the defaultAnchor at a later point of time will not update Sprite's anchor point.
OptionaldefaultDefault width of the non-scalable border that is used if 9-slice plane is created with this texture.
ReadonlydestroyedHas the texture been destroyed?
Does this Texture have any frame data assigned to it?
This mode is enabled automatically if no frame was passed inside constructor.
In this mode texture is subscribed to baseTexture events, and fires update on any change.
Beware, after loading or resize of baseTexture event can fired two times! If you want more control, subscribe on baseTexture itself.
Any assignment of frame switches off noFrame mode.
This is the area of original texture, before it was put in atlas.
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.
This is the trimmed area of original texture, before it was put in atlas
Please call updateUvs() after you change coordinates of trim manually.
Default TextureMatrix instance for this texture. By default, that object is not created because its heavy.
This will let the renderer know if the texture is valid. If it's not then it cannot be rendered.
StaticprefixedThe height of the Texture in pixels.
Returns resolution of baseTexture
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 width of the Texture in pixels.
StaticEMPTYStaticWHITEA white texture of 16x16 size, used for graphics and other things Can not be destroyed.
Utility function for BaseTexture|Texture cast.
Calls each of the listeners registered for a given event.
Return an array listing the events for which the emitter has registered listeners.
Return the number of listeners listening to a given event.
Return the listeners registered for a given event.
Add a listener for a given event.
Optionalcontext: anyAdd a one-time listener for a given event.
Optionalcontext: anyRemove all listeners, or those of the specified event.
Optionalevent: string | symbolRemove the listeners of a given event.
Optionalfn: (...args: any[]) => voidOptionalcontext: anyOptionalonce: booleanUpdates this texture on the gpu.
Calls the TextureResource update.
If you adjusted frame manually, please call updateUvs() instead.
Updates the internal WebGL UV cache. Use it after you change frame or trim of the texture.
Call it after changing the frame
StaticaddAdds a Texture to the global TextureCache. This cache is shared across the whole PIXI object.
The Texture to add to the cache.
The id that the Texture will be stored against.
StaticfromHelper 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
Source or array of sources to create texture from
Optionaloptions: IBaseTextureOptions<RO>See PIXI.BaseTexture's constructor for options.
OptionalalphaMode?: ALPHA_MODESOptionalanisotropicLevel?: numberOptionalformat?: FORMATSOptionalheight?: numberOptionalmipmap?: MIPMAP_MODESOptionalmultisample?: MSAA_QUALITYOptionalpixiIdPrefix?: stringOptionalresolution?: numberOptionalresourceOptions?: ROOptionalscaleMode?: SCALE_MODESOptionaltarget?: TARGETSOptionaltype?: TYPESOptionalwidth?: numberOptionalwrapMode?: WRAP_MODESOptionalstrict: booleanEnforce strict-mode, see PIXI.settings.STRICT_TEXTURE_CACHE.
The newly created texture
StaticfromCreate a new Texture with a BufferResource from a typed array.
The optional array to use. If no data is provided, a new Float32Array is created.
Width of the resource
Height of the resource
Optionaloptions: IBaseTextureOptions<IBufferResourceOptions>See PIXI.BaseTexture's constructor for options. Default properties are different from the constructor's defaults.
OptionalalphaMode?: ALPHA_MODESOptionalanisotropicLevel?: numberOptionalformat?: FORMATSOptionalheight?: numberOptionalmipmap?: MIPMAP_MODESOptionalmultisample?: MSAA_QUALITYOptionalpixiIdPrefix?: stringOptionalresolution?: numberOptionalresourceOptions?: ROOptionalscaleMode?: SCALE_MODESOptionaltarget?: TARGETSOptionaltype?: TYPESOptionalwidth?: numberOptionalwrapMode?: WRAP_MODESStaticfromCreate a texture from a source and add to the cache.
The input source.
File name of texture, for cache and resolving resolution.
Optionalname: stringHuman readable name for the texture cache. If no name is
specified, only imageUrl will be used as the cache ID.
Optionaloptions: IBaseTextureOptions<any>StaticfromUseful for loading textures via URLs. Use instead of Texture.from because
it does a better job of handling failed URLs more effectively. This also ignores
PIXI.settings.STRICT_TEXTURE_CACHE. Works for Videos, SVGs, Images.
The remote URL or array of URLs to load.
Optionaloptions: IBaseTextureOptions<RO>Optional options to include
Staticremove
A texture stores the information that represents an image or part of an image.
It cannot be added to the display list directly; instead use it as the texture for a Sprite. If no frame is provided for a texture, then the whole image is used.
You can directly create a texture from an image and then reuse it multiple times like this :
If you didnt pass the texture frame to constructor, it enables
noFramemode: it subscribes on baseTexture events, it automatically resizes at the same time as baseTexture.Textures made from SVGs, loaded or not, cannot be used before the file finishes processing. You can check for this by checking the sprite's _textureID property.
You can use a ticker or rAF to ensure your sprites load the finished textures after processing. See issue [#3085]https://github.com/pixijs/pixijs/issues/3085.
Memberof
PIXI