HomeWeb Components API Reference - v0.17.0
    Preparing search index...

    Class AnimClipElement

    The AnimClipElement interface provides properties and methods for manipulating <pc-anim-clip> elements. The AnimClipElement interface also inherits the properties and methods of the HTMLElement interface.

    A clip declares one named animation on its parent <pc-anim>. name is both the clip's name and the track looked up in the clip's source: an explicit asset (a container, an animation .glb, or an animclip JSON), or, without one, the container of the <pc-model> enclosing the parent <pc-anim>. A source holding a single track supplies it whatever it is named; in a multi-track source the track named name is chosen, falling back to the first with a warning. The element becomes ready once its resolved track is assigned.

    Hierarchy (View Summary)

    Index
    • get asset(): string

      Gets the id of the pc-asset supplying the clip's track.

      Returns string

      The asset id.

    • set asset(value: string): void

      Sets the id of the pc-asset supplying the clip's track: a container, an animation .glb, or an animclip JSON. When empty, the track comes from the container of the <pc-model> enclosing the parent <pc-anim>.

      Parameters

      • value: string

        The asset id.

      Returns void

    • get closestApp(): AppElement | null

      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.

      Returns AppElement | null

      The closest app element, or null.

    • get closestEntity(): EntityBaseElement | 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.

      Returns EntityBaseElement | null

      The closest entity-fronting element, or null.

    • get loop(): boolean

      Gets whether the clip loops.

      Returns boolean

      Whether the clip loops.

    • set loop(value: boolean): void

      Sets whether the clip loops. A non-looping clip holds its last pose when it ends — the engine reports no completion. Defaults to true.

      Parameters

      • value: boolean

        Whether the clip loops.

      Returns void

    • get name(): string

      Gets the name of the clip.

      Returns string

      The clip name.

    • set name(value: string): void

      Sets the name of the clip: the name it is played by, and the track looked up in the clip's source. Names must be unique within a <pc-anim> and must not contain ..

      Parameters

      • value: string

        The clip name.

      Returns void

    • get speed(): number

      Gets the playback speed of the clip.

      Returns number

      The playback speed.

    • set speed(value: number): void

      Sets the playback speed of the clip, where negative values play it backwards. Applies immediately, preserving the playhead. Defaults to 1.

      Parameters

      • value: number

        The playback speed.

      Returns void

    • 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.

      Returns void

    • 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 void

    • 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.

      Returns Promise<AnimClipElement>

      A promise that resolves with this element when it's ready.