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

    Web Components API Reference - v0.23.0

    The @playcanvas/web-components package provides a set of custom HTML elements for building 3D web apps with the PlayCanvas Engine. The elements are normally authored declaratively in HTML, which the User Manual covers. This reference covers their JavaScript API: the element classes, whose properties mirror their attributes and expose the engine objects behind them, and the whenReady function that waits for an element to finish initializing.

    The elements at the top of every document: <pc-app>, which creates the application and the canvas it renders into, the <pc-scene> it renders, and the <pc-sky> behind that scene.

    AppElement
    SceneElement
    SkyElement

    The elements declared directly under <pc-app> for the scene to draw on: <pc-asset> and <pc-material>, which other elements reference by id, and <pc-wasm>, which loads a WebAssembly module the engine needs before the application starts.

    AssetElement
    MaterialElement
    WasmElement

    The elements that front an engine entity and host component elements. <pc-entity> and <pc-model> create their entity; <pc-node> binds to one inside the hierarchy a model instantiated.

    EntityElement
    ModelElement
    NodeElement

    The elements that add an engine component to the entity above them, and the repeatable children three of them take: <pc-anim-clip> under <pc-anim>, <pc-script-instance> under <pc-script> and <pc-sound-slot> under <pc-sound>.

    AnimClipElement
    AnimComponentElement
    AudioListenerComponentElement
    ButtonComponentElement
    CameraComponentElement
    CollisionComponentElement
    ElementComponentElement
    GSplatComponentElement
    JointComponentElement
    LayoutChildComponentElement
    LayoutGroupComponentElement
    LightComponentElement
    ParticleSystemComponentElement
    RenderComponentElement
    RigidBodyComponentElement
    ScreenComponentElement
    ScriptComponentElement
    ScriptInstanceElement
    ScrollbarComponentElement
    ScrollViewComponentElement
    SoundComponentElement
    SoundSlotElement

    The classes the elements extend. None registers a tag of its own; each holds the members the elements of its kind inherit, such as ready(), closestApp, entity and component.

    AsyncElement
    ComponentElement
    EntityBaseElement
    EntityOwnerElement

    Helpers for driving the elements from JavaScript. whenReady waits for an element to finish initializing and resolves with it.

    whenReady

    The string unions and plain-data shapes used by the element properties and by whenReady.

    AddressMode
    AsyncElementTagName
    BlendType
    ColorChannel
    CullMode
    FresnelModel
    HierarchyMaterial
    HierarchyNode
    JointType
    LightShape
    MagFilterMode
    MaterialOverrides
    MinFilterMode
    MotionMode
    NodeBindingState
    OccludeSpecular
    OpacityDither
    ScalarChannel