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

WHS.Morph is a class for loading animated models or meshes.

WHS.Morph is used for creating animated object's that doesn't support physics. Off course you can make your own class, based on WHS.MeshComponent that will run animation and support physics. But you will need to update your geometry in Physi.js each time you update anmation. Physi.js currently provides physic only for static geometries.

const morph = new WHS.Morph( {
  geometry: {
    path: "assets/models/morph/parrot.js"
  },

  material: {
    kind: 'basic',
    useVertexColors: true
  },

  scale: [0.1, 0.1, 0.1],

  morph: {
    duration: 0.5,
    speed: 250
  }
});

morph.addTo(world);

Parameters

Geometry defaults

{
  // ...

  geometry: {
    path: '', // String. (Url)
    loader: JSONLoader // Three.js loader.
  },

  morph: {
    duration: 1, // Number. (Time in seconds)
    speed: 100 // Number
  }
}

These defaults are additional, there are also defaults filled by MeshComponent, etc.

Instructions

{
  // ...

  geometry: ['path', 'loader'],
  morph: ['duration', 'speed']
}