Options
All
  • Public
  • Public/Protected
  • All
Menu

The ThreeElement class extends BaseElement with some code that manages an instance of a given Three.js class. It's the centerpiece of three-elements, with most elements provided by the library derived from it.

Type parameters

  • T = any

Hierarchy

Index

Constructors

constructor

Properties

Private Optional _object

_object: T

callbacks

callbacks: TickerCallbacks = ...

TICKER CALLBACKS

isMounted

isMounted: boolean = false

Static exposedProperties

exposedProperties: string[] = ...

A list of properties that can also be set through attributes on the element's tag. Attribute names are expected to be kebab-cased versions of the original property names (eg. "renderTick" can be set through the attribute "render-tick".)

Optional Static threeConstructor

threeConstructor: IConstructor<any>

Constructor that will instantiate our object.

Accessors

frameTick

  • Returns undefined | string | TickerFunction

  • Parameters

    Returns void

game

  • Returns the instance of ThreeGame that this element is nested under.

    Returns ThreeGame

htmlTagName

  • get htmlTagName(): string
  • Returns this element's tag name, formatted as an actual HTML tag (eg. "").

    Returns string

lateTick

  • Returns undefined | string | TickerFunction

  • Parameters

    Returns void

object

  • get object(): undefined | T
  • set object(v: undefined | T): void
  • The THREE.* object managed by this element.

    Returns undefined | T

  • The THREE.* object managed by this element.

    Parameters

    • v: undefined | T

    Returns void

renderTick

  • Returns undefined | string | TickerFunction

  • Parameters

    Returns void

scene

  • Returns the instance of ThreeScene that this element is nested under.

    Returns ThreeScene

tick

  • Returns undefined | string | TickerFunction

  • Parameters

    Returns void

Methods

Protected addObjectToParent

  • addObjectToParent(): void
  • Returns void

applyAllAttributes

  • applyAllAttributes(): void
  • Helper method that will make sure all attributes set on the element are passed through attributeChangedCallback. We mostly need this because of how we're not using observedAttributes.

    Returns void

attributeChangedCallback

  • attributeChangedCallback(key: string, oldValue: any, newValue: any): boolean

connectedCallback

  • connectedCallback(): void

Protected constructWrappedObject

  • constructWrappedObject(): undefined | T
  • Returns undefined | T

Protected debug

  • debug(...output: any): void
  • Parameters

    • Rest ...output: any

    Returns void

disconnectedCallback

  • disconnectedCallback(): void

Protected error

  • error(...output: any): void
  • Parameters

    • Rest ...output: any

    Returns void

find

  • find<T>(fn: (node: HTMLElement) => any): undefined | T
  • Takes a function, then walks up the node tree and returns the first node where the function returns true.

    Type parameters

    • T: HTMLElement

    Parameters

    • fn: (node: HTMLElement) => any
        • (node: HTMLElement): any
        • Parameters

          • node: HTMLElement

          Returns any

    Returns undefined | T

findElementWithInstanceOf

  • findElementWithInstanceOf<T>(constructor: IConstructor<any>): undefined | T
  • Type parameters

    • T = HTMLElement

    Parameters

    • constructor: IConstructor<any>

    Returns undefined | T

Protected handleAttach

  • handleAttach(): void
  • Returns void

mountedCallback

  • mountedCallback(): void

removedCallback

  • removedCallback(): void

requestFrame

  • requestFrame(): void

setAttribute

  • setAttribute(name: string, value: string): void
  • We're overloading setAttribute so it also invokes attributeChangedCallback. We do this because we can't realistically make use of observedAttributes (since we don't know at the time element classes are defined what properties their wrapped objects are exposing.)

    Parameters

    • name: string
    • value: string

    Returns void

Static for

  • for<T>(constructor: IConstructor<T>): IConstructor<ThreeElement<T>>
  • Type parameters

    • T

    Parameters

    • constructor: IConstructor<T>

    Returns IConstructor<ThreeElement<T>>

Generated using TypeDoc