indexFunctions
Function: showImage()
> showImage(alias, imageUrl?, options?): Promise<ImageSprite<ImageSpriteMemory>>
Defined in: src/canvas/functions/image-utility.ts:69
Add and show a image in the canvas. This function is a combination of addImage.
Parameters
alias
string
The unique alias of the image. You can use this alias to refer to this image
imageUrl?
string
The url of the image. If you have initialized the "asset matrix", you can use the alias of the texture. If you don't provide the URL, then the alias is used as the URL.
options?
The options of the image.
Returns
Promise<ImageSprite<ImageSpriteMemory>>
This function returns an ImageSprite that you can use to manipulate the component.
Throws
when imageUrl is not provided and alias is not registered in the asset cache.
Example
let bunny1 = showImage("bunny1", "https://pixijs.com/assets/bunny1.png")
Assets.add({ alias: "bunny2", src: "https://pixijs.com/assets/bunny2.png" })
let bunny2 = showImage("bunny2")