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.
options?
The options of the image.
Returns
Promise<ImageSprite<ImageSpriteMemory>>
A promise that is resolved when the image is loaded.
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")