Texture Class

Extends Texture
Module: Textures

Basic image texture object wraps a texture from a img DOM element

Support for GIF animations without playback controls.

Methods

dispose

()

Dispose texture.

toJSON

(
  • meta
)

Create JSON description for texture, serializes image used in the texture Texture serialization is different inside nunuStudio, the Texture class does not serialize any image data.

Parameters:

  • meta Object

updateSource

()

Should be called after updating the source of the texture.

Will copy the source data to the texture for upload to the GPU.

Properties

center

Vector2

Indicates where the center of rotation is. To rotate around the center point set this value to (0.5, 0.5).

disposed

Boolean

Flag used to know is the texture has been disposed.

Is used to control animation when using a gif as a texture.

Default: false

flipY

Boolean

Flips the image's Y axis to match the WebGL texture coordinate space.

image

Element

DOM element attached to the texture

mipmaps

Array

Array of user-specified mipmaps (optional).

name

String

Name of the texture (doesn't need to be unique).

offset

Vector2

How much a single repetition of the texture is offset from the beginning, in each direction U and V.

premultiplyAlpha

Boolean

False by default, which is the norm for PNG images. Set to true if the RGB values have been stored premultiplied by alpha.

repeat

Vector2

How many times the texture is repeated across the surface, in each direction U and V. If repeat is set greater than 1 in either direction, the corresponding Wrap parameter should also be set to .

rotation

Number

How much the texture is rotated around the center point, in radians. Postive values are counter-clockwise.

Default: 0

source

Image

Source image of the texture.

uuid

String

UUID of this object instance. This gets automatically assigned, so this shouldn't be edited.