Class: RenderTexture
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/RenderTexture.d.ts:18
A render texture, extends Texture.
See
Advanced
Extends
Constructors
Constructor
> new RenderTexture(options?): RenderTexture
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:217
Parameters
options?
TextureOptions<TextureSource<any>>
Options for the texture
Returns
RenderTexture
Inherited from
Properties
_source
> _source: TextureSource
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:154
Internal
Inherited from
defaultAnchor?
> readonly optional defaultAnchor?: object
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:170
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.
x
> x: number
y
> y: number
Default
{0,0}
Inherited from
defaultBorders?
> readonly optional defaultBorders?: TextureBorders
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:179
Default width of the non-scalable border that is used if 9-slice plane is created with this texture.
Since
7.2.0
See
NineSliceSprite
Inherited from
destroyed
> readonly destroyed: boolean
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:152
Has the texture been destroyed?
Inherited from
dynamic
> dynamic: boolean
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:210
Set to true if you plan on modifying the uvs of this texture. When this is the case, sprites and other objects using the texture will make sure to listen for changes to the uvs and update their vertices accordingly.
Inherited from
frame
> readonly frame: Rectangle
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:184
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)
Inherited from
isTexture
> readonly isTexture: true = true
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:213
is it a texture? yes! used for type checking
Inherited from
label?
> optional label?: string
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:145
label used for debugging
Inherited from
noFrame
> noFrame: boolean
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:204
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.
Example
texture.on('update', () => {});
Inherited from
orig
> readonly orig: Rectangle
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:186
This is the area of original texture, before it was put in atlas.
Inherited from
rotate
> readonly rotate: number
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:162
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 groupD8 for explanation
Inherited from
trim
> readonly trim: Rectangle
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:191
This is the trimmed area of original texture, before it was put in atlas
Please call updateUvs() after you change coordinates of trim manually.
Inherited from
uid
> readonly uid: number
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:147
unique id for this texture
Inherited from
uvs
> readonly uvs: UVs
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:164
A uvs object based on the given frame and the texture source
Inherited from
EMPTY
> static EMPTY: Texture
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:243
an Empty Texture used internally by the engine
Inherited from
from
> static from: (id, skipCache?) => Texture
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:143
Helper function that creates a returns Texture based on the source you provide. The source should be loaded and ready to go. If not its best to grab the asset using Assets.
Parameters
id
String or Source to create texture from
skipCache?
boolean
Skip adding the texture to the cache
Returns
The texture based on the Id provided
Inherited from
prefixed
> static prefixed: string | boolean
Defined in: node_modules/eventemitter3/index.d.ts:9
Inherited from
WHITE
> static WHITE: Texture<BufferImageSource>
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:245
a White texture used internally by the engine
Inherited from
Accessors
baseTexture
Get Signature
> get baseTexture(): TextureSource
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:241
Deprecated
since 8.0.0
Returns
Inherited from
height
Get Signature
> get height(): number
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:226
The height of the Texture in pixels.
Returns
number
Inherited from
source
Get Signature
> get source(): TextureSourceType
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:220
the underlying source of the texture (equivalent of baseTexture in v7)
Returns
TextureSourceType
Set Signature
> set source(value): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:218
Parameters
value
TextureSourceType
Returns
void
Inherited from
textureMatrix
Get Signature
> get textureMatrix(): TextureMatrix
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:222
returns a TextureMatrix instance for this texture. By default, that object is not created because its heavy.
Returns
Inherited from
width
Get Signature
> get width(): number
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:224
The width of the Texture in pixels.
Returns
number
Inherited from
Methods
addListener()
> addListener<T>(event, fn, context?): this
Defined in: node_modules/eventemitter3/index.d.ts:45
Type Parameters
T
T extends "update" | "destroy"
Parameters
event
T
fn
(...args) => void
context?
any
Returns
this
Inherited from
Texture.addListener
destroy()
> destroy(destroySource?): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:233
Destroys this texture
Parameters
destroySource?
boolean
Destroy the source when the texture is destroyed.
Returns
void
Inherited from
emit()
> emit<T>(event, ...args): boolean
Defined in: node_modules/eventemitter3/index.d.ts:32
Calls each of the listeners registered for a given event.
Type Parameters
T
T extends "update" | "destroy"
Parameters
event
T
args
...ArgumentMap<{ destroy: Texture; update: Texture; }>[Extract<T, "update" | "destroy">]
Returns
boolean
Inherited from
Texture.emit
eventNames()
> eventNames(): ("update" | "destroy")[]
Defined in: node_modules/eventemitter3/index.d.ts:15
Return an array listing the events for which the emitter has registered listeners.
Returns
("update" | "destroy")[]
Inherited from
Texture.eventNames
listenerCount()
> listenerCount(event): number
Defined in: node_modules/eventemitter3/index.d.ts:27
Return the number of listeners listening to a given event.
Parameters
event
"update" | "destroy"
Returns
number
Inherited from
Texture.listenerCount
listeners()
> listeners<T>(event): (...args) => void[]
Defined in: node_modules/eventemitter3/index.d.ts:20
Return the listeners registered for a given event.
Type Parameters
T
T extends "update" | "destroy"
Parameters
event
T
Returns
(...args) => void[]
Inherited from
Texture.listeners
off()
> off<T>(event, fn?, context?, once?): this
Defined in: node_modules/eventemitter3/index.d.ts:69
Type Parameters
T
T extends "update" | "destroy"
Parameters
event
T
fn?
(...args) => void
context?
any
once?
boolean
Returns
this
Inherited from
Texture.off
on()
> on<T>(event, fn, context?): this
Defined in: node_modules/eventemitter3/index.d.ts:40
Add a listener for a given event.
Type Parameters
T
T extends "update" | "destroy"
Parameters
event
T
fn
(...args) => void
context?
any
Returns
this
Inherited from
Texture.on
once()
> once<T>(event, fn, context?): this
Defined in: node_modules/eventemitter3/index.d.ts:54
Add a one-time listener for a given event.
Type Parameters
T
T extends "update" | "destroy"
Parameters
event
T
fn
(...args) => void
context?
any
Returns
this
Inherited from
Texture.once
removeAllListeners()
> removeAllListeners(event?): this
Defined in: node_modules/eventemitter3/index.d.ts:79
Remove all listeners, or those of the specified event.
Parameters
event?
"update" | "destroy"
Returns
this
Inherited from
Texture.removeAllListeners
removeListener()
> removeListener<T>(event, fn?, context?, once?): this
Defined in: node_modules/eventemitter3/index.d.ts:63
Remove the listeners of a given event.
Type Parameters
T
T extends "update" | "destroy"
Parameters
event
T
fn?
(...args) => void
context?
any
once?
boolean
Returns
this
Inherited from
Texture.removeListener
resize()
> resize(width, height, resolution?): this
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/RenderTexture.d.ts:36
Resizes the render texture.
Parameters
width
number
The new width of the render texture.
height
number
The new height of the render texture.
resolution?
number
The new resolution of the render texture.
Returns
this
This texture.
update()
> update(): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:239
Call this if you have modified the texture outside of the constructor.
If you have modified this texture's source, you must separately call texture.source.update() to see those changes.
Returns
void
Inherited from
updateUvs()
> updateUvs(): void
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/Texture.d.ts:228
Call this function when you have modified the frame of this texture.
Returns
void
Inherited from
create()
> static create(options): RenderTexture
Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/RenderTexture.d.ts:28
Creates a RenderTexture. Pass dynamic: true in options to allow resizing after creation.
Parameters
options
Options for the RenderTexture, including width, height, textureOptions, and dynamic.
Returns
RenderTexture
A new RenderTexture instance.
Example
const textureOptions = { defaultAnchor: { x: 0.5, y: 0.5 } };
const rt = RenderTexture.create({ width: 100, height: 100, dynamic: true, textureOptions });
rt.resize(500, 500);