# Play Animation

## Overview

![The Play Animation Node.](https://2628349686-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fwnv17cpjDin2deSlOz0z%2Fuploads%2Fgit-blob-7adb1b15340a0cfa9d64a89a96d73b046f7aaf4c%2Fplayanimationupdatedimage.png?alt=media)

**Play Animation** is an **Animation** **Node** used to start playing an **Animation**. The **Animation** to play has to be selected in the **Attributes**. For this, simply drag an **Animation** `.incani` file from the **Asset Manager** to the `File` **Attribute** and then a drop-down Menu that allows the user to choose an **Animation Block** will appear.

When an **Animation** starts playing, an [**Instance ID**](https://docs.incari.com/incari-studio/2023.1/toolbox/incari/animation/..#instance-id) gets assigned to it, which is then used to control the **Animation** with the [**Pause Animation**](https://docs.incari.com/incari-studio/2023.1/toolbox/incari/animation/pauseanimation) or [**Stop Animation**](https://docs.incari.com/incari-studio/2023.1/toolbox/incari/animation/stopanimation) **Nodes**. This [**Instance ID**](https://docs.incari.com/incari-studio/2023.1/toolbox/incari/animation/..#instance-id) can be set with the [**Create CustomID Node**](https://docs.incari.com/incari-studio/2023.1/toolbox/utilities/createcustomid) connected to the `Instance ID` **Input Socket**. If nothing is connected, the default value 42 is used.

It is also possible to [reuse an **Animation** with a different **Object**](#reusing-an-animation).

[**Scope**](https://docs.incari.com/incari-studio/2023.1/overview#scopes): **Scene**, **Function**, **Prefab**.

### Attributes

![The Play Animation Node Attributes.](https://2628349686-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fwnv17cpjDin2deSlOz0z%2Fuploads%2Fgit-blob-f2d5290cbcfda743857d1424384583729ae662c5%2Fnode-play-animation-attr.png?alt=media)

| Attribute | Type           | Description                                                                                                                                                                                                                                                                                                                                                              |
| --------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `File`    | **User Input** | The selected **Animation** file created in the [**Animation Editor**](https://docs.incari.com/incari-studio/2023.1/modules/animation-editor). The user can drag a file from their library or select a file from a file tree. The icons to the right allow the user to confirm the selection, highlight the **Asset** in the **Asset Manager**, and remove the selection. |
| `Name`    | **Drop-down**  | The specified **Animation Block** created in the **Animation Editor** that will be played.                                                                                                                                                                                                                                                                               |

### Inputs

| Input             | Type           | Description                                                                                                                                |
| ----------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| *Pulse Input* (►) | **Pulse**      | A standard **Input Pulse**, to trigger the execution of the **Node**.                                                                      |
| `Instance ID`     | **InstanceID** | The assigned [**Instance ID**](https://docs.incari.com/incari-studio/2023.1/toolbox/incari/animation/..#instance-id) of the **Animation**. |

### Outputs

| Output             | Type           | Description                                                                                                                                           |
| ------------------ | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| *Pulse Output* (►) | **Pulse**      | A standard **Output Pulse**, to move onto the next **Node** along the **Logic Branch**, once this **Node** has finished its execution.                |
| `Instance ID`      | **InstanceID** | The previously assigned [**Instance ID**](https://docs.incari.com/incari-studio/2023.1/toolbox/incari/animation/..#instance-id) of the **Animation**. |
| `OnPlay`           | **Pulse**      | Flows to additional **Nodes** following **Play Animation** when the **Animation** starts playing.                                                     |
| `OnPause`          | **Pulse**      | Flows to additional **Nodes** following **Play Animation** if the **Animation** pauses.                                                               |
| `OnStop`           | **Pulse**      | Flows to additional **Nodes** following **Play Animation** if the **Animation** stops.                                                                |

### Reusing an Animation

![The Play Animation Node with an Animation Block assigned](https://2628349686-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fwnv17cpjDin2deSlOz0z%2Fuploads%2Fgit-blob-1d1c0e227018e300bb183b0d4cbc3ecddd404b75%2Fnode-play-animation-block.png?alt=media)

Using the **Play Animation Node**, it is possible to reuse an **Animation** for a different **Object** than the one used in the `.incani` file. For this, the **ObjectID** **Input Sockets** must be used.

When an **Animation Block** is assigned to the **Play Animation Node** in the **Attributes**, new **ObjectID** **Input Sockets** are created, one for each **Object** in the **Animation Block**. These **Input Socket** can be used to animate a different **Object**.

Thus, a **Play Animation** **Node** with an **Object** connected to the **ObjectID** **Sockets** will animate that **Object** instead of the one defined in the **Animation Block**. In the example below, `Object2` will be animated instead of `Object1`, which was the **Object** originally used in the **Animation**.

![The Play Animation Node with an Animation Block assigned and an Object connected](https://2628349686-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fwnv17cpjDin2deSlOz0z%2Fuploads%2Fgit-blob-6d26bb8b533c73f1976dd69468f7fcaf53b722e0%2Fnode-play-animation-block2.png?alt=media)

## See Also

* [**Pause Animation**](https://docs.incari.com/incari-studio/2023.1/toolbox/incari/animation/pauseanimation)
* [**Stop Animation**](https://docs.incari.com/incari-studio/2023.1/toolbox/incari/animation/stopanimation)
