---
title: "paintFrame"
description: "The coordinate and frame size a hand-written `paint:` builder should draw in."
group: "define"
groupTitle: "Defining a shader"
categoryId: "invoke"
categorySlug: "invoke"
categoryTitle: "Context & invocation"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/invoke.ts#L87"
---

# paintFrame

The coordinate and frame size a hand-written `paint:` builder should draw in.

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

Import `paintFrame` from `shaders/std`.

Returns `uv` and `viewport` as GPU values. Inside a distortion the uv is the distorted one, and inside a sized box the viewport is the box, so a generator built on these behaves like the library's own.

## Parameters

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

## Example

```ts
paint: (params) => {
  const {uv} = paintFrame(params)
  const center = uniformOf(p('center'), params)
  const d = length(sub(uv, vec2(center.member('x'), sub(1, center.member('y')))))
  return vec4(splat3(smoothstep(0, 0.5, d)), 1)
}
```

## See also

- [`ctx`](/docs/primitives/invoke/ctx) — The context values as tokens: `ctx.uv`, `ctx.time`, `ctx.aspect`, `ctx.pointer`, `ctx.viewportSize`, `ctx.logicalViewportSize`.
- [`uniformOf`](/docs/primitives/invoke/uniformof) — The live GPU value of a prop, for a hand-written builder: `uniformOf(p('radius'), params)`.