# `Camera.autoRotate`

> Contract 2.0.0 · package sha256 `a857eca95b35921109faf997094bb4192f12527d9d0fcd4be7e97f06425bad6e` · generated from `configurator-runtime.d.ts` by `services/onsite-scripter/scripts/build-contract-docs.mjs`; edit the source, not this file.

Method of [`Camera`](Camera.md) · stable · since 2.0.0 · called as `session.camera.autoRotate`

```ts
autoRotate(degPerSecond: number | null, options?: CameraCommitOptions<C> & SignalOption): Promise<Report>;
```

null stops. Degrees per second; positive grows `azimuthDeg` (counter-clockwise seen from
above). Open-ended: resolves once the rotation has started; [`idle()`](Session.idle.md)
and [`capture()`](Session.capture.md) ignore it. A shopper's pointer or touch gesture (not a wheel) pauses it from
'camera:control-start' and it resumes at 'camera:control-end' from the pose the gesture left. A view move ([`set`](Camera.set.md),
[`fit`](Camera.fit.md), `views.go`) pauses it while the move runs, and it resumes from the landed view: the
rotation and the view are separate targets. It pauses while the page is hidden or the boot
`el` lies wholly outside the viewport.

## Options

Through [`Session`](Session.md):

| Option | Type | Default | What it does |
| --- | --- | --- | --- |
| `actor` | `Actor` | the `expectGroup`'s actor when one is given, else 'app' | Who made the write. |
| `expectRevision` | `number` | undefined (no check) | If-match on [`session.revision`](Session.revision.md). |
| `origin` | `string` | null | Your tag, echoed unchanged in [`Report.origin`](ReportFields.origin.md) and `cause.origin`. |
| `signal` | `AbortSignal` | undefined | Cancels this call; the member's JSDoc says what an abort does. |

Refused here (typed `never`, so passing one fails to compile): `dryRun`, `expectGroup`, `supersede`, `undo`.

Through [`Tx`](Tx.md):

| Option | Type | Default | What it does |
| --- | --- | --- | --- |
| `signal` | `AbortSignal` | undefined | Cancels this call; the member's JSDoc says what an abort does. |

Refused here (typed `never`, so passing one fails to compile): `actor`, `checkpoint`, `dryRun`, `expectGroup`, `expectRevision`, `origin`, `supersede`, `undo`.

## Abort (`signal`)

This call is a write (`SignalOption.signal`, [the kinds of call](../read-this-first.md#conventions)).

> A write: before the commit point it rolls back and rejects AbortError; after it, no effect, except that a running camera move stops where the last frame drew it (`CameraMoveOptions`).
>
> Through a `tx` the commit point is the transaction's: aborting a write still loading rejects AbortError and stages nothing (catch it: unobserved, it rolls the transaction back, spec section 6.1, O6); aborting one already staged unstages it, its paths keeping the latest other write to them as after a failed savepoint (O7), and its Promise stays resolved 'staged'.

## Example

Imports: values (`has`, `validate`, the `Holo*Error` classes, the pure helpers) from `@holostep-configurators/runtime-client`, types from `@holostep-configurators/runtime-client/contract`, `/math` and `/testing` names from those entries; `boot` from the runtime module the root's `loadRuntimeAtFloor` resolves to. A type your page defines is your app's: declare it there, never import it from the package.

Compiled under the contract's strict settings (`examples/declaration/10-Camera.autoRotate.ts`):

```ts
import type { Session } from '@holostep-configurators/runtime-client/contract';
declare const session: Session;
declare const signal: AbortSignal;
await session.camera.autoRotate(12);       // resolves once started, never "when done"
await session.idle({ signal });            // doesn't wait for the rotation
await session.camera.autoRotate(null);     // stop
```

## Generic-API test (spec 3.1)

| Rule | Result |
| --- | --- |
| 1. Neutral name | pass: `autoRotate` names no product |
| 2. A precedent | pass: [model-viewer (ar, camera-orbit, auto-rotate)](https://modelviewer.dev/docs/) (row `G37`); [Unity Camera.fieldOfView](https://docs.unity3d.com/ScriptReference/Camera-fieldOfView.html) (row `K40`); [Unity Camera.lensShift](https://docs.unity3d.com/ScriptReference/Camera-lensShift.html) (row `K40`); [Babylon.js ArcRotateCamera limits](https://github.com/BabylonJS/Babylon.js/blob/master/packages/dev/core/src/Cameras/arcRotateCamera.ts) (row `K40`) |
| 3. Two apps, or labs | pass: 21 apps (ledger: app-378d190f1b, app-59c5b5751e, app-b4ae2fce25, app-bcb7ef21da, app-ddfb017681, app-e3b47169bc, app-e61a0b42ad, app-fd09090420; fleet cross-check: app-04c2774145, app-0c773a4ee3, app-37356bf09f, app-378d190f1b, app-4762caacdc, app-4f16d2f6da, app-510d750508, app-59c5b5751e and 13 more) |
| 4. The cheaper fix first | decided per need in Appendix B: rows `G37`, `K40` at tier stable (a member only where no rule, data, asset or app code serves the need) |
