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

    Class AnimComponentElement

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

    The element drives animation clips over the host entity's hierarchy. Clips come from <pc-anim-clip> children — or, when the element is a direct child of a <pc-model> and declares no clips, every animation of that model's container asset is assigned, named by track name, in container order. The first clip plays automatically (opt out with activate="false"); switch clips declaratively through the clip attribute, or imperatively through play and transition. Tracks bind to scene nodes by name, so any hierarchy whose node names match a clip's curves can be animated — a model's skeleton is simply the common case.

    The engine reports no clip completion: a non-looping clip holds its last pose silently. Poll the underlying AnimComponent (via component) for playback state beyond what this element exposes.

    Engine component: AnimComponent (anim).

    Hierarchy (View Summary)

    Index
    • get activate(): boolean

      Gets whether playback starts automatically once a clip is assigned.

      Returns boolean

      Whether playback starts automatically.

    • set activate(value: boolean): void

      Sets whether playback starts automatically once a clip is assigned. Defaults to true. Applies when clips are assigned — it does not stop a clip that is already playing.

      Parameters

      • value: boolean

        Whether playback starts automatically.

      Returns void

    • get clip(): string

      Gets the name of the active clip.

      Returns string

      The name of the active clip.

    • set clip(value: string): void

      Sets the name of the active clip. Changing it switches playback, cross-fading over transition-time seconds (a hard cut at 0). An empty value leaves the current clip playing; a name that matches no clip warns and leaves the selection unchanged.

      Parameters

      • value: string

        The name of the active clip.

      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 enabled(): boolean

      Gets the enabled state of the component.

      Returns boolean

      The enabled state of the component.

    • set enabled(value: boolean): void

      Sets the enabled state of the component.

      Parameters

      • value: boolean

        The enabled state of the component.

      Returns void

    • get speed(): number

      Gets the playback speed multiplier applied across all clips.

      Returns number

      The playback speed multiplier.

    • set speed(value: number): void

      Sets the playback speed multiplier applied across all clips, where 0 freezes playback. Defaults to 1.

      Parameters

      • value: number

        The playback speed multiplier.

      Returns void

    • get transitionTime(): number

      Gets the cross-fade duration of clip switches made through the clip attribute.

      Returns number

      The cross-fade duration in seconds.

    • set transitionTime(value: number): void

      Sets the cross-fade duration of clip switches made through the clip attribute, in seconds. Defaults to 0 (a hard cut).

      Parameters

      • value: number

        The cross-fade duration in seconds.

      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

    • Resumes playback, optionally switching to a named clip first (a hard cut). A name that matches no clip leaves the selection unchanged.

      Parameters

      • Optionalname: string

        The name of the clip to play. Resumes the current clip when omitted.

      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<AnimComponentElement>

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

    • Cross-fades to a named clip and ensures playback is running. A name that matches no clip leaves the selection unchanged.

      Parameters

      • name: string

        The name of the clip to fade to.

      • Optionaltime: number

        The fade duration in seconds. Defaults to the transition-time attribute.

      Returns void