---
title: transformModel
slug: viewer-2d/methods/transformModel
docTags: 
createdAt: 2024-02-21T14:33:53.990Z
---

Applies a transformation to the specified model.

:::hint{type="info"}
The transformation is always relative to the default model transform. This is an absolute position and zero rotation.
:::

## Example

::codepen{url="https://codepen.io/Catenda/embed/QWXqeda"}

## Usage

```javascript
const modelId = "my-model-id";
const transform = {
  position: {
    x: 1.0,
    y: 1.0,
    z: 0.0
  },
  rotation: {
    centerOfRotation: {
      x: 1.0,
      y: 0.0,
      z: 0.0
    },
    angle: 3.14
  }
};

viewer2d.transformModel(modelId, transform);
```

## Parameters

### modelId

Id of the model to transform.

| **Type** | **Required** |
| -------- | ------------ |
| String   | Yes          |

### transform

Transformation to apply.

| **Type** | **Required** |
| -------- | ------------ |
| Object   | Yes          |

**Properties**

| **Name**   | **Type**                                | **Required** | **Description**     |
| ---------- | --------------------------------------- | ------------ | ------------------- |
| `position` | [Vector3](docId\:gQdK6kHl9IuzRieGxVDD0) | No           | Position to move to |
| `rotation` | Rotation                                | No           | Rotation transform  |

**Rotation**

| **Name**           | **Type**                                | **Required** | **Description**      |
| ------------------ | --------------------------------------- | ------------ | -------------------- |
| `angle`            | Number                                  | Yes          | Angle in radians     |
| `centerOfRotation` | [Vector3](docId\:gQdK6kHl9IuzRieGxVDD0) | Yes          | Point to rotate over |

