# spring

`spring(options)` returns a number-only analytic damped-oscillator definition.
Mass, stiffness, damping, velocity, rest thresholds, and a maximum duration are
explicit options. Sampling derives from logical time rather than accumulating
display-frame deltas.

Related types: [`PibblAnimationDefinition`](/reference/types/canvas-runtime/#pibblanimationdefinition)
and [`PibblSpringOptions`](/reference/types/canvas-runtime/#pibblspringoptions).

## API details from source

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

Returns an opaque immutable analytic one-dimensional spring definition.

```ts
spring: (options?: Readonly<PibblSpringOptions>) => PibblAnimationDefinition<number>
```

Related API: [spring](/reference/functions/spring/), [PibblSpringOptions](/reference/types/canvas-runtime/#pibblspringoptions), [PibblAnimationDefinition](/reference/types/canvas-runtime/#pibblanimationdefinition).

### Parameters

- **`options`** — Target, initial conditions, and spring parameters. See [PibblSpringOptions](/reference/types/canvas-runtime/#pibblspringoptions).

### Returns

An analytic numeric spring definition. See [PibblAnimationDefinition](/reference/types/canvas-runtime/#pibblanimationdefinition).

### See also

[PibblSpringOptions](/reference/types/canvas-runtime/#pibblspringoptions)

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

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

## 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)
## Interactive examples

- [Signals and animation](/examples/signals-and-animation/) · [Full page](/experience/signals-and-animation/)
## Documentation version

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