Class: DynamicAsset

DynamicAsset(element)

An Asset whose pixel contents may change.

Constructor

new DynamicAsset(element)

Parameters:
Name Type Description
element HTMLImageElement | HTMLCanvasElement | ImageBitmap

The underlying pixel source.

Implements:
Throws:

If the pixel source is unsupported.

Extends

Methods

destroy()

Destructor.

Overrides:

element() → {*}

Returns the asset's underlying pixel source. The type varies depending on the Stage types the asset is compatible with.

Inherited From:
Implements:
Returns:
Type
*

height() → {number}

Returns the asset's intrinsic height in CSS pixels.

Inherited From:
Implements:
Returns:
Type
number

isDynamic() → {boolean}

Returns whether the asset is dynamic, i.e., whether the contents of the underlying pixel source may change.

Overrides:
Implements:
Returns:
Type
boolean

markDirty()

Marks the asset dirty, signaling that the contents of the underlying pixel source have changed.

Throws:

If the asset is not dynamic.

timestamp() → {number}

Returns the asset's timestamp, which increases monotonically whenever the contents of the underlying pixel source change.

Overrides:
Implements:
Returns:
Type
number

width() → {number}

Returns the asset's intrinsic width in CSS pixels.

Inherited From:
Implements:
Returns:
Type
number