> ## Documentation Index
> Fetch the complete documentation index at: https://rive-transitions-2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Transitions

export const VideoEmbed = ({src}) => {
  return <div style={{
    width: "100%",
    height: "100%",
    overflow: "hidden"
  }}>

      <video src={src} autoPlay loop muted playsInline style={{
    width: "100%",
    height: "100%",
    borderRadius: 0,
    margin: 0,
    display: "block",
    objectFit: "cover",
    backgroundColor: "transparent"
  }} />
    </div>;
};

export const YouTube = ({id, timestamp}) => {
  const videoSrc = timestamp ? `https://www.youtube.com/embed/${id}?start=${timestamp}` : `https://www.youtube.com/embed/${id}`;
  return <iframe width="100%" height="400" src={videoSrc} title="YouTube video player" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerPolicy="strict-origin-when-cross-origin" allowFullScreen />;
};

Transitions define how and when a State Machine moves from one state to another. A transition is made up of four parts:

<CardGroup cols={2}>
  <Card title="Path">
    The direction the transition travels.

    **Example**: A character might have one path from **Idle** to **Walk**, and another from **Walk** back to **Idle**.
  </Card>

  <Card title="Conditions">
    When the transition occurs.

    **Example**: A character might transition to **Walk** when a button is pressed, then back to **Idle** when the button is released.
  </Card>

  <Card title="Properties">
    How the transition behaves.

    **Example**: You might set the transition duration to `0.2` seconds so the change between states feels smoother.
  </Card>

  <Card title="Actions">
    Extra behavior to perform when the transition occurs.

    **Example**: A transition might fire an event, set a property value, or align a target.
  </Card>
</CardGroup>

<YouTube id="C4KNgrrqt7k" />

## Transition Path

A transition path determines how the State Machine moves from one state to another.

To create a transition path, move your cursor near the state you want to leave until the circle appears. Click and drag from the circle to the state you want to transition to.

<img src="https://mintcdn.com/rive-transitions-2/V0qymUioAXT1aguO/images/editor/state-machine/transitions/create-transition.gif?s=57a468877875ef3fb32ff7d040fcb494" alt="Creating a transition" width="640" height="229" data-path="images/editor/state-machine/transitions/create-transition.gif" />

Once you connect two states, the transition path shows a circle with an arrow icon indicating the transition direction. In this example, the State Machine can move from Timeline 1 to Timeline 2, but not from Timeline 2 back to Timeline 1.

To allow the State Machine to move back to Timeline 1, create another transition path starting from Timeline 2.

<img src="https://mintcdn.com/rive-transitions-2/V0qymUioAXT1aguO/images/editor/state-machine/transitions/create-reverse-transition.gif?s=b7d907d7338a2c49f525acc9835f6053" alt="Creating a reverse transition" width="640" height="242" data-path="images/editor/state-machine/transitions/create-reverse-transition.gif" />

