Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Texture

Hierarchy

Index

Constructors

constructor

Properties

Protected _frame

_frame: Rectangle

Protected _rotate

_rotate: boolean | 0

Protected _updateID

_updateID: number

Protected _uvs

baseTexture

baseTexture: BaseTexture

frame

frame: Rectangle

height

height: number

noFrame

noFrame: boolean

orig

orig: Rectangle

requiresUpdate

requiresUpdate: boolean

rotate

rotate: number

textureCacheIds

textureCacheIds: string[]

transform

transform: any

Optional trim

trim: Rectangle

valid

valid: boolean

width

width: number

Static EMPTY

EMPTY: Texture

Static EventEmitter

EventEmitter: object

Type declaration

  • constructor: function
    • Returns EventEmitter

  • prefixed: string | boolean

Static WHITE

WHITE: Texture

Static prefixed

prefixed: string | boolean

Methods

Protected _updateUvs

  • _updateUvs(): void
  • Returns void

addListener

  • addListener(event: "update", fn: function, context?: any): this
  • Parameters

    • event: "update"
    • fn: function
    • Optional context: any

    Returns this

clone

  • Returns Texture

destroy

  • destroy(destroyBase?: boolean): void
  • Parameters

    • Optional destroyBase: boolean

    Returns void

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Calls each of the listeners registered for a given event.

    Parameters

    • event: string | symbol

      The event name.

    • Rest ...args: any[]

      Arguments that are passed to registered listeners

    Returns boolean

    true if the event had listeners, else false.

eventNames

  • eventNames(): Array<string | symbol>
  • Return an array listing the events for which the emitter has registered listeners.

    Returns Array<string | symbol>

listeners

  • listeners(event: string | symbol): Function[]
  • listeners(event: string | symbol, exists: boolean): boolean
  • Return the listeners registered for a given event.

    Parameters

    • event: string | symbol

      The event name.

    Returns Function[]

  • Check if there listeners for a given event. If exists argument is not true lists listeners.

    Parameters

    • event: string | symbol

      The event name.

    • exists: boolean

      Only check if there are listeners.

    Returns boolean

off

  • off(event: "update", fn?: function, context?: any): this
  • Parameters

    • event: "update"
    • Optional fn: function
    • Optional context: any

    Returns this

on

  • on(event: "update", fn: function, context?: any): this
  • Parameters

    • event: "update"
    • fn: function
    • Optional context: any

    Returns this

Protected onBaseTextureLoaded

  • Parameters

    Returns void

Protected onBaseTextureUpdated

  • Parameters

    Returns void

once

  • once(event: "update", fn: function, context?: any): this
  • Parameters

    • event: "update"
    • fn: function
    • Optional context: any

    Returns this

removeAllListeners

  • removeAllListeners(event: "update"): this

removeListener

  • removeListener(event: "update", fn?: function, context?: any): this
  • Parameters

    • event: "update"
    • Optional fn: function
    • Optional context: any

    Returns this

setMaxListeners

  • setMaxListeners(): this
  • This function doesn't apply anymore.

    deprecated

    Returns this

update

  • update(): void
  • Returns void

Static addTextureToCache

  • addTextureToCache(texture: Texture, id: string): void
  • Parameters

    Returns void

Static addToCache

  • addToCache(texture: Texture, id: string): void
  • Parameters

    Returns void

Static from

  • from(source: number | string | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | BaseTexture): Texture
  • Parameters

    • source: number | string | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | BaseTexture

    Returns Texture

Static fromCanvas

  • fromCanvas(canvas: HTMLCanvasElement, scaleMode?: number, origin?: string): Texture
  • Parameters

    • canvas: HTMLCanvasElement
    • Optional scaleMode: number
    • Optional origin: string

    Returns Texture

Static fromFrame

  • fromFrame(frameId: string): Texture
  • Parameters

    • frameId: string

    Returns Texture

Static fromImage

  • fromImage(imageUrl: string, crossOrigin?: boolean, scaleMode?: number, sourceScale?: number): Texture
  • Parameters

    • imageUrl: string
    • Optional crossOrigin: boolean
    • Optional scaleMode: number
    • Optional sourceScale: number

    Returns Texture

Static fromLoader

  • fromLoader(source: HTMLImageElement | HTMLCanvasElement, imageUrl: string, name?: string): Texture
  • Parameters

    • source: HTMLImageElement | HTMLCanvasElement
    • imageUrl: string
    • Optional name: string

    Returns Texture

Static fromVideo

  • fromVideo(video: HTMLVideoElement | string, scaleMode?: number): Texture
  • Parameters

    • video: HTMLVideoElement | string
    • Optional scaleMode: number

    Returns Texture

Static fromVideoUrl

  • fromVideoUrl(videoUrl: string, scaleMode?: number): Texture
  • Parameters

    • videoUrl: string
    • Optional scaleMode: number

    Returns Texture

Static removeFromCache

  • Parameters

    Returns Texture

Static removeTextureFromCache

  • removeTextureFromCache(id: string): Texture
  • Parameters

    • id: string

    Returns Texture

Generated using TypeDoc