Gets the id of the pc-asset of the sprite to render (simple sprites only).
The sprite asset id.
Sets the id of the pc-asset of the sprite to render (simple sprites only). An empty
value renders nothing.
The sprite asset id.
Gets the name of the clip to play (animated sprites only).
The clip name.
Sets the name of the clip to play (animated sprites only). Changing it switches playback,
and setting it again restarts a clip that has ended. The clip also plays whenever the
sprite is enabled again. An empty value leaves the current clip playing.
The clip name.
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.
Sets the color the sprite is tinted with. Its alpha is ignored - see opacity. Defaults
to white.
The tint color.
Gets the underlying PlayCanvas sprite component. null until the element is
ready — see ComponentElement.component.
The sprite component, or null.
Gets the enabled state of the component.
The enabled state of the component.
Sets the enabled state of the component.
The enabled state of the component.
Gets whether the sprite is mirrored horizontally.
Whether the sprite is flipped horizontally.
Sets whether the sprite is mirrored horizontally. Defaults to false.
Whether to flip the sprite horizontally.
Gets whether the sprite is mirrored vertically.
Whether the sprite is flipped vertically.
Sets whether the sprite is mirrored vertically. Defaults to false.
Whether to flip the sprite vertically.
Gets the index of the frame to render, as last set - on an animated sprite the playing clip
moves on from it, so component.frame is the frame on screen.
The frame index.
Sets the index of the frame to render, among the frame keys of the current sprite. On an
animated sprite it moves the playing clip to that frame, which plays on from there - but a
clip starting to play begins at its first frame, so a frame declared in markup has no
effect on an animated sprite. Defaults to 0.
The frame index.
Gets the height of the sprite in world units, used only when its sprite asset's
render-mode is sliced or tiled.
The height.
Sets the height of the sprite in world units, used only when its sprite asset's
render-mode is sliced or tiled. Defaults to 1.
The height.
Gets the opacity of the sprite.
The opacity.
Sets the opacity of the sprite, from 0 to 1. Defaults to 1.
The opacity.
Gets the playback speed multiplier applied to every clip.
The playback speed multiplier.
Sets the playback speed multiplier applied to every clip, where 0 freezes playback. Defaults to 1.
The playback speed multiplier.
Gets the type of the sprite: simple or animated.
The sprite type.
Sets the type of the sprite. Can be:
simple - Renders one frame of the sprite asset.animated - Plays the <pc-sprite-clip> children, starting with the one named by clip.Defaults to simple.
The sprite type.
Gets the width of the sprite in world units, used only when its sprite asset's
render-mode is sliced or tiled.
The width.
Sets the width of the sprite in world units, used only when its sprite asset's
render-mode is sliced or tiled. Defaults to 1.
The width.
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.
ProtectedgetReturns the data the component is created with. Overridden by subclasses to supply the
initial values of their cached properties. The element's enabled state is not among them:
the base class adds it when it creates the component.
The initial component data.
ProtectedinitConfigures the newly added component. Overridden by subclasses whose setup goes beyond the initial data — child-element handling, asset resolution and the like.
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.
The SpriteComponentElement interface provides properties and methods for manipulating
<pc-sprite>elements. The SpriteComponentElement interface also inherits the properties and methods of the HTMLElement interface.A
simplesprite (the default) renders one frame of the spriteassetit names. Ananimatedsprite plays its<pc-sprite-clip>children instead, each a named clip with a sprite asset of its own: theclipattribute names the one that plays, and changing it switches playback. Sprites are unlit, and render as transparent geometry in the world layer.Engine component: SpriteComponent (
sprite).