You can create multiple transitions between the same two states. Each transition can have different [conditions](#transition-conditions), allowing you to create “or” logic.

<img src="https://mintcdn.com/rive-transitions-2/V0qymUioAXT1aguO/images/editor/state-machine/transitions/transition-or.gif?s=acb366e4420fb74d45d4cb4f0c3d76b5" alt="Creating an &#x22;or&#x22; transition" width="640" height="229" data-path="images/editor/state-machine/transitions/transition-or.gif" />

## Transition Conditions

Conditions determine when a transition can occur.

<Note>
  Without conditions, transitions fire as soon as they are reached. This can cause a State Machine to rapidly move between states or skip directly to a single animation.
</Note>

<YouTube id="30HJo_DaLDk" />

### Adding a Condition

To add a condition to a transition, select the transition, then click the plus button next to **Conditions**.

A condition has three parts:

* **Source value** - the value or event the condition watches
* **Operator** - how the source value is compared
* **Comparison value** - the value the source value is compared against

For example, a character might transition from **Idle** to **Walk** when `isWalking` is `true`.

In this condition, `isWalking` is the **source value**, **equals** is the **operator**, and `true` is the **comparison value**.

<img src="https://mintcdn.com/rive-transitions-2/V0qymUioAXT1aguO/images/editor/state-machine/transitions/add-condition.gif?s=5d1bdee68a0f8ee853ee241561afb50b" alt="Add a transition condition" width="640" height="242" data-path="images/editor/state-machine/transitions/add-condition.gif" />

#### The Source Value

Conditions can be driven by many different sources, including:

* View Model properties
* Events
* Built-in properties such as artboard width, height, and ratio

<img src="https://mintcdn.com/rive-transitions-2/V0qymUioAXT1aguO/images/editor/state-machine/transitions/source-value.png?fit=max&auto=format&n=V0qymUioAXT1aguO&q=85&s=afae4083b6fa4af5ab2bb6ede22c69ee" alt="Source value" width="1298" height="198" data-path="images/editor/state-machine/transitions/source-value.png" />

#### The Operator

Conditions can use comparisons such as equals, does not equal, greater than, greater than or equal to, less than, and less than or equal to. The available comparisons depend on the type of value being compared.

<img src="https://mintcdn.com/rive-transitions-2/V0qymUioAXT1aguO/images/editor/state-machine/transitions/comparisons.png?fit=max&auto=format&n=V0qymUioAXT1aguO&q=85&s=6b41dc16c7b1235dce6cfe32f03efc7a" alt="Operators" width="1298" height="199" data-path="images/editor/state-machine/transitions/comparisons.png" />

#### Comparison Value

The comparison value is the value the source value is compared against.

<img src="https://mintcdn.com/rive-transitions-2/V0qymUioAXT1aguO/images/editor/state-machine/transitions/comparison-value.png?fit=max&auto=format&n=V0qymUioAXT1aguO&q=85&s=df339e8586cf6924d47c99837e53c638" alt="Comparison value" width="1298" height="198" data-path="images/editor/state-machine/transitions/comparison-value.png" />

You can enter a fixed comparison value, such as `true`, `100`, or `"mobile"`. You can also data bind the comparison value to another property, allowing the transition to compare against dynamic data.

For example, a transition might occur when `speed` is greater than a data-bound `walkThreshold` value.

### Adding Multiple Conditions

You can add multiple conditions to a single transition. All conditions must be met before the transition occurs.

<img src="https://mintcdn.com/rive-transitions-2/V0qymUioAXT1aguO/images/editor/state-machine/transitions/or-condition.png?fit=max&auto=format&n=V0qymUioAXT1aguO&q=85&s=d95c0a4a6e27e24695347055f1872cd4" alt="Adding multiple conditions" width="1308" height="226" data-path="images/editor/state-machine/transitions/or-condition.png" />

## Transition Properties

Once you’ve added a transition, selecting the direction indicator will allow you to configure the transition. There are three different sections to the transition panel, the transition properties, conditions, and interpolation.

<Note>
  Selecting multiple transitions allows you to update multiple properties at once.
</Note>

<img src="https://mintcdn.com/rive-transitions-2/V0qymUioAXT1aguO/images/editor/state-machine/transitions/transition-properties.png?fit=max&auto=format&n=V0qymUioAXT1aguO&q=85&s=c14d89548f4b60d860cf27e3c1f365d6" alt="Transition properties" width="2388" height="1356" data-path="images/editor/state-machine/transitions/transition-properties.png" />

### Duration

The duration property describes how long it takes for a transition to occur.

The duration is set to zero by default, meaning the transition happens immediately. So, when we transition between these two animations, it appears as though the object snaps from one side of the artboard to the other.

<VideoEmbed src="https://static.rive.app/video/transition-duration.mp4" />

### Exit Time

Exit Time tells the state machine how much of the state must play before transitioning.

By default, Exit Time is unchecked. To enable Exit Time, use the checkbox. Once the setting is enabled, you can use either a time value or percent.

For example, if you want the state machine to play the entire animation before transitioning, you can either enter the duration of the animation, or use 100%.

<img src="https://mintcdn.com/rive-transitions-2/V0qymUioAXT1aguO/images/editor/state-machine/transitions/exit-time-100.gif?s=aa5d7001e0bb437f6b1de12898b3f3be" alt="Exit time 100%" width="640" height="359" data-path="images/editor/state-machine/transitions/exit-time-100.gif" />

### Pause Source When Exiting

**Pause Source When Exiting** pauses the animation in the state you are leaving while the transition plays.

In this example, the up-and-down motion pauses as soon as the transition begins.

<img src="https://mintcdn.com/rive-transitions-2/V0qymUioAXT1aguO/images/editor/state-machine/transitions/pause-source-when-exiting.gif?s=1959af3fd6cb889cc26f758630ff3594" alt="Pause when exiting" width="640" height="360" data-path="images/editor/state-machine/transitions/pause-source-when-exiting.gif" />

### Allow Exit During Transition

**Allow exit during transition** controls whether the State Machine can leave a transition before that transition finishes.

For example, if a button is transitioning from **Idle** to **Hover** and the user moves their cursor away, **Allow exit during transition** lets it transition back to Idle immediately.

<img src="https://mintcdn.com/rive-transitions-2/V0qymUioAXT1aguO/images/editor/state-machine/transitions/allow-exit-during-transition.gif?s=80a1f7af8ae49b04d17379883b892eca" alt="Allow exit during transition" width="636" height="352" data-path="images/editor/state-machine/transitions/allow-exit-during-transition.gif" />

### Interpolation

You can add interpolation to your transition at the bottom of the Transitions Panel. By default, the interpolation is set to linear, but you can use the cubic and other interpolations.

If you are unfamiliar with the basics of Interpolation, see [Interpolation (Easing)](/editor/animate-mode/interpolation-easing).

## Actions

Transitions can also perform actions when the transition occurs.

Unlike conditions, which determine whether a transition can happen, actions perform an operation when the transition is triggered.

Actions can be used to:

* Set property values
* Report events
* Align targets
* Control focus
* Fire a scripted action

<Note>
  Actions can also be fired at the start or end of a state.

  See [State Actions](/editor/state-machine/states#actions).
</Note>

<YouTube id="4Uuu0MkBawE" />

### Creating an Action

<img src="https://mintcdn.com/rive-transitions-2/V0qymUioAXT1aguO/images/editor/state-machine/transitions/transition-action.gif?s=42a36d195ac9df75e9f9c61cb91661fb" alt="Creating a transition action" width="640" height="187" data-path="images/editor/state-machine/transitions/transition-action.gif" />

<Steps>
  <Step title="Add an action">
    With a transition selected, go to the Actions tab, click the `+` button, and select an action type.
  </Step>

  <Step title="Configure the action">
    Configure the action based on the action type.
  </Step>
</Steps>

#### Action Timing

Each action can run at either:

* **Start** — Runs when the transition begins
* **End** — Runs after the transition completes

## Disabling a Transition

You can temporarily disable a transition without deleting it. Disabling is useful when you want to isolate part of a state machine for testing, or temporarily remove a path without losing its configuration.

There are two ways to toggle a transition's enabled state:

* **From the transition panel:** select the transition and click the enable/disable icon in the panel.
* **From the canvas:** right-click the transition and choose **Disable transition** (or **Enable transition** if it's already disabled).

<img src="https://mintcdn.com/rive-transitions-2/V0qymUioAXT1aguO/images/editor/state-machine/state-machine-transition-disable.gif?s=5281b7d45eabe39ae507b4fc8a5c46a4" alt="Disable transition from the right-click menu" width="1200" height="409" data-path="images/editor/state-machine/state-machine-transition-disable.gif" />
