---
title: "centredFrame"
description: "A frame centred on a position prop: each pixel's offset from the centre and its distance."
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#L86"
---

# centredFrame

A frame centred on a position prop: each pixel's offset from the centre and its distance.

```ts
centredFrame(slots: {center: PropRef}): (params: GpuFragmentParams, surface: { uv: Expr; aspect: Expr; }) => CentredFrame
```

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

Pass `{center: p('center')}` where `center` is a position prop. Call the result with `params` and a surface. Distances are aspect-corrected, so 1 is the canvas height and a circle stays round on a wide canvas.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `slots` | `{center: PropRef}` |  |

## Example

```ts
const {dist} = centredFrame({center: p('center')})(params, surfaceOf(params))
```

> **Tip.** `dist` is in canvas-height units: a radius of 0.5 reaches the top and bottom edges from the middle.

## See also

- [`segmentFrame`](/docs/primitives/frames/segmentframe) — A frame along the line between two position props: how far each pixel is along it and across it.
- [`surfaceOf`](/docs/primitives/frames/surfaceof) — The canvas a generator paints on: its `uv`, its `viewport` size in pixels and its `aspect`.
- [`rawSurfaceOf`](/docs/primitives/frames/rawsurfaceof) — The canvas like `surfaceOf`, but always measured against the whole canvas, never a fitted box.

## Used by

[Blob](/docs/components/blob)