2021-11-23 17:39:45 +01:00
{.section-title.accent.text-primary}
# API Camera functions Reference
2021-12-08 10:05:46 +01:00
### Listen to camera updates
2021-11-23 17:39:45 +01:00
```
WA.camera.onCameraUpdate(callback: WasCameraUpdatedEventCallback): void
```
2021-12-08 10:06:07 +01:00
Listens to updates of the camera viewport. It will trigger for every update of the camera's properties (position or scale for instance). An event will be sent.
2021-11-23 17:39:45 +01:00
The event has the following attributes :
* **x (number):** coordinate X of the camera's world view (the area looked at by the camera).
* **y (number):** coordinate Y of the camera's world view.
* **width (number):** the width of the camera's world view.
* **height (number):** the height of the camera's world view.
**callback:** the function that will be called when the camera is updated.
Example :
```javascript
WA.camera.onCameraUpdate((worldView) => console.log(worldView));
```