---
title: "directionFrame"
description: "The two axes of a direction given in degrees, for patterns that run along it."
group: "space"
groupTitle: "Shapes, frames & warps"
categoryId: "frames"
categorySlug: "frames"
categoryTitle: "Frames & coordinates"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/frames.ts#L194"
---

# directionFrame

The two axes of a direction given in degrees, for patterns that run along it.

```ts
directionFrame(angleDeg: Expr | number, hint: string = 'grain'): DirectionFrame
```

Import `frames` from `shaders/std` and use `frames.directionFrame`.

`tangent` points along the direction, `perp` at right angles to it. `coordsOf(point)` returns that point's `along` and `across` distances in the frame. Brush grain, weave, streaks and flow all live in one of these.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `angleDeg` | `Expr \| number` |  |
| `hint` | `string` | Optional. Default `'grain'`. |

## Example

```ts
const grain = directionFrame(params.uniforms.brushAngle, 'brush'); const {along, across} = grain.coordsOf(delta)
```

## See also

- [`direction`](/docs/primitives/frames/direction) — A direction in degrees as a unit vector.
- [`segmentFrame`](/docs/primitives/frames/segmentframe) — A frame along the line between two position props: how far each pixel is along it and across it.

## Used by

[BrushedMetal](/docs/components/brushedmetal), [CarbonFiber](/docs/components/carbonfiber), [Heatmap](/docs/components/heatmap), [Obsidian](/docs/components/obsidian), [Satin](/docs/components/satin)