Class: RenderTexture

RenderTexture

A render texture, extends Texture.

new RenderTexture () overrides

See:

Extends

Methods

resize (width, height, resolution) this

Resizes the render texture.

Name Type Attributes Description
width number

The new width of the render texture.

height number

The new height of the render texture.

resolution number <optional>

The new resolution of the render texture.

Returns:
Type Description
this This texture.

Inherited Properties

From class Texture

baseTexture TextureSource Deprecated : since 8.0.0 inherited

defaultAnchor {
   x: number,
   y: number
}
readonly inherited

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.

Default Value:
  • {0,0}

defaultBorders TextureBorders readonly inherited

Default width of the non-scalable border that is used if 9-slice plane is created with this texture.

Since:
  • 7.2.0
See:

destroyed boolean readonly inherited

Has the texture been destroyed?

dynamic boolean inherited

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.

Default Value:
  • false

frame readonly inherited

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)

height number inherited

The height of the Texture in pixels.

isTexture boolean readonly inherited

is it a texture? yes! used for type checking

Default Value:
  • true

label string inherited

label used for debugging

noFrame boolean inherited

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.

Default Value:
  • false
Example
texture.on('update', () => {});

orig Rectangle readonly inherited

This is the area of original texture, before it was put in atlas.

rotate number readonly inherited

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

the underlying source of the texture (equivalent of baseTexture in v7)

textureMatrix inherited

returns a TextureMatrix instance for this texture. By default, that object is not created because its heavy.

trim Rectangle readonly inherited

This is the trimmed area of original texture, before it was put in atlas Please call updateUvs() after you change coordinates of trim manually.

uid inherited

unique id for this texture

uvs UVs readonly inherited

A uvs object based on the given frame and the texture source

width number inherited

The width of the Texture in pixels.

Inherited Methods

From class Texture

destroy (destroySource) inherited

Destroys this texture

Name Type Default Description
destroySource boolean false

Destroy the source when the texture is destroyed.

update () void inherited

call this if you have modified the texture outside of the constructor

updateUvs () inherited

Call this function when you have modified the frame of this texture.