These docs are for v1.2. Click to read the latest docs for v2-beta.x.

Element is a wrapper around WHS.Component for use with Three.js meshes. If you want to make a component from Three.js light, mesh, camera or something else - use WHS.Element.

const sphere = new WHS.Element(
  new THREE.Mesh(
    new THREE.SphereGeometry(3, 32, 32),
    new THREE.MeshBasicMaterial({color: 0xff0000})
  ),
  [WHS.MeshComponent]
);

Structure

new WHS.Element(
  // [Object3D],
  // [Array of Component decorators in the right order]
)