The asset that is loaded. Available once the element is ready — await
whenReady or the element's ready() promise before accessing it.
Gets the texture's horizontal (U) address mode.
The address mode, or null when unset.
Sets the texture's horizontal (U) address mode: how texture coordinates outside the 0 to 1
range sample the texture. Applies to texture and textureatlas assets, both when the
texture is created and after it has loaded.
The address mode, or null to use the engine default of 'repeat'.
Gets the texture's vertical (V) address mode.
The address mode, or null when unset.
Sets the texture's vertical (V) address mode: how texture coordinates outside the 0 to 1
range sample the texture. Applies to texture and textureatlas assets, both when the
texture is created and after it has loaded.
The address mode, or null to use the engine default of 'repeat'.
Gets the texture's maximum anisotropic filtering level.
The anisotropy level, or null when unset.
Sets the texture's maximum anisotropic filtering level, which improves quality at oblique
viewing angles. Applies to texture and textureatlas assets, both when the texture is
created and after it has loaded.
The anisotropy level, or null to use the engine default of 1.
The nearest ancestor <pc-app> element, or null if this element has no <pc-app>
ancestor. The search starts at the parent, so an element never resolves to itself.
The closest app element, or null.
The nearest ancestor element that fronts an entity — <pc-entity>, <pc-model> or
<pc-node> — or null if this element has no such ancestor. The search starts at the
parent, so an element never resolves to itself.
The closest entity-fronting element, or null.
Gets whether the texture's image data is flipped vertically at upload.
The flip flag, or null when unset.
Sets whether the texture's image data is flipped vertically at upload. Applies to texture
and textureatlas assets, both when the texture is created and after it has loaded.
The flip flag, or null to use the engine default of false.
Gets whether the asset should be loaded lazily.
The lazy loading flag.
Sets whether the asset should be loaded lazily. A lazy asset is registered without being
loaded; it loads on first use - the first time any element resolves it by id - or when
this flag is cleared on a registered asset, whichever comes first.
The lazy loading flag.
Gets the texture's magnification filter.
The filter, or null when unset.
Sets the texture's magnification filter, used when the texture is displayed larger than its
source size. Applies to texture and textureatlas assets, both when the texture is
created and after it has loaded.
The filter, or null to use the engine default of 'linear'.
Gets the texture's minification filter.
The filter, or null when unset.
Sets the texture's minification filter, used when the texture is displayed smaller than its
source size. The mip variants blend within (and, for the second linear, between) mipmap
levels. Applies to texture and textureatlas assets, both when the texture is created
and after it has loaded.
The filter, or null to use the engine default of 'linear-mip-linear'.
Gets whether the texture generates and uses mipmaps.
The mipmaps flag, or null when unset.
Sets whether the texture generates and uses mipmaps. Changing this on a loaded texture
recreates the underlying GPU resource, so prefer declaring it up front. Applies to
texture and textureatlas assets.
The mipmaps flag, or null to use the engine default of true.
Gets whether the texture holds sRGB (gamma-encoded) color data.
The sRGB flag, or null when unset.
Sets whether the texture holds sRGB (gamma-encoded) color data, enabling hardware gamma
decode. Free when set before the texture loads; changing it on a loaded texture recreates
the underlying GPU resource. Applies to texture and textureatlas assets.
The sRGB flag, or null to use the engine default of false.
Protected_Called when the element is fully initialized and ready. Subclasses should call this when
they're ready. Resolves the ready promise and dispatches a bubbling, composed ready
event. Signals at most once per readiness cycle: a repeat call before _resetReady
has re-armed the promise does nothing.
Protected_Returns the ready promise to its pending state. Subclasses should call this when the
resource their readiness announced is torn down (typically from disconnectedCallback),
so that a later re-initialization can signal readiness again. Does nothing while the
promise is still pending — an in-flight waiter carries over to the next readiness cycle
rather than being stranded on a promise nothing will ever resolve.
Returns a promise that resolves with this element when it's ready. This is the low-level primitive underlying whenReady, which is the recommended way to wait for elements.
Readiness tracks the element's current lifecycle: once a ready element is torn down (for example by removing it from the document), this returns a fresh promise that resolves when the element is next ready. A promise obtained earlier stays resolved — call this again after re-inserting an element rather than reusing a promise from before its removal.
A promise that resolves with this element when it's ready.
Staticget
The AssetElement interface provides properties and methods for manipulating
<pc-asset>elements. The AssetElement interface also inherits the properties and methods of the HTMLElement interface.The element becomes ready once the containing application has started and the asset is in the state declared by the markup: loaded for preloaded assets (even if loading failed — check the asset's
resource), or registered and awaiting a load forlazyassets. Elements inserted while the application is running are created and registered on insertion, and begin loading immediately unlesslazy. Apc-assetmust be a direct child ofpc-app— elements placed elsewhere, or with an unsupported asset type, never become ready.A
lazyasset loads on first use: the first time any element resolves it byid— a model, a material map, a sky, a scriptasset:reference — or when thelazyattribute is removed, whichever comes first. Until then it stays registered and unloaded.For
textureandtextureatlasassets, the texture options (address-u,address-v,min-filter,mag-filter,anisotropy,mipmaps,srgb,flip-y) apply when the texture is created and — likelazy— are observed: changing one updates a texture that has already loaded, and removing one restores the engine default. Changingsrgbormipmapson a loaded texture recreates the underlying GPU resource, so prefer declaring those up front. Each option overrides the matching key in thedataJSON; options left unset write nothing, leaving the engine's per-format defaults in force.Apart from
lazyand the texture options, these attributes are read once when the asset is created, so changing them later has no effect.Attribute
id - The identifier used to reference the asset from other elements.
Attribute
src - The URL of the asset to load.
Attribute
type - The asset type. Inferred from the
srcfile extension when omitted.Attribute
data - Additional asset data, as a JSON object.
Attribute
atlas - For a
spriteasset, theidof the texture atlas asset it uses. The atlas must be declared before the sprite.Attribute
frame-keys - For a
spriteasset, the atlas frame keys it uses, separated by spaces or commas.Attribute
pixels-per-unit - For a
spriteasset, the number of pixels per world unit.Attribute
render-mode - For a
spriteasset, how the sprite is rendered when resized.Fires
load - Fired each time the asset finishes loading, including a
lazyasset loaded later and any subsequent reloads. Does not bubble — listen on this element, or use a capture-phase listener on an ancestor to observe every asset.Fires
error - Fired when the asset fails to load, with the engine's error in
message. Does not bubble. The element still becomes ready — readiness means the load settled, not that it succeeded.