Skip to main content

ImageBackgroundOptions

Options for an ImageBackground

Extends

Properties

img?

optional img: HTMLImageElement

For simple backgrounds, the image to use. Optional; you can also supply a url.


onBackgroundReady?

optional onBackgroundReady: OnBackgroundReadyCallback

Optional function to call when the image has loaded (or otherwise claims to be ready)

Inherited from

BackgroundOptions.onBackgroundReady


type

type: string

Type of background to render.

Inherited from

BackgroundOptions.type


url?

optional url: string

URL for the background. When type is set to BackgroundTypes.simple you can supply either this, or an Image. When type is set to BackgroundTypes.tiled, you can supply this, or you can supply a urlGenerator function instead. If you supply url and no urlGenerator, the url you supply is treated as a template for the url for any given tile, and is expected to contain {z}, {x} and {y} placeholders. The form of the URL can be anything you like as long as it has the placeholders for z, x and y. For instance:

http://foo.com/{z}/{x}/{y} https://bar.com?zoom={z}&x={x}&y={y}

etc


visible?

optional visible: boolean

Whether or not the background should initially be visible. Defaults to true.

Inherited from

BackgroundOptions.visible