TextureManager
1.2.0+
Manage textures.
Creation
Creating a texture is done using load:
1const texture = await engine.textures.load('my-image.png');
Alternatively, textures can be created directly via a loaded image using create.
- TextureManager
- .constructor(engine) ⇒ TextureManager
- .create(image) ⇒ Texture
- .load(filename, crossOrigin) ⇒ Promise<Texture>
.constructor(engine: WonderlandEngine) ⇒ TextureManager
Param | Type | Description |
---|---|---|
engine | WonderlandEngine |
.create(image: ImageLike) ⇒ Texture
Create a new texture from an image or video.
Usage
Note: The media must already be loaded. To automatically load the media and create a texture, use load instead.
Param | Type | Description |
---|---|---|
image | ImageLike | Media element to create the texture from. @ret\urns The new texture with the media content. |
.load(filename: string, crossOrigin: string) ⇒ Promise<Texture>
Load an image from URL as Texture.
Usage
1const texture = await engine.textures.load('my-image.png');
Returns: Loaded texture.
Param | Type | Description |
---|---|---|
filename | string | URL to load from. |
crossOrigin | string | Cross origin flag for the image object. |