ImageSource
Implements
- Loadable<HTMLImageElement>
Index
Constructors
constructor
The path to the image, can also be a data url like 'data:image/'
Parameters
path: string
{string} Path to the image resource relative from the HTML document hosting the game, or absolute
bustCache: boolean = false
{boolean} Should excalibur add a cache busting querystring?
optionalfiltering: ImageFiltering
{ImageFiltering} Optionally override the image filtering set by [[EngineOptions.antialiasing]]
Returns ImageSource
Properties
publicdata
Access to the underlying html image element
publicfiltering
publicreadonlypath
{string} Path to the image resource relative from the HTML document hosting the game, or absolute
publicready
Promise the resolves when the image is loaded and ready for use, does not initiate loading
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
Returns Sprite
unload
Unload images from memory
Returns void
staticfromHtmlImageElement
Create an ImageSource from and HTML
<image>tag elementParameters
image: HTMLImageElement
optionaloptions: ImageSourceOptions
Returns ImageSource
An interface describing loadable resources in Excalibur. Built-in loadable resources include [[Texture]], [[Sound]], and a generic [[Resource]].