---
title: "local"
description: "A value computed once per pixel and shared by everything that reads it."
group: "space"
groupTitle: "Shapes, frames & warps"
categoryId: "math"
categorySlug: "math"
categoryTitle: "Math"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/math.ts#L562"
---

# local

A value computed once per pixel and shared by everything that reads it.

```ts
local(e: Expr, hint: string): Expr
```

Import `math` from `shaders/std` and use `math.local`.

Wrap any expression you use twice or more. `hint` is a short name that appears in the generated code and only has to be readable.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `e` | `Expr` |  |
| `hint` | `string` |  |

## Example

```ts
const dist = local(length(sub(uv, params.uniforms.center)), 'dist')
```

> **Tip.** Without it, the same math is repeated at every place you use the value.

## Used by

[Aurora](/docs/components/aurora), [Blob](/docs/components/blob), [BrushedMetal](/docs/components/brushedmetal), [CarbonFiber](/docs/components/carbonfiber), [Chrome](/docs/components/chrome), [CompressionArtifacts](/docs/components/compressionartifacts), [Crystal](/docs/components/crystal), [FlowingGradient](/docs/components/flowinggradient), [Frost](/docs/components/frost), [Goo](/docs/components/goo), [Heatmap](/docs/components/heatmap), [Hologram](/docs/components/hologram), [Holographic](/docs/components/holographic), [InkFlow](/docs/components/inkflow), [Irradiance](/docs/components/irradiance), [LiquidMetal](/docs/components/liquidmetal), [Marble](/docs/components/marble), [MeshGradient](/docs/components/meshgradient), [Nebula](/docs/components/nebula), [Obsidian](/docs/components/obsidian), [PixelThrow](/docs/components/pixelthrow), [Plastic](/docs/components/plastic), [Prism](/docs/components/prism), [ReactionDiffusion](/docs/components/reactiondiffusion), [Satin](/docs/components/satin), [Sparkle](/docs/components/sparkle), [StudioBackground](/docs/components/studiobackground), [Surface3D](/docs/components/surface3d), [TimeTrail](/docs/components/timetrail), [Voxels](/docs/components/voxels), [Water](/docs/components/water), [Waveform](/docs/components/waveform)