# MorphInstance

Class · category: Graphics

Source: https://github.com/playcanvas/engine/blob/f059dc005842f76e052cdf44d8370c8c7ec475ac/src/scene/morph-instance.js#L20

An instance of [Morph](https://api.playcanvas.com/engine/classes/Morph.md). Contains weights to assign to every [MorphTarget](https://api.playcanvas.com/engine/classes/MorphTarget.md), manages
selection of active morph targets.

## Constructors

### constructor

```ts
new MorphInstance(morph: Morph)
```

Create a new MorphInstance instance.

**Parameters**

- `morph` ([`Morph`](https://api.playcanvas.com/engine/classes/Morph.md)): The [Morph](https://api.playcanvas.com/engine/classes/Morph.md) to instance.

## Properties

### morph

```ts
morph: Morph
```

The morph with its targets, which is being instanced.

## Methods

### clone

```ts
clone(): MorphInstance
```

Clones a MorphInstance. The returned clone uses the same [Morph](https://api.playcanvas.com/engine/classes/Morph.md) and weights are set
to defaults.

**Returns** [`MorphInstance`](https://api.playcanvas.com/engine/classes/MorphInstance.md): A clone of the specified MorphInstance.

### destroy

```ts
destroy(): void
```

Frees video memory allocated by this object.

### getWeight

```ts
getWeight(key: string | number): number
```

Gets current weight of the specified morph target.

**Parameters**

- `key` (`string | number`): An identifier for the morph target. Either the weight index or
  the weight name.

**Returns** `number`: Weight.

### setWeight

```ts
setWeight(key: string | number, weight: number): void
```

Sets weight of the specified morph target.

**Parameters**

- `key` (`string | number`): An identifier for the morph target. Either the weight index or
  the weight name.
- `weight` (`number`): Weight.

### update

```ts
update(): void
```

Selects active morph targets and prepares morph for rendering. Called automatically by
renderer.
