# AnimTransition

Class · category: Animation

Source: https://github.com/playcanvas/engine/blob/f059dc005842f76e052cdf44d8370c8c7ec475ac/src/framework/anim/controller/anim-transition.js#L20

AnimTransitions represent connections in the controllers state graph between AnimStates. During
each frame, the controller tests to see if any of the AnimTransitions have the current AnimState
as their source (from) state. If so and the AnimTransitions parameter based conditions are met,
the controller will transition to the destination state.

Each condition compares a parameter with a value using one of the predicates such as
[ANIM_GREATER_THAN](https://api.playcanvas.com/engine/variables/ANIM_GREATER_THAN.md) or [ANIM_EQUAL_TO](https://api.playcanvas.com/engine/variables/ANIM_EQUAL_TO.md). `time` is the blend duration,
`exitTime` restricts the transition to a point in the source state's playback,
`priority` orders transitions whose conditions pass together, and
`interruptionSource` says which other transitions may cut this one short. A transition
may also start from the [ANIM_STATE_ANY](https://api.playcanvas.com/engine/variables/ANIM_STATE_ANY.md) state so that it applies from every state.

## Constructors

### constructor

```ts
new AnimTransition(options: object)
```

Create a new AnimTransition.

**Parameters**

- `options` (`object`): Options.
    - `options.conditions` (`any[]`, optional, default `[]`): A list of conditions which must pass for this
      transition to be used. Defaults to [].
    - `options.exitTime` (`number`, optional, default `null`): If provided, this transition will only be active for
      the exact frame during which the source states progress passes the time specified. Given as
      a normalized value of the source states duration. Values less than 1 will be checked every
      animation loop. Defaults to null.
    - `options.from` (`string`): The state that this transition will exit from.
    - `options.interruptionSource` (`string`, optional, default `ANIM_INTERRUPTION_NONE`): Defines whether another transition can
      interrupt this one and which of the current or previous states transitions can do so. One of
      ANIM_INTERRUPTION_*. Defaults to ANIM_INTERRUPTION_NONE.
    - `options.priority` (`number`, optional, default `0`): Used to sort all matching transitions in ascending
      order. The first transition in the list will be selected. Defaults to 0.
    - `options.time` (`number`, optional, default `0`): The duration of the transition in seconds. Defaults to 0.
    - `options.to` (`string`): The state that this transition will transition to.
    - `options.transitionOffset` (`number`, optional, default `null`): If provided, the destination state will begin
      playing its animation at this time. Given in normalized time, based on the state's duration
      and must be between 0 and 1. Defaults to null.
