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

Applies a rotation to the viewer.

:::hint{type="info"}
The rotation is always relative to the initial model state.
:::

## Example

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

## Usage

```javascript
const rotation = 90;

viewer2d.setRotation(rotation);
```

## Parameters

### rotation

Rotation to apply in degrees.

| **Type** | **Required** |
| -------- | ------------ |
| Number   | Yes          |

