---
title: viewer3d.viewpoint
slug: viewer-3d/events/viewpoint
docTags: 
createdAt: 2024-03-01T14:15:15.678Z
---

Invoked when the **Viewpoint** changes.

:::hint{type="info"}
The **Viewpoint** simulates the position of a camera looking at the scene.
:::

## Example

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

## Usage

:::CodeblockTabs
```javascript
const onViewpointChange = function (event) {
  const { viewpoint } = event;
  console.log("viewer3d.viewpoint", "viewpoint:", viewpoint);
};

viewer3d.addEventListener("viewer3d.viewpoint", onViewpointChange);
```

jQuery

```javascript
const onViewpointChange = function (event, viewpoint) {
  console.log("viewer.viewpoint", "viewpoint:", viewpoint);
};

$("#viewer-3d").on("viewer.viewpoint", onViewpointChange);
```
:::

## Parameters

### onViewpointChange

::::Tabs
:::Tab{title="JS"}
Function called when the **Viewpoint** changes.

| **Type**                  |
| ------------------------- |
| `(event: Object) => Void` |

**event**

| **Name**    | **Type** | **Description**       |
| ----------- | -------- | --------------------- |
| `viewpoint` | Object   | The current viewpoint |

**Orthogonal Viewpoint**

| **Name**           | **Type**                                | **Description**                                     |
| ------------------ | --------------------------------------- | --------------------------------------------------- |
| `aspectRatio`      | Number                                  | Aspect ratio of the scene                           |
| `direction`        | [Vector3](docId\:kEwRHKTC8Iq2HlT48sRFQ) | Direction of the camera                             |
| `location`         | [Vector3](docId\:kEwRHKTC8Iq2HlT48sRFQ) | Location of the camera                              |
| `type`             | String                                  | Value is `orthogonal`                               |
| `up`               | [Vector3](docId\:kEwRHKTC8Iq2HlT48sRFQ) | Normalized vector describing the camera orientation |
| `viewToWorldScale` | Number                                  | The scale factor between the camera and the scene   |

**Perspective Viewpoint**

| **Name**      | **Type**                                | **Description**                                     |
| ------------- | --------------------------------------- | --------------------------------------------------- |
| `aspectRatio` | Number                                  | Aspect ratio of the scene                           |
| `direction`   | @vector3                                | Direction of the camera                             |
| `fov`         | Number                                  | Field of view of the camera                         |
| `location`    | [Vector3](docId\:kEwRHKTC8Iq2HlT48sRFQ) | Location of the camera                              |
| `type`        | String                                  | Value is `perspective`                              |
| `up`          | [Vector3](docId\:kEwRHKTC8Iq2HlT48sRFQ) | Normalized vector describing the camera orientation |
:::

:::Tab{title="jQuery"}
Function called when the **Viewpoint** changes.

| **Type**                                     |
| -------------------------------------------- |
| `(event: Object, viewpoint: Object) => Void` |

**event**

[jQuery.Event](https://api.jquery.com/category/events/event-object/)

**Orthogonal Viewpoint**

| **Name**           | **Type**                                | **Description**                                     |
| ------------------ | --------------------------------------- | --------------------------------------------------- |
| `aspectRatio`      | Number                                  | Aspect ratio of the scene                           |
| `direction`        | [Vector3](docId\:kEwRHKTC8Iq2HlT48sRFQ) | Direction of the camera                             |
| `location`         | [Vector3](docId\:kEwRHKTC8Iq2HlT48sRFQ) | Location of the camera                              |
| `type`             | String                                  | Value is `orthogonal`                               |
| `up`               | [Vector3](docId\:kEwRHKTC8Iq2HlT48sRFQ) | Normalized vector describing the camera orientation |
| `viewToWorldScale` | Number                                  | The scale factor between the camera and the scene   |

**Perspective Viewpoint**

| **Name**      | **Type**                                | **Description**                                     |
| ------------- | --------------------------------------- | --------------------------------------------------- |
| `aspectRatio` | Number                                  | Aspect ratio of the scene                           |
| `direction`   | [Vector3](docId\:gQdK6kHl9IuzRieGxVDD0) | Direction of the camera                             |
| `fov`         | Number                                  | Field of view of the camera                         |
| `location`    | [Vector3](docId\:kEwRHKTC8Iq2HlT48sRFQ) | Location of the camera                              |
| `type`        | String                                  | Value is `perspective`                              |
| `up`          | [Vector3](docId\:kEwRHKTC8Iq2HlT48sRFQ) | Normalized vector describing the camera orientation |
:::
::::

