# defineAnimation

`defineAnimation(options)` creates an immutable seekable definition whose
synchronous sampler receives the activation value, local time, and normalized
progress. Use it when the built-in tween, keyframe, and spring definitions do
not describe the required value curve.

Related types: [`PibblAnimationDefinition`](/reference/types/canvas-runtime/#pibblanimationdefinition),
[`PibblAnimationOptions`](/reference/types/canvas-runtime/#pibblanimationoptions), and
[`PibblAnimationSampleInput`](/reference/types/canvas-runtime/#pibblanimationsampleinput).

## API details from source

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

Returns an opaque immutable definition from a custom seekable sampler.

```ts
defineAnimation: <T>(options: Readonly<PibblAnimationOptions<T>>) => PibblAnimationDefinition<T>
```

Related API: [defineAnimation](/reference/functions/define-animation/), [PibblAnimationOptions](/reference/types/canvas-runtime/#pibblanimationoptions), [PibblAnimationDefinition](/reference/types/canvas-runtime/#pibblanimationdefinition).

### Parameters

- **`options`** — Duration and pure sampling callback for the animation. See
[PibblAnimationOptions](/reference/types/canvas-runtime/#pibblanimationoptions) .

### Returns

An immutable, seekable animation definition. See [PibblAnimationDefinition](/reference/types/canvas-runtime/#pibblanimationdefinition).

### See also

[PibblAnimationOptions](/reference/types/canvas-runtime/#pibblanimationoptions)

[PibblAnimationDefinition](/reference/types/canvas-runtime/#pibblanimationdefinition)

[View source — packages/core/src/lib/animation/definition.ts:645](/source/packages/core/src/lib/animation/definition-ts/#L645)

## 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

- [Custom sampling and fixed steps](/minimal-examples/animation/custom/): Combine a time-sampled sine wave with a fixed-step state machine. [Plain source](/minimal/animation/custom.tsx)
## Documentation version

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