# repeat

`repeat(program, options)` repeats a child for a positive iteration count or
infinity. Direction is `normal`, `reverse`, `alternate`, or
`alternate-reverse`. Infinite repeats are valid only where the surrounding
composition can schedule them unambiguously.

Related types: [`PibblAnimationProgram`](/reference/types/canvas-runtime/#pibblanimationprogram),
[`PibblAnimationRepeatOptions`](/reference/types/canvas-runtime/#pibblanimationrepeatoptions),
and [`PibblAnimationRepeatDirection`](/reference/types/canvas-runtime/#pibblanimationrepeatdirection).

## API details from source

<span id="api-repeat"></span>

Repeats one child a total number of iterations.

```ts
repeat: (child: PibblAnimationProgram, options: Readonly<PibblAnimationRepeatOptions>) => PibblAnimationProgram
```

Related API: [repeat](/reference/functions/repeat/), [PibblAnimationProgram](/reference/types/canvas-runtime/#pibblanimationprogram), [PibblAnimationRepeatOptions](/reference/types/canvas-runtime/#pibblanimationrepeatoptions).

### Parameters

- **`child`** — Program to repeat. See [PibblAnimationProgram](/reference/types/canvas-runtime/#pibblanimationprogram).

- **`options`** — Repeat count and repetition policy. See [PibblAnimationRepeatOptions](/reference/types/canvas-runtime/#pibblanimationrepeatoptions).

### Returns

A program representing the requested repetitions. See [PibblAnimationProgram](/reference/types/canvas-runtime/#pibblanimationprogram).

### See also

[PibblAnimationProgram](/reference/types/canvas-runtime/#pibblanimationprogram)

[PibblAnimationRepeatOptions](/reference/types/canvas-runtime/#pibblanimationrepeatoptions)

[View source — packages/core/src/lib/animation/program.ts:915](/source/packages/core/src/lib/animation/program-ts/#L915)

## Implementation guidance for agents

Read the [Animation and scheduling companion](/agents/topics/animation/) for ownership, adaptation, failure modes, and verification. [Agent start](/agents/) provides the version-selection workflow.

## Complete minimal examples

- [Compose keyframes and springs](/minimal-examples/animation/composition/): Run two independent tracks together, then mark, wait, and repeat. [Plain source](/minimal/animation/composition.tsx)
## Documentation version

Documentation built with @pibbl/core 0.0.2, revision 272a94a. ALPHA — NOT FOR PRODUCTION USE.
