---
title: "surfaceOf"
description: "The canvas a generator paints on: its `uv`, its `viewport` size in pixels and its `aspect`."
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#L35"
---

# surfaceOf

The canvas a generator paints on: its `uv`, its `viewport` size in pixels and its `aspect`.

```ts
surfaceOf(params: GpuFragmentParams): {uv: Expr; viewport: Expr; aspect: Expr}
```

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

`uv` runs 0–1 across the layer, y down. `aspect` is width over height. When a parent fits the layer into a box, `viewport` and `aspect` describe that box. Every frame takes this as its second argument.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `params` | `GpuFragmentParams` |  |

## Example

```ts
paint: (params) => { const {uv, viewport, aspect} = surfaceOf(params); … }
```

## See also

- [`rawSurfaceOf`](/docs/primitives/frames/rawsurfaceof) — The canvas like `surfaceOf`, but always measured against the whole canvas, never a fitted box.
- [`centredFrame`](/docs/primitives/frames/centredframe) — A frame centred on a position prop: each pixel's offset from the centre and its distance.
- [`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

[Aurora](/docs/components/aurora), [FlowingGradient](/docs/components/flowinggradient), [Marble](/docs/components/marble), [MeshGradient](/docs/components/meshgradient), [Prism](/docs/components/prism), [Satin](/docs/components/satin), [StudioBackground](/docs/components/studiobackground), [Waveform](/docs/components/waveform)