ImageSource
Implements
- Loadable<HTMLImageElement>
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
The path to the image, can also be a data url like 'data:image/'
Parameters
pathOrBase64: string
{string} Path to the image resource relative from the HTML document hosting the game, or absolute
optionaloptions: ImageSourceOptions
Returns ImageSource
Properties
publicdata
Access to the underlying html image element
publicoptionalfiltering
publicreadonlypath
publicready
Promise the resolves when the image is loaded and ready for use, does not initiate loading
publicoptionalwrapping
Accessors
publicbustCache
Should excalibur add a cache busting querystring? By default false. Must be set before loading
Returns boolean
Parameters
val: boolean
Returns void
publicheight
The original height of the source image in pixels
Returns number
publicimage
Returns HTMLImageElement
publicwidth
The original size of the source image in pixels
Returns number
Methods
publicisLoaded
Returns true if the Texture is completely loaded and is ready to be drawn.
Returns boolean
load
Begins loading the image and returns a promise that resolves when the image is loaded
Returns Promise<HTMLImageElement>
publictoSprite
Build a sprite from this ImageSource
Parameters
optionaloptions: Omit<GraphicOptions & SpriteOptions, image>
Returns Sprite
unload
Unload images from memory
Returns void
staticfromHtmlCanvasElement
Parameters
image: HTMLCanvasElement
optionaloptions: ImageSourceOptions
Returns ImageSource
staticfromHtmlImageElement
Create an ImageSource from and HTML
<image>tag elementParameters
image: HTMLImageElement
optionaloptions: ImageSourceOptions
Returns ImageSource
staticfromSvgString
Parameters
svgSource: string
optionaloptions: ImageSourceOptions
Returns ImageSource
An interface describing loadable resources in Excalibur. Built-in loadable resources include Texture, Sound, and a generic Resource.