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)
Protected_Update ID is observed by sprites and TextureMatrix instances. Call updateUvs() to increment it.
Protected_The WebGL UV data cache. Can be used as quad UV
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.
The frame specifies the region of the base texture that this texture uses.
Please call updateUvs() after you change coordinates of frame manually.
ReadonlygradientThe height of the Texture in pixels.
ReadonlylocalDoes 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.
texture.on('update', () => {});
Any assignment of frame switches off noFrame mode.
This is the area of original texture, before it was put in atlas
ReadonlyresolutionReturns 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 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.
ReadonlytoThis 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.
The width of the Texture in pixels.
StaticEMPTYAn empty texture, used often to not have to create multiple empty textures. Can not be destroyed.
StaticWHITEA white texture of 16x16 size, used for graphics and other things Can not be destroyed.
Alias method for on
Optionalcontext: anyUtility function for BaseTexture|Texture cast
Destroys this texture
OptionaldestroyBase: boolean
Whether to destroy the base texture as well
Calls each of the listeners registered for a given event.
The event name.
Arguments that are passed to registered listeners
true if the event had listeners, else false.
Return an array listing the events for which the emitter has registered listeners.
Return the number of listeners listening to a given event.
The event name.
Return the listeners registered for a given event.
The event name.
Alias method for removeListener
Optionalfn: FunctionOptionalcontext: anyOptionalonce: booleanAdd a listener for a given event.
The event name.
The listener function.
Optionalcontext: any
The context to invoke the listener with.
this.
ProtectedonProtected
Called when the base texture is updated
The base texture.
Add a one-time listener for a given event.
The event name.
The listener function.
Optionalcontext: any
The context to invoke the listener with.
this.
Remove all listeners, or those of the specified event.
Optionalevent: string | symbol
The event name.
this.
Remove the listeners of a given event.
The event name.
Optionalfn: Function
Only remove the listeners that match this function.
Optionalcontext: any
Only remove the listeners that have this context.
Optionalonce: boolean
Only remove one-time listeners.
this.
Updates 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 to create texture from
Optionaloptions: any
See PIXI.BaseTexture's constructor for options.
Optionalstrict: boolean
Enforce strict-mode, see PIXI.settings.STRICT_TEXTURE_CACHE.
The newly created texture
StaticfromCreate a new Texture with a BufferResource from a Float32Array. RGBA values are floats from 0 to 1.
The optional array to use, if no data is provided, a new Float32Array is created.
Width of the resource
Height of the resource
Optionaloptions: any
See PIXI.BaseTexture's constructor for options.
The resulting new BaseTexture
StaticfromCreate a texture from a source and add to the cache.
The input source.
File name of texture, for cache and resolving resolution.
Optionalname: string
Human readable name for the texture cache. If no name is
specified, only imageUrl will be used as the cache ID.
Output texture
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 to load.
Optionaloptions: any
Optional options to include
A Promise that resolves to a Texture.
Staticremove
A gradient drawn into a canvas by the browser's own gradient (so its colors are what canvas, and createjs, paints), as a texture that Pixi's Graphics fills and strokes with through a matrix.
gradientis the gradient in the shape's coordinates,localthe same gradient in the texture's pixels, andtoShapetakes texture pixels to the shape's coordinates. Outside the drawn area the texture's edge pixels repeat (Pixi clamps), which is how canvas pads a gradient with its end colors.