---
title: "rotationSensor"
description: "How far a 3D shape has rotated, as a 2D pan you can move content by."
group: "light"
groupTitle: "Noise, light & materials"
categoryId: "materials"
categorySlug: "materials"
categoryTitle: "Materials & surfaces"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/paint/materials.ts#L1106"
---

# rotationSensor

How far a 3D shape has rotated, as a 2D pan you can move content by.

```ts
rotationSensor(frame: SurfaceFrame): {x: Expr; y: Expr}
```

Import `materials` from `shaders/std` and use `materials.rotationSensor`.

Zero on flat shapes and on any shape at rest, growing as the shape turns. Constant across the frame, so it pans a star field or a backdrop without shearing it. Needs `pattern: 'raw'`.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `frame` | `SurfaceFrame` |  |

## Example

```ts
const pan = rotationSensor(frame)
```

## See also

- [`shellRefract`](/docs/primitives/materials/shellrefract) — Coordinates for what sits inside a glass shell, bent where the shell curves.
- [`surfacePattern`](/docs/primitives/materials/surfacepattern) — Coordinates for a pattern that sticks to the shape's surface.

## Used by

[Nebula](/docs/components/nebula)