---
title: "crosses"
description: "Rebuild the shader only when the prop crosses `value`, not on every change."
group: "define"
groupTitle: "Defining a shader"
categoryId: "slots"
categorySlug: "slots"
categoryTitle: "Identity & recompile rules"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/slots.ts#L32"
---

# crosses

Rebuild the shader only when the prop crosses `value`, not on every change.

```ts
crosses(value: number): RecompileRule
```

Import `crosses` from `shaders/std`.

Put it on a prop's `recompile:`. Pair it with an identity rule at the same value: the rule decides whether the filter is skipped, and this is what lets that decision change.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `value` | `number` |  |

## Example

```ts
props: {shift: {default: 0, recompile: crosses(0)}},
effect: hueRotate(p('shift')),
identityWhen: isZero('shift'),
```

> **Tip.** Without it a runtime prop never rebuilds, so a filter that started skipped stays skipped.

## See also

- [`isZero`](/docs/primitives/slots/iszero) — Skip the filter entirely while `prop` is exactly 0.
- [`isValue`](/docs/primitives/slots/isvalue) — Skip the filter entirely while `prop` equals `value`, for a filter whose no-op is not 0.
- [`recompileWhen`](/docs/primitives/slots/recompilewhen) — Rebuild when your own test of the old and new value says so, for a threshold `crosses` cannot express.

## Used by

[AngularBlur](/docs/components/angularblur), [BrightnessContrast](/docs/components/brightnesscontrast), [DiffuseBlur](/docs/components/diffuseblur), [Exposure](/docs/components/exposure), [FilmGrain](/docs/components/filmgrain), [FilmStock](/docs/components/filmstock), [Glow](/docs/components/glow), [GradientMap](/docs/components/gradientmap), [HueShift](/docs/components/hueshift), [LinearBlur](/docs/components/linearblur), [MeshGradient](/docs/components/meshgradient), [ProgressiveBlur](/docs/components/progressiveblur), [Repeater](/docs/components/repeater), [Saturation](/docs/components/saturation), [Sharpness](/docs/components/sharpness), [Solarize](/docs/components/solarize), [Sparkle](/docs/components/sparkle), [TiltShift](/docs/components/tiltshift), [Vibrance](/docs/components/vibrance), [Vignette](/docs/components/vignette), [Watercolor](/docs/components/watercolor), [ZoomBlur](/docs/components/zoomblur)