> ## Documentation Index
> Fetch the complete documentation index at: https://docs.altoura.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Play Timeline Animation & Stop Timeline Animation

> Trigger custom animation sequences created in the Timeline editor

## Overview

The **Play Timeline Animation** and **Stop Timeline Animation** actions control animation sequences that you create in the Creator App's Timeline editor. Unlike **Play Object Animation** (which triggers pre-baked model animations), Timeline animations are authored in the Creator App and can combine movements, visibility changes, timing, and other effects across multiple objects and properties.

## Play Timeline Animation

### When to Use

* **Custom animation sequences**: play an animation you created in the Timeline editor
* **Synchronized multi-object animations**: coordinate movements across several objects
* **Procedural effects**: fade objects in/out, move camera, or rotate multiple objects together
* **Scripted demonstrations**: show step-by-step visual walkthroughs

### Parameters

| Parameter   | Type   | Required | Description                                                                                                             |
| ----------- | ------ | -------- | ----------------------------------------------------------------------------------------------------------------------- |
| Timeline ID | string | Yes      | Select the timeline animation you created in the Timeline editor. This is the ID/name of the timeline you want to play. |
| Play Mode   | enum   | No       | How the animation plays: `once` (play once) or `loop` (repeat continuously). Default is `once`.                         |
| Speed       | number | No       | Playback speed multiplier. Default is `1.0`. Set to `0.5` for slower, `2.0` for faster.                                 |

### Key Behavior

* **Authored in Timeline**: The timeline must exist in your Creator App project. Design it in the Timeline editor first.
* **Fire and forget**: The action starts playback; subsequent actions don't wait unless you add a Delay.
* **No blocking**: Other interactions or transitions can occur while the timeline plays.

## Stop Timeline Animation

### When to Use

* **Interrupt animations**: stop a looping timeline animation when exiting a state
* **Clean up**: ensure timelines don't continue playing unexpectedly
* **Multi-animation management**: stop a specific timeline while others continue

### Parameters

| Parameter   | Type   | Required | Description                                                                                |
| ----------- | ------ | -------- | ------------------------------------------------------------------------------------------ |
| Timeline ID | string | No       | (Optional) Specify the timeline to stop. If omitted, all playing timeline animations stop. |

### Key Behavior

* **Selective or omnibus**: Stop a specific timeline by ID, or stop all timelines if you leave Timeline ID empty.
* **Safe to call**: Calling Stop Timeline Animation when no timeline is playing has no effect.

## Practical Examples

### Animated Tutorial Walkthrough

**Scenario**: A state shows a multi-step assembly task. A timeline demonstrates each step in sequence: move component A, rotate it, attach component B, then highlight the result.

<Steps>
  <Step>
    In the Timeline editor, create a timeline called `assembly_demo`:

    * 0–2s: move component\_a to position
    * 2–3s: rotate component\_a
    * 3–4s: move component\_b into place
    * 4–5s: highlight both components
  </Step>

  <Step>
    In your training state's `onEntry`:

    1. **Play Timeline Animation**: Timeline ID: `assembly_demo`
    2. **Delay**: `5000` (let the timeline complete)
    3. **Show Prompt**: display instructions for learner to replicate the steps
  </Step>

  <Step>
    The demonstration plays, then the learner is prompted to perform the task.
  </Step>
</Steps>

### Looping Environment Animation

**Scenario**: A factory state has a continuously running conveyor belt animation.

<Steps>
  <Step>
    Create a timeline called `conveyor_loop` that animates the belt continuously.
  </Step>

  <Step>
    In the **FactoryFloor** state's `onEntry`:

    * **Play Timeline Animation**: Timeline ID: `conveyor_loop`, Play Mode: `loop`
  </Step>

  <Step>
    In the `onExit`:

    * **Stop Timeline Animation**: Timeline ID: `conveyor_loop`
  </Step>

  <Step>
    The conveyor loops throughout the state and stops when exiting.
  </Step>
</Steps>

### Speed-Controlled Demonstration

**Scenario**: Show a process animation at different speeds. Instructors can choose "normal speed" or "slow motion" for detailed learning.

<Steps>
  <Step>
    In a transition action list (triggered by a button):

    1. **Set Variable**: `demoSpeed = 0.5` (slow motion flag)
    2. **Play Timeline Animation**: Timeline ID: `process_demo`, Speed: `0.5`
  </Step>

  <Step>
    Learners see the demonstration in slow motion for greater detail.
  </Step>
</Steps>

### Conditional Animation Cleanup

**Scenario**: Multiple timelines might be playing. Stop only specific ones based on learner actions.

<Steps>
  <Step>
    Suppose two timelines are running: `background_loop` and `object_focus`.
  </Step>

  <Step>
    When the learner clicks "focus on object", execute:

    * **Stop Timeline Animation**: Timeline ID: `background_loop` (keep object animation running)
  </Step>

  <Step>
    The background animation stops; the object focus animation continues.
  </Step>
</Steps>

<Tip>
  Design timelines in the Timeline editor with reusability in mind. A well-crafted `conveyor_loop` or `failure_flash` timeline can be triggered from multiple states, keeping your training logic DRY (don't repeat yourself).
</Tip>

<Note>
  Timeline animations and Object Animations can play simultaneously. For example, you could play an object's embedded animation (e.g., `valve_open`) while a timeline animation (e.g., `camera_pan`) runs at the same time. Both will execute in parallel.
</Note>

<Warning>
  Make sure the timeline exists in your Creator App project before referencing it. If a Timeline ID doesn't match any timeline, the action will log an error but won't crash the training.
</Warning>
