# Animation Clips

Use this behavior to play and sequence Unity animation clips, using an animation curve to control timing.&#x20;

{% hint style="info" %}
**This behavior does not support animation blending.**

For a different approach that does support animation blending, please see [Animation Sequencer](/timeflow/reference/behaviors/animation/animation-sequencer.md) and [Animator Blend Trees](/timeflow/reference/behaviors/animation.md).
{% endhint %}

{% hint style="success" %}
Find an example scene in:

Assets/AxonGenesis/Timeflow/Examples/Scenes/Animation/AnimationClips.unity
{% endhint %}

## Animator Component Setup

An [Animator ](https://docs.unity3d.com/Manual/class-Animator.html)(or legacy [Animation](https://docs.unity3d.com/Manual/class-Animation.html)) component is required to play animation clips, however must remain disabled (unchecked) for this setup.

<figure><img src="/files/X9QCShbpPAcnanpKpwlq" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
**Please leave the Animator component&#x20;*****off*****&#x20;and don't remove it**.\
The Animator component is disabled by Timeflow whenever using the Animation Clips behavior. This is required to function properly since Timeflow takes over animation updating and only uses Animator to reference the clips it contains.&#x20;
{% endhint %}

{% hint style="info" %}
The legacy Animation component is also supported and may be used instead of Animator.
{% endhint %}

<figure><img src="/files/d1iYmNJWNqJsRH3Jk6NS" alt=""><figcaption><p>Animation clips relating to states in the Animator controller.</p></figcaption></figure>

{% hint style="info" %}
To add more animation clips, drag and drop the clip assets from the Project view into the Animator Controller view, shown above.&#x20;
{% endhint %}

It is not necessary to configure blend tree logic for use with Timeflow, since it is ignored when using the Animation Clips behavior.&#x20;

## Adding Animation Clips in Timeflow

First add the object with Animator (or Animation) component to the Timeflow view.

{% hint style="success" %}
To add an animation clip channel, right-click the object in the Timeflow view and select **Add Animation > Clip >&#x20;*****Name of Clip***
{% endhint %}

<figure><img src="/files/UV8G2K71bOLPnJQJwAoD" alt=""><figcaption><p>The context menu automatically finds and lists all animations clips on the object.</p></figcaption></figure>

Each clip may be added individually or add All. Clip channels are all managed by 1 instance of the Animation Clips behavior.&#x20;

## Usage

When an animation clip channel is added, a start and end keyframe are automatically set, starting at the current time and matching the animation clip duration.

<figure><img src="/files/2MoWTQe4mx9YK9NeiDNA" alt=""><figcaption><p>Showing default keyframes added automatically when the channel is created.</p></figcaption></figure>

Switching to the Graph View shows the default linear interpolation applied. This faithfully plays back the original animation as-is without modifying its timing.&#x20;

<figure><img src="/files/JudAw5JOeHlTdWvOhxNb" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**To preserve the original timing of animation clips...**

Always use linear interpolation and make sure that the duration between the start and end keyframes is unchanged, though it's of course fine to move the keyframes together anywhere in the timeline to sequence the animation.
{% endhint %}

### Reset Animation Clip

<figure><img src="/files/VMoK8a9vJNTUxEAEjhOS" alt=""><figcaption></figcaption></figure>

At any time you wish to restore the original timing of the clip channel, right-click on the channel in the Timeflow view and select **Reset Animation Clip** from the menu.&#x20;

{% hint style="warning" %}
This clears all existing keyframes and creates new default ones with linear interpolation, starting at the current time.
{% endhint %}

### Execution Order

When one or more clips are sequenced at the same time (as shown below), one may overwrite others based on the channel order. The channels are processed from the top down, so the last (bottom) channel is applied last.

<figure><img src="/files/GVwULkBdAO1VxBPMIqth" alt=""><figcaption><p>Both animations play at the same time, but RunningJump overwrites Walking since it is listed after. Drag and drop the channels to reorder them.</p></figcaption></figure>

{% hint style="info" %}
**Animation Overwriting**&#x20;

This is only an issue if multiple animation clips target the same properties. If for example, one clip animates only a character's head and the other clip animates only the body, then both may play simultaneously without conflict. However, if both clips are animating the same properties, then overwriting will occur.
{% endhint %}

### Sequencing Clips

It is more common to use this method to create one-shot playback, where each clip is played at a different time as shown below.&#x20;

<figure><img src="/files/6lelp82kQwWB0oplGnKs" alt=""><figcaption><p> In this case there is no issue with channel order since keyframes are staggered and there is no overlap.</p></figcaption></figure>

{% hint style="info" %}
Although blending between clips is not supported, this approach can still be very useful to have a character or object performing specific actions. The transitions between each could be part of an edit sequence or masked by changing camera angles, which can be accomplished using [Blend](/timeflow/reference/behaviors/animation/blend.md).
{% endhint %}

For a different method of playing animation clips that allows blending and much more complex character control, see [Animator Blend Trees](/timeflow/reference/behaviors/animation/animator-blend-trees.md).

## Animation Clips Editor

Select the object to view the Animation Clips component in the Inspector.

<figure><img src="/files/lFX8ZWUqSPdthztJGDLw" alt=""><figcaption><p>Channels may also be reordered here by using the up/down arrows on the left.</p></figcaption></figure>

{% hint style="info" %}
Please note that new channels cannot be added in the editor. Use the context menu in the Timeflow view [as described above](#adding-animation-clips-in-timeflow) to add new animation clips channels.
{% endhint %}

For common features please refer to [Menu Bar](/timeflow/user-guide/timeflow-editor/menu-bar.md), [Channels](/timeflow/reference/timeflow-object/channels.md), and [Update Settings](/timeflow/user-guide/timeflow-editor/update-settings.md).

### Use Clip Name

By default the animation clip name is used as the channel name. Uncheck this box to enter a different name. This is only for display and has no effect on function.

### Animation Clip Select

The drop-down menu on each channel shows the current clip assigned and may be reassigned to a different one. However, note when doing this that the keyframe timing may be different and could affect the playback speed of the clip.

{% hint style="info" %}
You may have also noticed that an additional component was added to the game object. This is only a helper component and has no direct use. See [Animator Info](/timeflow/reference/behaviors/tools/animator-info.md) for details.
{% endhint %}

### Channel Details

Toggle the foldout for each listed channel to view more details.&#x20;

<figure><img src="/files/lUVZeLUBuF6UImjzuPUX" alt=""><figcaption></figcaption></figure>

Animation clip channels support all the functionality of standard keyframe channels including looping, value limits, shader global, and keyframe details.

{% hint style="info" %}
**Limit Value**

By default new animation clip channels are created with Limit Value set to 0 to 1. This is because the channel represents interpolation from 0-1 and values outside of this range are moot. It is recommended to leave this setting as-is.
{% endhint %}

For further documentation see [Channels](/timeflow/reference/timeflow-object/channels.md#channel-settings).

## Curve Editing

Animation clip channels by default use linear interpolation with keyframes matching the duration of the clip. This plays back animation as-is. However, all curve and keyframe editing features may be used to create any playback timing desired.

<figure><img src="/files/h2aWLniwvdLNOn2n1kqe" alt=""><figcaption><p>Default linear keyframes play back the animation without alteration.</p></figcaption></figure>

{% hint style="info" %}
Use the curve editing tools in the [Graph View](/timeflow/user-guide/timeflow-view/graph-view.md) to create dynamic changes in animation speed including slow motion and hyper speed effects.
{% endhint %}

<figure><img src="/files/QXAUkGvI6w3hMWdGXCIK" alt=""><figcaption><p>An example showing <a href="/pages/yrdLTZzQtZodkAzWBtEX#bezier">Bezier</a> curves being used to control animation clip timing.</p></figcaption></figure>

<figure><img src="/files/80PqVpCOf2jc4WGGj2jT" alt=""><figcaption><p>Add more keyframes to create any curve desired, and use the built-in looping features.</p></figcaption></figure>

{% hint style="info" %}
**Animation Effects**\
[Channel Link](/timeflow/user-guide/timeflow-view/channel-link.md) may also be used to drive animation clip channels with [Tween](/timeflow/reference/behaviors/animation/tween.md), [MidiTween](/timeflow/reference/behaviors/midi/midi-tween.md), or any channel to create complex time interpolations.&#x20;
{% endhint %}

<figure><img src="/files/XLAyrY6Eq2pvoNFD1zuY" alt=""><figcaption><p>Blending a Tween channel into an animation channel curve. Note that the final curve is modified by the channel link calculation, so no longer lines up with the keyframes.</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://axongenesis.gitbook.io/timeflow/reference/behaviors/animation/animation-clips.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
