d3105fa207
* chore: Upgrade a lot of dependencies for `./` * chore: Upgrade a lot of dependencies for `./example` * chore: Upgrade a lot of dependencies for `./docs` * Use new `EventEmitter` syntax (`.remove()`) * Update Podfile.lock * docs: Use watch mode * docs: Replace all relative links with absolute * Fix all links * Update docusaurus.config.js * Upgrade docusaurus-plugin-typedoc to fix docs build * Update yarn.lock * Upgrade typescript to 4.4.3 * Fix error unknown * Update package.json * Upgrade typedoc * Upgrade a few more deps * Fix deprecated sidebar syntax * Update Gemfile.lock
26 lines
1.2 KiB
Plaintext
26 lines
1.2 KiB
Plaintext
---
|
|
id: focusing
|
|
title: Focusing
|
|
sidebar_label: Focusing
|
|
---
|
|
|
|
To focus the camera to a specific point, simply use the Camera's [`focus(...)`](/docs/api/classes/Camera#focus) function:
|
|
|
|
```ts
|
|
await camera.current.focus({ x: tapEvent.x, y: tapEvent.y })
|
|
```
|
|
|
|
The focus function expects a [`Point`](/docs/api/interfaces/Point) parameter which represents the location relative to the Camera view where you want to focus the Camera to (in _points_). If you use [react-native-gesture-handler](https://docs.swmansion.com/react-native-gesture-handler/), this will consist of the [`x`](https://docs.swmansion.com/react-native-gesture-handler/docs/api/gesture-handlers/tap-gh#x) and [`y`](https://docs.swmansion.com/react-native-gesture-handler/docs/api/gesture-handlers/tap-gh#y) properties of the tap event payload.
|
|
|
|
So for example, `{ x: 0, y: 0 }` will focus to the upper left corner, while `{ x: CAM_WIDTH, y: CAM_HEIGHT }` will focus to the bottom right corner.
|
|
|
|
Focussing adjusts auto-focus (AF) and auto-exposure (AE).
|
|
|
|
:::note
|
|
`focus(...)` will fail if the selected Camera device does not support focusing (see [`CameraDevice.supportsFocus`](/docs/api/interfaces/CameraDevice#supportsfocus))
|
|
:::
|
|
|
|
<br />
|
|
|
|
#### 🚀 Next section: [Camera Errors](errors)
|