---
title: "repeatInstances"
description: "Many copies of the layer inside, laid out and varied as the recipe says."
group: "effects"
groupTitle: "Filters & effects"
categoryId: "effects.instances"
categorySlug: "effects-instances"
categoryTitle: "Instances"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/effects/instances.ts#L178"
---

# repeatInstances

Many copies of the layer inside, laid out and varied as the recipe says.

```ts
repeatInstances(recipe: RepeatInstancesRecipe): (params: GpuFragmentParams) => Expr
```

Import `effects` from `shaders/std` and use `effects.instances.repeatInstances`.

Returns the fragment for `gpu.fragment` on a definition with `requiresRTT`, `requiresChild` and `wantsBoundsParams` set. Copies stack with normal alpha in the recipe's `order`. The result is straight alpha.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `recipe` | `RepeatInstancesRecipe` |  |

## Example

```ts
gpu: {fragment: repeatInstances({source: {crop: {left: p('cropLeft'), right: p('cropRight'), top: p('cropTop'), bottom: p('cropBottom')}}, placement: radial({count: p('count'), radius: p('radius'), startAngle: p('startAngle'), sweep: p('sweep'), faceCenter: p('faceCenter')}), variation: {scale: p('instanceScale'), rotation: p('instanceRotation'), opacity: p('instanceOpacity'), jitter: {position: p('jitterPosition'), rotation: p('jitterRotation'), scale: p('jitterScale'), opacity: p('jitterOpacity')}, seed: p('seed'), phase: p('phase')}, hueShift: p('hueShift'), order: p('zOrder')})}
```

> **Tip.** `hueShift` costs nothing at 0. Give the prop `recompile: crosses(0)` so it switches on cleanly.

## See also

- [`grid`](/docs/primitives/effects-instances/grid) — Copies in rows and columns, filling this layer's bounding box.
- [`radial`](/docs/primitives/effects-instances/radial) — Copies around a circle centred on the layer inside.
- [`line`](/docs/primitives/effects-instances/line) — Copies in a row, marching away from the layer inside in one direction.
- [`byMode`](/docs/primitives/effects-instances/bymode) — Lets one select prop switch between a grid, a radial and a linear layout.

## Used by

[Repeater](/docs/components/repeater)