---
title: "uniformOf"
description: "The live GPU value of a prop, for a hand-written builder: `uniformOf(p('radius'), params)`."
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#L113"
---

# uniformOf

The live GPU value of a prop, for a hand-written builder: `uniformOf(p('radius'), params)`.

```ts
uniformOf(ref: PropRef, params: {uniforms: Record<string, Expr>}): Expr
```

Import `uniformOf` from `shaders/std`.

Colors come back as `vec4f` in linear RGB with alpha, positions as `vec2f`, numbers as `f32`. Read a part with `.member('rgb')` or `.member('x')`. Throws when the name is not one of the definition's props.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `ref` | `PropRef` |  |
| `params` | `{uniforms: Record<string, Expr>}` |  |

## Example

```ts
paint: (params) => {
  const color = uniformOf(p('color'), params)
  const gain = mul(uniformOf(p('intensity'), params), 0.5)
  return vec4(mul(color.member('rgb'), gain), color.member('a'))
}
```

> **Tip.** A position prop's y is stored flipped: use `sub(1, center.member('y'))` to compare it with `uv`.

## See also

- [`p`](/docs/primitives/values/p) — Reference one of the definition's props by name, wherever a word asks for a value.
- [`resolveScalar`](/docs/primitives/invoke/resolvescalar) — A `Scalar` or prop ref as a GPU value, for a hand-written builder.
- [`resolveArg`](/docs/primitives/invoke/resolvearg) — Any input value a word accepts (a prop ref, a `Scalar`, a context token, a number) as a GPU value inside a filter's builder.
- [`paintFrame`](/docs/primitives/invoke/paintframe) — The coordinate and frame size a hand-written `paint:` builder should draw in.

## Used by

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